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
c83389aa
Commit
c83389aa
authored
Jan 10, 2023
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#142
Вывел список проектов без логики
parent
3e820415
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
82 additions
and
56 deletions
+82
-56
ProjectItem.js
...s/ProjectsWrapper/ProjectsList/ProjectItem/ProjectItem.js
+35
-38
ProjectsList.js
...tsComponents/ProjectsWrapper/ProjectsList/ProjectsList.js
+4
-4
ProjectsWrapper.js
...nts/ProjectsComponents/ProjectsWrapper/ProjectsWrapper.js
+13
-6
ArrowDecrementButton.js
...omponents/UI/ArrowDecrementButton/ArrowDecrementButton.js
+0
-1
ArrowIncrementButton.js
...omponents/UI/ArrowIncrementButton/ArrowIncrementButton.js
+0
-1
DeleteButton.js
planner-front/src/components/UI/DeleteButton/DeleteButton.js
+25
-0
FullProject.js
planner-front/src/containers/FullProject/FullProject.js
+1
-1
Projects.js
planner-front/src/containers/Projects/Projects.js
+4
-5
No files found.
planner-front/src/components/ProjectsComponents/ProjectsWrapper/ProjectsList/ProjectItem/ProjectItem.js
View file @
c83389aa
import
{
Button
,
Card
,
CardActions
,
CardContent
,
Grid
,
IconButton
}
from
"@mui/material"
;
import
{
Button
,
Card
,
CardActions
,
CardContent
,
Grid
,
IconButton
,
Typography
}
from
"@mui/material"
;
import
{
Link
}
from
"react-router-dom"
;
import
ArrowForwardIcon
from
"@mui/icons-material/ArrowForward"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
{
deleteProject
,
fetchProject
}
from
"../../../../../store/actions/projectsActions"
;
import
{
useEffect
}
from
"react"
;
const
ProjectItem
=
({
title
,
tasks
,
projectId
,
onClickProjectHandler
})
=>
{
const
user
=
useSelector
(
state
=>
state
.
users
.
user
);
const
dispatch
=
useDispatch
();
console
.
log
(
user
)
const
deleteHandle
=
(
projectId
)
=>
{
console
.
log
(
"project id"
,
projectId
)
dispatch
(
deleteProject
(
projectId
))
};
const
fullInfo
=
(
projectId
)
=>
{
console
.
log
(
"full project info"
,
projectId
)
dispatch
(
fetchProject
(
projectId
))
};
import
{
memo
,
useEffect
,
useMemo
}
from
"react"
;
import
{
Box
}
from
"@mui/system"
;
import
DeleteButton
from
"../../../../UI/DeleteButton/DeleteButton"
;
import
ArrowIncrementButton
from
"../../../../UI/ArrowIncrementButton/ArrowIncrementButton"
;
const
styleBlock
=
{
border
:
'2px solid black'
,
borderRadius
:
'5px'
,
width
:
'100%'
,
padding
:
'15px'
,
}
const
styleText
=
{
fontSize
:
'15px'
,
fontWeight
:
'600'
,
}
const
ProjectItem
=
({
title
,
members
,
onClickProjectHandler
})
=>
{
const
{
user
}
=
useSelector
(
state
=>
state
.
users
);
const
currentRoleInProject
=
useMemo
(()
=>
{
return
members
.
find
((
member
)
=>
member
.
user
.
id
===
user
.
id
)?.
roleProject
},
[
members
,
user
.
id
])
return
<>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
6
}
lg
=
{
4
}
onClick
=
{
onClickProjectHandler
}
>
<
Card
>
<
CardContent
onClick
=
{()
=>
{
fullInfo
(
projectId
)}}
>
<
strong
>
<
br
><
/br
>
Название
проекта
:
{
title
}
<
/strong
>
<
strong
>
<
br
><
/br
>
{
/* Задачи: {tasks} */
}
<
/strong
>
<
/CardContent
>
<
CardActions
>
{(
title
!==
"Личные дела"
)
?
<
Button
onClick
=
{()
=>
{
deleteHandle
(
projectId
);
}}
variant
=
"outlined"
startIcon
=
{
<
DeleteIcon
/>
}
>
Delete
<
/Button> : null
}
<
/CardActions
>
<
/Card
>
<
Grid
item
container
xs
=
{
12
}
onClick
=
{
onClickProjectHandler
}
sx
=
{
styleBlock
}
justifyContent
=
{
'space-between'
}
alignItems
=
{
'center'
}
>
<
Grid
item
>
<
Typography
sx
=
{
styleText
}
>
Проект
:
{
title
}
<
/Typography
>
<
Typography
sx
=
{
styleText
}
>
Роль
в
проекте
:
{
currentRoleInProject
}
<
/Typography
>
<
/Grid
>
<
Grid
item
>
<
DeleteButton
/>
<
ArrowIncrementButton
/>
<
/Grid
>
<
/Grid
>
<
/
>
};
export
default
ProjectItem
;
export
default
memo
(
ProjectItem
)
;
planner-front/src/components/ProjectsComponents/ProjectsWrapper/ProjectsList/ProjectsList.js
View file @
c83389aa
import
{
Grid
}
from
"@mui/material"
;
import
{
memo
}
from
"react"
;
import
ProjectItem
from
"./ProjectItem/ProjectItem"
;
const
ProjectsList
=
({
projects
,
onClickProjectHandler
})
=>
{
return
(
<
Grid
item
container
direction
=
"column"
spacing
=
{
1
}
>
<
Grid
item
container
gap
=
{
3
}
>
{
projects
?.
map
(
project
=>
{
return
<
ProjectItem
title
=
{
project
.
title
}
createdAt
=
{
project
.
createdAt
}
projectId
=
{
project
.
id
}
members
=
{
project
.
members
}
key
=
{
project
.
id
}
onClickProjectHandler
=
{()
=>
{
onClickProjectHandler
(
project
)}}
/
>
...
...
@@ -17,4 +17,4 @@ const ProjectsList = ({projects, onClickProjectHandler}) => {
);
};
export
default
ProjectsList
;
\ No newline at end of file
export
default
memo
(
ProjectsList
);
\ No newline at end of file
planner-front/src/components/ProjectsComponents/ProjectsWrapper/ProjectsWrapper.js
View file @
c83389aa
import
{
Grid
,
Typography
,
Button
,
Card
,
CardContent
}
from
"@mui/material"
;
import
{
memo
}
from
"react"
;
import
ProjectsList
from
"./ProjectsList/ProjectsList"
;
const
ProjectsWrapper
=
({
onClickProjectHandler
,
projects
})
=>
{
const
style
=
{
display
:
'flex'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
,
marginBottom
:
'10px'
}
const
ProjectsWrapper
=
({
onClickProjectHandler
,
projects
})
=>
{
return
<>
<
Grid
item
xs
=
{
4
}
>
<
Typography
variant
=
"h
4"
>
<
Typography
variant
=
"h
2"
sx
=
{
style
}
>
Проекты
<
Button
variant
=
"outlined"
>
Создать
<
/Button
>
<
/Typography
>
<
Typography
>
<
ProjectsList
projects
=
{
projects
}
onClickProjectHandler
=
{
onClickProjectHandler
}
/
>
<
/Typography
>
<
/Grid
>
<
/
>
};
export
default
ProjectsWrapper
;
\ No newline at end of file
export
default
memo
(
ProjectsWrapper
);
\ No newline at end of file
planner-front/src/components/UI/ArrowDecrementButton/ArrowDecrementButton.js
View file @
c83389aa
...
...
@@ -6,7 +6,6 @@ const arrowClass = {
transition
:
'0.5s'
,
"&:hover"
:
{
background
:
'rgb(48, 154, 252, 0.65)'
,
transition
:
'0.5s'
,
transform
:
'scale(1.2)'
}
...
...
planner-front/src/components/UI/ArrowIncrementButton/ArrowIncrementButton.js
View file @
c83389aa
...
...
@@ -6,7 +6,6 @@ const arrowClass = {
transition
:
'0.5s'
,
"&:hover"
:
{
background
:
'rgb(48, 154, 252, 0.65)'
,
transition
:
'0.5s'
,
transform
:
'scale(1.2)'
}
...
...
planner-front/src/components/UI/DeleteButton/DeleteButton.js
0 → 100644
View file @
c83389aa
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
{
memo
}
from
'react'
;
const
arrowClass
=
{
cursor
:
'pointer'
,
transition
:
'0.5s'
,
"&:hover"
:
{
transition
:
'0.5s'
,
transform
:
'scale(1.2)'
}
}
function
DeleteButton
({
onClick
})
{
return
(
<>
<
DeleteIcon
sx
=
{
arrowClass
}
onClick
=
{
onClick
}
/>
<
/>
)
;
}
export
default
memo
(
DeleteButton
);
\ No newline at end of file
planner-front/src/containers/FullProject/FullProject.js
View file @
c83389aa
...
...
@@ -30,7 +30,7 @@ const FullProject = ({projectId}) => {
dispatch
(
fetchProject
(
params
.
id
))
}
dispatch
(
fetchUsers
())
},
[
params
.
id
,
dispatch
]);
},
[
params
.
id
,
dispatch
,
projectId
]);
const
members
=
useMemo
(()
=>
{
return
project
?.
project
?.
members
||
[]
...
...
planner-front/src/containers/Projects/Projects.js
View file @
c83389aa
...
...
@@ -10,9 +10,8 @@ import ProjectsWrapper from "../../components/ProjectsComponents/ProjectsWrapper
const
Projects
=
()
=>
{
const
dispatch
=
useDispatch
();
const
{
projects
,
project
,
loading
}
=
useSelector
(
state
=>
state
.
projects
.
projects
);
const
members
=
useSelector
(
state
=>
state
.
projects
.
projects
)
const
[
currentProject
,
setCurrentProject
]
=
useState
(
null
)
console
.
log
(
projects
)
useEffect
(()
=>
{
dispatch
(
fetchProjects
())
},
[
dispatch
]);
...
...
@@ -30,9 +29,9 @@ const Projects = () => {
direction
=
"row"
justifyContent
=
"space-between"
>
<
Grid
item
xs
=
{
4
}
>
<
ProjectsWrapper
projects
=
{
projects
}
onClickProjectHandler
=
{
onClickProjectHandler
}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
7
}
>
{
currentProject
?
<
FullProject
projectId
=
{
currentProject
?.
id
}
/> : null
}
<
/Grid
>
...
...
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