Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
planner-team-one
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
21
Issues
21
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Евгений Положенцев
planner-team-one
Commits
63f90e04
Commit
63f90e04
authored
Nov 30, 2022
by
Ibadullina Inabat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
временно реализован вывод участиков проекта
parent
a09aa306
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
112 additions
and
8 deletions
+112
-8
ProjectMembersItem.js
...t/src/components/ProjectMembersItem/ProjectMembersItem.js
+33
-0
ProjectMembersList.js
...t/src/components/ProjectMembersList/ProjectMembersList.js
+19
-0
FullProject.js
planner-front/src/containers/FullProject/FullProject.js
+22
-1
NewProject.js
planner-front/src/containers/NewProject/NewProject.js
+1
-2
Projects.js
planner-front/src/containers/Projects/Projects.js
+3
-1
userActionTypes.js
planner-front/src/store/actionTypes/userActionTypes.js
+5
-1
usersActions.js
planner-front/src/store/actions/usersActions.js
+25
-2
usersReducer.js
planner-front/src/store/reducers/usersReducer.js
+4
-1
No files found.
planner-front/src/components/ProjectMembersItem/ProjectMembersItem.js
0 → 100644
View file @
63f90e04
import
{
Card
,
CardActions
,
CardContent
,
Grid
,
IconButton
}
from
"@mui/material"
;
import
{
Link
}
from
"react-router-dom"
;
import
ArrowForwardIcon
from
"@mui/icons-material/ArrowForward"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
const
ProjectMembersItem
=
({
displayName
,
id
})
=>
{
const
dispatch
=
useDispatch
();
const
{
projects
,
project
}
=
useSelector
(
state
=>
state
.
projects
);
return
<>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
6
}
lg
=
{
4
}
>
<
Card
>
<
CardContent
>
<
strong
>
<
br
><
/br
>
{
displayName
}
<
/strong
>
<
strong
>
<
br
><
/br
>
роль
:
{
project
?.
project
?.
members
[
0
]?.
roleProject
}
<
/strong
>
<
strong
>
<
br
><
/br
>
<
button
>
delete
<
/button
>
<
/strong
>
<
/CardContent
>
<
/Card
>
<
/Grid>
<
/
>
};
export
default
ProjectMembersItem
;
planner-front/src/components/ProjectMembersList/ProjectMembersList.js
0 → 100644
View file @
63f90e04
import
{
Grid
}
from
"@mui/material"
;
import
ProjectMembersItem
from
"../ProjectMembersItem/ProjectMembersItem"
;
const
ProjectMembersList
=
({
users
})
=>
{
console
.
log
(
users
)
return
(
<
Grid
item
container
direction
=
"row"
spacing
=
{
1
}
>
{
users
?.
map
(
user
=>
{
return
<
ProjectMembersItem
displayName
=
{
user
.
displayName
}
id
=
{
user
.
id
}
key
=
{
user
.
id
}
/
>
})}
<
/Grid
>
);
};
export
default
ProjectMembersList
;
\ No newline at end of file
planner-front/src/containers/FullProject/FullProject.js
View file @
63f90e04
...
@@ -4,16 +4,27 @@ import { useSelector, useDispatch } from "react-redux";
...
@@ -4,16 +4,27 @@ import { useSelector, useDispatch } from "react-redux";
import
{
useEffect
}
from
"react"
;
import
{
useEffect
}
from
"react"
;
import
{
fetchProject
}
from
"../../store/actions/projectsActions"
;
import
{
fetchProject
}
from
"../../store/actions/projectsActions"
;
import
ProjectTasksBody
from
"../../components/ProjectTasks/ProjectTasksBody"
;
import
ProjectTasksBody
from
"../../components/ProjectTasks/ProjectTasksBody"
;
import
{
fetchUsers
}
from
"../../store/actions/usersActions"
;
import
ProjectMembersList
from
"../../components/ProjectMembersList/ProjectMembersList"
;
const
FullProject
=
()
=>
{
const
FullProject
=
()
=>
{
const
{
projects
,
project
}
=
useSelector
(
state
=>
state
.
projects
);
const
{
projects
,
project
}
=
useSelector
(
state
=>
state
.
projects
);
const
users
=
useSelector
(
state
=>
state
.
users
.
users
);
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
params
=
useParams
()
const
params
=
useParams
()
const
tasks
=
project
.
tasks
;
const
tasks
=
project
.
tasks
;
console
.
log
(
projects
);
console
.
log
(
projects
);
console
.
log
(
tasks
);
console
.
log
(
tasks
);
useEffect
(()
=>
{
dispatch
(
fetchUsers
())
},
[
dispatch
]);
console
.
log
(
users
)
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchProject
(
params
.
id
))
dispatch
(
fetchProject
(
params
.
id
))
},
[
params
.
id
,
dispatch
]);
},
[
params
.
id
,
dispatch
]);
...
@@ -34,7 +45,17 @@ const FullProject = () => {
...
@@ -34,7 +45,17 @@ const FullProject = () => {
<
/strong
>
<
/strong
>
<
strong
>
<
strong
>
<
br
><
/br
>
<
br
><
/br
>
{
/* Админ проекта: {project?.project?.members} */
}
Автор
проекта
:
{
project
?.
project
?.
members
[
0
]?.
user
.
displayName
}
<
/strong
>
<
strong
>
<
br
><
/br
>
Роль
в
проекте
:
{
project
?.
project
?.
members
[
0
]?.
roleProject
}
<
/strong
>
<
strong
>
<
br
><
/br
>
Участники
проекта
:
<
ProjectMembersList
users
=
{
users
}
project
=
{
project
}
/
>
<
/strong
>
<
/strong
>
<
strong
>
<
strong
>
<
br
><
/br
>
<
br
><
/br
>
...
...
planner-front/src/containers/NewProject/NewProject.js
View file @
63f90e04
...
@@ -9,12 +9,11 @@ const NewProject = () => {
...
@@ -9,12 +9,11 @@ const NewProject = () => {
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
projects
=
useSelector
(
state
=>
state
.
projects
.
projects
);
const
projects
=
useSelector
(
state
=>
state
.
projects
.
projects
);
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
let
lastProject
=
projects
.
projects
[
projects
.
projects
.
length
-
1
];
const
onSubmit
=
async
(
projectData
)
=>
{
const
onSubmit
=
async
(
projectData
)
=>
{
await
dispatch
(
createProject
(
projectData
,
navigate
));
await
dispatch
(
createProject
(
projectData
,
navigate
));
console
.
log
(
projectData
)
console
.
log
(
projectData
)
console
.
log
(
lastProject
)
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
...
...
planner-front/src/containers/Projects/Projects.js
View file @
63f90e04
...
@@ -11,8 +11,10 @@ import NewProject from "../NewProject/NewProject";
...
@@ -11,8 +11,10 @@ import NewProject from "../NewProject/NewProject";
const
Projects
=
()
=>
{
const
Projects
=
()
=>
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
{
projects
,
loading
}
=
useSelector
(
state
=>
state
.
projects
.
projects
);
const
{
projects
,
loading
}
=
useSelector
(
state
=>
state
.
projects
.
projects
);
const
{
users
}
=
useSelector
(
state
=>
state
.
users
);
console
.
log
(
projects
)
console
.
log
(
projects
)
console
.
log
(
loading
)
console
.
log
(
users
)
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchProjects
())
dispatch
(
fetchProjects
())
},
[
dispatch
]);
},
[
dispatch
]);
...
...
planner-front/src/store/actionTypes/userActionTypes.js
View file @
63f90e04
...
@@ -6,4 +6,8 @@ export const LOGIN_USER_SUCCESS = "LOGIN_USER_SUCCESS";
...
@@ -6,4 +6,8 @@ export const LOGIN_USER_SUCCESS = "LOGIN_USER_SUCCESS";
export
const
LOGIN_USER_FAILURE
=
"LOGIN_USER_FAILURE"
;
export
const
LOGIN_USER_FAILURE
=
"LOGIN_USER_FAILURE"
;
export
const
LOGOUT_USER_SUCCESS
=
"LOGOUT_USER_SUCCESS"
;
export
const
LOGOUT_USER_SUCCESS
=
"LOGOUT_USER_SUCCESS"
;
export
const
LOGOUT_USER_FAILURE
=
"LOGOUT_USER_FAILURE"
;
export
const
LOGOUT_USER_FAILURE
=
"LOGOUT_USER_FAILURE"
;
\ No newline at end of file
export
const
FETCH_USERS_REQUEST
=
"FETCH_USERS_REQUEST"
;
export
const
FETCH_USERS_SUCCESS
=
"FETCH_USERS_SUCCESS"
;
export
const
FETCH_USERS_FAILURE
=
"FETCH_USERS_FAILURE"
;
\ No newline at end of file
planner-front/src/store/actions/usersActions.js
View file @
63f90e04
import
axios
from
"../../axiosPlanner"
;
import
axios
from
"../../axiosPlanner"
;
import
{
LOGIN_USER_FAILURE
,
LOGIN_USER_SUCCESS
,
LOGOUT_USER_FAILURE
,
LOGOUT_USER_SUCCESS
,
REGISTER_USER_FAILURE
,
REGISTER_USER_REQUEST
,
REGISTER_USER_SUCCESS
}
from
"../actionTypes/userActionTypes"
import
{
FETCH_USERS_FAILURE
,
FETCH_USERS_REQUEST
,
FETCH_USERS_SUCCESS
,
LOGIN_USER_FAILURE
,
LOGIN_USER_SUCCESS
,
LOGOUT_USER_FAILURE
,
LOGOUT_USER_SUCCESS
,
REGISTER_USER_FAILURE
,
REGISTER_USER_REQUEST
,
REGISTER_USER_SUCCESS
}
from
"../actionTypes/userActionTypes"
import
{
showNotification
}
from
"./commonActions"
;
import
{
showNotification
}
from
"./commonActions"
;
const
registerUserRequest
=
()
=>
{
const
registerUserRequest
=
()
=>
{
...
@@ -14,6 +14,16 @@ const registerUserFailure = (error) => {
...
@@ -14,6 +14,16 @@ const registerUserFailure = (error) => {
return
{
type
:
REGISTER_USER_FAILURE
,
error
}
return
{
type
:
REGISTER_USER_FAILURE
,
error
}
};
};
const
fetchUsersRequest
=
()
=>
{
return
{
type
:
FETCH_USERS_REQUEST
}
};
const
fetchUsersSuccess
=
(
users
)
=>
{
return
{
type
:
FETCH_USERS_SUCCESS
,
users
}
};
const
fetchUsersFailure
=
()
=>
{
return
{
type
:
FETCH_USERS_FAILURE
}
};
export
const
registerUser
=
(
userData
,
navigate
)
=>
{
export
const
registerUser
=
(
userData
,
navigate
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
registerUserRequest
());
dispatch
(
registerUserRequest
());
...
@@ -90,4 +100,17 @@ export const logoutUser = (navigate) => {
...
@@ -90,4 +100,17 @@ export const logoutUser = (navigate) => {
dispatch
(
showNotification
(
"Не удалось выйти"
,
"error"
));
dispatch
(
showNotification
(
"Не удалось выйти"
,
"error"
));
}
}
}
}
}
}
\ No newline at end of file
export
const
fetchUsers
=
()
=>
{
return
async
dispatch
=>
{
dispatch
(
fetchUsersRequest
());
try
{
const
response
=
await
axios
.
get
(
"/users"
);
dispatch
(
fetchUsersSuccess
(
response
.
data
.
users
));
console
.
log
(
response
.
data
.
users
)
}
catch
(
e
)
{
dispatch
(
fetchUsersFailure
(
e
));
}
}
};
\ No newline at end of file
planner-front/src/store/reducers/usersReducer.js
View file @
63f90e04
import
{
REGISTER_USER_REQUEST
,
REGISTER_USER_SUCCESS
,
REGISTER_USER_FAILURE
,
LOGIN_USER_SUCCESS
,
LOGIN_USER_FAILURE
,
LOGOUT_USER_SUCCESS
}
from
"../actionTypes/userActionTypes"
;
import
{
REGISTER_USER_REQUEST
,
REGISTER_USER_SUCCESS
,
REGISTER_USER_FAILURE
,
LOGIN_USER_SUCCESS
,
LOGIN_USER_FAILURE
,
LOGOUT_USER_SUCCESS
,
FETCH_USERS_SUCCESS
}
from
"../actionTypes/userActionTypes"
;
const
initialState
=
{
const
initialState
=
{
user
:
null
,
user
:
null
,
users
:
[],
registerError
:
null
,
registerError
:
null
,
loginError
:
null
,
loginError
:
null
,
loading
:
false
loading
:
false
...
@@ -24,6 +25,8 @@ const usersReducer = (state = initialState, action) => {
...
@@ -24,6 +25,8 @@ const usersReducer = (state = initialState, action) => {
return
{...
state
,
loginError
:
action
.
error
};
return
{...
state
,
loginError
:
action
.
error
};
case
LOGOUT_USER_SUCCESS
:
case
LOGOUT_USER_SUCCESS
:
return
{...
state
,
user
:
null
};
return
{...
state
,
user
:
null
};
case
FETCH_USERS_SUCCESS
:
return
{...
state
,
loading
:
false
,
users
:
action
.
users
};
default
:
default
:
return
state
;
return
state
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment