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
{
Link
}
from
"react-router-dom"
;
import
ArrowForwardIcon
from
"@mui/icons-material/ArrowForward"
;
import
ArrowForwardIcon
from
"@mui/icons-material/ArrowForward"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
{
deleteProject
,
fetchProject
}
from
"../../../../../store/actions/projectsActions"
;
import
{
deleteProject
,
fetchProject
}
from
"../../../../../store/actions/projectsActions"
;
import
{
useEffect
}
from
"react"
;
import
{
memo
,
useEffect
,
useMemo
}
from
"react"
;
import
{
Box
}
from
"@mui/system"
;
const
ProjectItem
=
({
title
,
tasks
,
projectId
,
onClickProjectHandler
})
=>
{
import
DeleteButton
from
"../../../../UI/DeleteButton/DeleteButton"
;
const
user
=
useSelector
(
state
=>
state
.
users
.
user
);
import
ArrowIncrementButton
from
"../../../../UI/ArrowIncrementButton/ArrowIncrementButton"
;
const
dispatch
=
useDispatch
();
const
styleBlock
=
{
console
.
log
(
user
)
border
:
'2px solid black'
,
borderRadius
:
'5px'
,
const
deleteHandle
=
(
projectId
)
=>
{
width
:
'100%'
,
console
.
log
(
"project id"
,
projectId
)
padding
:
'15px'
,
dispatch
(
deleteProject
(
projectId
))
}
};
const
fullInfo
=
(
projectId
)
=>
{
const
styleText
=
{
console
.
log
(
"full project info"
,
projectId
)
fontSize
:
'15px'
,
dispatch
(
fetchProject
(
projectId
))
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
<>
return
<>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
6
}
lg
=
{
4
}
onClick
=
{
onClickProjectHandler
}
>
<
Grid
item
container
xs
=
{
12
}
onClick
=
{
onClickProjectHandler
}
sx
=
{
styleBlock
}
justifyContent
=
{
'space-between'
}
alignItems
=
{
'center'
}
>
<
Card
>
<
Grid
item
>
<
CardContent
onClick
=
{()
=>
{
fullInfo
(
projectId
)}}
>
<
Typography
sx
=
{
styleText
}
>
<
strong
>
Проект
:
{
title
}
<
br
><
/br
>
<
/Typography
>
Название
проекта
:
{
title
}
<
Typography
sx
=
{
styleText
}
>
<
/strong
>
Роль
в
проекте
:
{
currentRoleInProject
}
<
strong
>
<
/Typography
>
<
br
><
/br
>
<
/Grid
>
{
/* Задачи: {tasks} */
}
<
Grid
item
>
<
/strong
>
<
DeleteButton
/>
<
/CardContent
>
<
ArrowIncrementButton
/>
<
CardActions
>
<
/Grid
>
{(
title
!==
"Личные дела"
)
?
<
Button
onClick
=
{()
=>
{
deleteHandle
(
projectId
);
}}
variant
=
"outlined"
startIcon
=
{
<
DeleteIcon
/>
}
>
Delete
<
/Button> : null
}
<
/CardActions
>
<
/Card
>
<
/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
{
Grid
}
from
"@mui/material"
;
import
{
memo
}
from
"react"
;
import
ProjectItem
from
"./ProjectItem/ProjectItem"
;
import
ProjectItem
from
"./ProjectItem/ProjectItem"
;
const
ProjectsList
=
({
projects
,
onClickProjectHandler
})
=>
{
const
ProjectsList
=
({
projects
,
onClickProjectHandler
})
=>
{
return
(
return
(
<
Grid
item
container
direction
=
"column"
spacing
=
{
1
}
>
<
Grid
item
container
gap
=
{
3
}
>
{
projects
?.
map
(
project
=>
{
{
projects
?.
map
(
project
=>
{
return
<
ProjectItem
return
<
ProjectItem
title
=
{
project
.
title
}
title
=
{
project
.
title
}
createdAt
=
{
project
.
createdAt
}
members
=
{
project
.
members
}
projectId
=
{
project
.
id
}
key
=
{
project
.
id
}
key
=
{
project
.
id
}
onClickProjectHandler
=
{()
=>
{
onClickProjectHandler
(
project
)}}
onClickProjectHandler
=
{()
=>
{
onClickProjectHandler
(
project
)}}
/
>
/
>
...
@@ -17,4 +17,4 @@ const ProjectsList = ({projects, onClickProjectHandler}) => {
...
@@ -17,4 +17,4 @@ const ProjectsList = ({projects, onClickProjectHandler}) => {
);
);
};
};
export
default
ProjectsList
;
export
default
memo
(
ProjectsList
);
\ No newline at end of file
\ 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
{
Grid
,
Typography
,
Button
,
Card
,
CardContent
}
from
"@mui/material"
;
import
{
memo
}
from
"react"
;
import
ProjectsList
from
"./ProjectsList/ProjectsList"
;
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
<>
return
<>
<
Grid
item
xs
=
{
4
}
>
<
Grid
item
xs
=
{
4
}
>
<
Typography
variant
=
"h
4"
>
<
Typography
variant
=
"h
2"
sx
=
{
style
}
>
Проекты
Проекты
<
Button
variant
=
"outlined"
>
Создать
<
/Button
>
<
/Typography
>
<
/Typography
>
<
Typography
>
<
ProjectsList
projects
=
{
projects
}
onClickProjectHandler
=
{
onClickProjectHandler
}
/
>
<
ProjectsList
projects
=
{
projects
}
onClickProjectHandler
=
{
onClickProjectHandler
}
/
>
<
/Typography
>
<
/Grid
>
<
/Grid
>
<
/
>
<
/
>
};
};
export
default
ProjectsWrapper
;
export
default
memo
(
ProjectsWrapper
);
\ No newline at end of file
\ No newline at end of file
planner-front/src/components/UI/ArrowDecrementButton/ArrowDecrementButton.js
View file @
c83389aa
...
@@ -6,7 +6,6 @@ const arrowClass = {
...
@@ -6,7 +6,6 @@ const arrowClass = {
transition
:
'0.5s'
,
transition
:
'0.5s'
,
"&:hover"
:
{
"&:hover"
:
{
background
:
'rgb(48, 154, 252, 0.65)'
,
transition
:
'0.5s'
,
transition
:
'0.5s'
,
transform
:
'scale(1.2)'
transform
:
'scale(1.2)'
}
}
...
...
planner-front/src/components/UI/ArrowIncrementButton/ArrowIncrementButton.js
View file @
c83389aa
...
@@ -6,7 +6,6 @@ const arrowClass = {
...
@@ -6,7 +6,6 @@ const arrowClass = {
transition
:
'0.5s'
,
transition
:
'0.5s'
,
"&:hover"
:
{
"&:hover"
:
{
background
:
'rgb(48, 154, 252, 0.65)'
,
transition
:
'0.5s'
,
transition
:
'0.5s'
,
transform
:
'scale(1.2)'
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}) => {
...
@@ -30,7 +30,7 @@ const FullProject = ({projectId}) => {
dispatch
(
fetchProject
(
params
.
id
))
dispatch
(
fetchProject
(
params
.
id
))
}
}
dispatch
(
fetchUsers
())
dispatch
(
fetchUsers
())
},
[
params
.
id
,
dispatch
]);
},
[
params
.
id
,
dispatch
,
projectId
]);
const
members
=
useMemo
(()
=>
{
const
members
=
useMemo
(()
=>
{
return
project
?.
project
?.
members
||
[]
return
project
?.
project
?.
members
||
[]
...
...
planner-front/src/containers/Projects/Projects.js
View file @
c83389aa
...
@@ -10,9 +10,8 @@ import ProjectsWrapper from "../../components/ProjectsComponents/ProjectsWrapper
...
@@ -10,9 +10,8 @@ import ProjectsWrapper from "../../components/ProjectsComponents/ProjectsWrapper
const
Projects
=
()
=>
{
const
Projects
=
()
=>
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
{
projects
,
project
,
loading
}
=
useSelector
(
state
=>
state
.
projects
.
projects
);
const
{
projects
,
project
,
loading
}
=
useSelector
(
state
=>
state
.
projects
.
projects
);
const
members
=
useSelector
(
state
=>
state
.
projects
.
projects
)
const
[
currentProject
,
setCurrentProject
]
=
useState
(
null
)
const
[
currentProject
,
setCurrentProject
]
=
useState
(
null
)
console
.
log
(
projects
)
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchProjects
())
dispatch
(
fetchProjects
())
},
[
dispatch
]);
},
[
dispatch
]);
...
@@ -30,9 +29,9 @@ const Projects = () => {
...
@@ -30,9 +29,9 @@ const Projects = () => {
direction
=
"row"
direction
=
"row"
justifyContent
=
"space-between"
justifyContent
=
"space-between"
>
>
<
Grid
item
xs
=
{
4
}
>
<
ProjectsWrapper
projects
=
{
projects
}
onClickProjectHandler
=
{
onClickProjectHandler
}
/
>
<
ProjectsWrapper
projects
=
{
projects
}
onClickProjectHandler
=
{
onClickProjectHandler
}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
7
}
>
<
Grid
item
xs
=
{
7
}
>
{
currentProject
?
<
FullProject
projectId
=
{
currentProject
?.
id
}
/> : null
}
{
currentProject
?
<
FullProject
projectId
=
{
currentProject
?.
id
}
/> : null
}
<
/Grid
>
<
/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