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
6df87730
Commit
6df87730
authored
Dec 15, 2022
by
Ibadullina Inabat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавлены проверки на добавление и удаление участника
parent
7ee93529
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
ProjectMembersItem.js
...rojectComponents/ProjectMembersItem/ProjectMembersItem.js
+7
-3
ProjectMembersList.js
...rojectComponents/ProjectMembersList/ProjectMembersList.js
+1
-0
FullProject.js
planner-front/src/containers/FullProject/FullProject.js
+4
-4
No files found.
planner-front/src/components/ProjectComponents/ProjectMembersItem/ProjectMembersItem.js
View file @
6df87730
...
@@ -5,17 +5,21 @@ import { useDispatch, useSelector } from "react-redux";
...
@@ -5,17 +5,21 @@ import { useDispatch, useSelector } from "react-redux";
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
{
deleteMember
}
from
"../../../store/actions/projectsActions"
;
import
{
deleteMember
}
from
"../../../store/actions/projectsActions"
;
const
ProjectMembersItem
=
({
displayName
,
roleProject
,
id
,
roleProjectOfAuthor
,
userId
})
=>
{
const
ProjectMembersItem
=
({
displayName
,
roleProject
,
id
,
roleProjectOfAuthor
,
userId
,
members
})
=>
{
console
.
log
(
displayName
)
console
.
log
(
displayName
)
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
user
=
useSelector
(
state
=>
state
.
users
)
const
user
=
useSelector
(
state
=>
state
.
users
)
let
params
=
useParams
()
let
params
=
useParams
()
console
.
log
(
param
s
)
console
.
log
(
member
s
)
console
.
log
(
userId
)
console
.
log
(
userId
)
const
{
projects
,
project
}
=
useSelector
(
state
=>
state
.
projects
);
const
{
projects
,
project
}
=
useSelector
(
state
=>
state
.
projects
);
const
deleteHandle
=
(
userId
,
projectId
)
=>
{
const
deleteHandle
=
(
userId
,
projectId
)
=>
{
dispatch
(
deleteMember
(
userId
,
params
.
id
));
if
(
members
.
length
>
1
)
{
dispatch
(
deleteMember
(
userId
,
params
.
id
))
}
else
{
alert
(
"Нельзя удалить автора проекта"
)
}
};
};
return
<>
return
<>
...
...
planner-front/src/components/ProjectComponents/ProjectMembersList/ProjectMembersList.js
View file @
6df87730
...
@@ -13,6 +13,7 @@ const ProjectMembersList = ({members, roleProjectOfAuthor}) => {
...
@@ -13,6 +13,7 @@ const ProjectMembersList = ({members, roleProjectOfAuthor}) => {
key
=
{
member
.
id
}
key
=
{
member
.
id
}
roleProjectOfAuthor
=
{
roleProjectOfAuthor
}
roleProjectOfAuthor
=
{
roleProjectOfAuthor
}
userId
=
{
member
?.
user
?.
id
}
userId
=
{
member
?.
user
?.
id
}
members
=
{
members
}
/
>
/
>
})}
})}
<
/Grid
>
<
/Grid
>
...
...
planner-front/src/containers/FullProject/FullProject.js
View file @
6df87730
...
@@ -12,7 +12,7 @@ const FullProject = () => {
...
@@ -12,7 +12,7 @@ const FullProject = () => {
const
{
projects
,
project
}
=
useSelector
(
state
=>
state
.
projects
);
const
{
projects
,
project
}
=
useSelector
(
state
=>
state
.
projects
);
const
users
=
useSelector
(
state
=>
state
.
users
.
users
);
const
users
=
useSelector
(
state
=>
state
.
users
.
users
);
const
user
=
useSelector
(
state
=>
state
.
users
.
user
);
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
params
=
useParams
()
const
params
=
useParams
()
...
@@ -24,7 +24,7 @@ const FullProject = () => {
...
@@ -24,7 +24,7 @@ const FullProject = () => {
dispatch
(
fetchUsers
())
dispatch
(
fetchUsers
())
},
[
dispatch
]);
},
[
dispatch
]);
console
.
log
(
user
s
)
console
.
log
(
user
)
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchProject
(
params
.
id
))
dispatch
(
fetchProject
(
params
.
id
))
...
@@ -55,8 +55,8 @@ const FullProject = () => {
...
@@ -55,8 +55,8 @@ const FullProject = () => {
<
strong
>
<
strong
>
<
br
><
/br
>
<
br
><
/br
>
<
div
style
=
{{
display
:
'flex'
,
direction
:
'column'
}}
>
<
div
style
=
{{
display
:
'flex'
,
direction
:
'column'
}}
>
Участники
проекта
:
Участники
проекта
:
{(
project
?.
project
?.
members
[
0
]?.
user
.
displayName
===
user
.
displayName
)
?
<
NewMember
members
=
{
project
?.
project
?.
members
}
/> : null
}
<
NewMember
members
=
{
project
?.
project
?.
members
}
/
>
<
/div
>
<
/div
>
...
...
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