Commit 8634e9d8 authored by Ermolaev Timur's avatar Ermolaev Timur

#141 Изменил вывод информации о проекте

parent 492adeee
import { Box, Typography } from "@mui/material";
import moment from "moment";
import { memo } from "react";
import PersonAddIcon from '@mui/icons-material/PersonAdd';
const style = {
display: 'flex',
flexDirection: 'column',
}
const styleText = {
fontSize: '20px',
fontWeight: '600',
display: 'flex',
alignItems: 'center',
gap: '10px'
}
const ProjectInfo = ({ project }) => {
return (
<Box sx={style} justifyContent={'space-between'}>
<Typography variant="h2">Проект - {project?.title} </Typography>
<Typography variant="body1" sx={styleText}>
Дата создания проекта: {moment(project?.createdAt).format('MM.DD.YYYY')}
</Typography>
<Typography variant="body1" sx={styleText}>
Цвет: {project?.color}
</Typography>
<Typography variant="body1" sx={styleText}>
Автор проекта: {project?.members[0]?.user.displayName}
</Typography>
<Typography variant="body1" sx={styleText}>
Роль в проекте: {project?.members[0]?.roleProject}
</Typography>
<Typography variant="body1" sx={styleText}>
Задачи:
</Typography>
<Typography variant="body1" sx={styleText}>
Добавить участника: <PersonAddIcon style={{ cursor: 'pointer' }} />
</Typography>
</Box>
);
};
export default memo(ProjectInfo);
\ No newline at end of file
...@@ -4,11 +4,11 @@ import { memo } from "react"; ...@@ -4,11 +4,11 @@ import { memo } from "react";
const ColumnTitle = ({ text }) => { const ColumnTitle = ({ text }) => {
return <> return <>
<Typography variant="h4" textAlign={'center'} sx={{ marginBottom: '20px' }}> <Typography variant="h4" textAlign={'center'} sx={{ marginBottom: '20px' }}>
{text} {text}
</Typography> </Typography>
</> </>
}; };
export default memo(ColumnTitle); export default memo(ColumnTitle);
...@@ -16,7 +16,7 @@ const styleColumn = { ...@@ -16,7 +16,7 @@ const styleColumn = {
const ProjectUsersColumn = ({ role, members }) => { const ProjectUsersColumn = ({ role, members }) => {
return ( return (
<Box sx={styleColumn}> <Box sx={styleColumn}>
<ColumnTitle text={role.text}/> <ColumnTitle text={role.text} />
<UsersList <UsersList
role={role} role={role}
......
...@@ -3,12 +3,12 @@ import DeleteIcon from "@mui/icons-material/Delete"; ...@@ -3,12 +3,12 @@ import DeleteIcon from "@mui/icons-material/Delete";
import { memo } from "react"; import { memo } from "react";
const style = { const style = {
width: '90%', width: '90%',
border: '1px solid black', border: '1px solid black',
borderRadius: '5px', borderRadius: '5px',
padding: '15px 15px', padding: '15px 15px',
display: 'flex', display: 'flex',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center' alignItems: 'center'
} }
......
import { Box} from "@mui/material"; import { Box } from "@mui/material";
import { memo } from "react"; import { memo } from "react";
import UserItem from "./UserItem/UserItem"; import UserItem from "./UserItem/UserItem";
...@@ -11,19 +11,19 @@ const styleList = { ...@@ -11,19 +11,19 @@ const styleList = {
const UsersList = ({ role, members }) => { const UsersList = ({ role, members }) => {
return ( return (
<Box sx={styleList}> <Box sx={styleList}>
{members.map((member) => { {members.map((member) => {
if (member.roleProject === role.value) { if (member.roleProject === role.value) {
return ( return (
<UserItem <UserItem
key={member.id} key={member.id}
user={member?.user} user={member?.user}
/> />
) )
} else { } else {
return null return null
} }
})} })}
</Box> </Box>
); );
}; };
......
import {Box} from "@mui/material"; import { Box } from "@mui/material";
import { memo } from "react"; import { memo } from "react";
import ProjectUsersColumn from "./ProjectUsersColumn/ProjectUsersColumn"; import ProjectUsersColumn from "./ProjectUsersColumn/ProjectUsersColumn";
const projectRoles = [{value: 'admin', text: 'Админы'}, {value: 'user', text: 'Юзеры'}, {value: 'watcher', text: 'Наблюдатели'}] const projectRoles = [{ value: 'admin', text: 'Админы' }, { value: 'user', text: 'Юзеры' }, { value: 'watcher', text: 'Наблюдатели' }]
const style = { const style = {
display: 'flex', display: 'flex',
gap: '150px', gap: '150px',
width: '100%', width: '100%',
marginTop: '20px', marginTop: '20px',
justifyContent: 'space-evenly' justifyContent: 'space-evenly'
} }
const ProjectUsersColumnsWrapper = ({members}) => { const ProjectUsersColumnsWrapper = ({ members }) => {
return ( return (
<Box sx={style} justifyContent={'space-between'}> <Box sx={style} justifyContent={'space-between'}>
{projectRoles.map((role, i)=>{ {projectRoles.map((role, i) => {
return( return (
<ProjectUsersColumn <ProjectUsersColumn
key={i} key={i}
role={role} role={role}
members={members} members={members}
/> />
) )
})} })}
</Box> </Box>
); );
}; };
export default memo(ProjectUsersColumnsWrapper); export default memo(ProjectUsersColumnsWrapper);
\ No newline at end of file
...@@ -6,6 +6,7 @@ import { fetchProject } from "../../store/actions/projectsActions"; ...@@ -6,6 +6,7 @@ import { fetchProject } from "../../store/actions/projectsActions";
import { fetchUsers, fetchUsersAllFields } from "../../store/actions/usersActions"; import { fetchUsers, fetchUsersAllFields } from "../../store/actions/usersActions";
import NewMember from "../NewMember/NewMember"; import NewMember from "../NewMember/NewMember";
import ProjectUsersColumnsWrapper from "../../components/ProjectComponents/ProjectUsersColumnsWrapper/ProjectUsersColumnsWrapper"; import ProjectUsersColumnsWrapper from "../../components/ProjectComponents/ProjectUsersColumnsWrapper/ProjectUsersColumnsWrapper";
import ProjectInfo from "../../components/ProjectComponents/ProjectInfo/ProjectInfo";
const FullProject = () => { const FullProject = () => {
...@@ -27,43 +28,13 @@ const FullProject = () => { ...@@ -27,43 +28,13 @@ const FullProject = () => {
}, [project]) }, [project])
return <> return <>
<Grid item xs={12} sm={12} md={6} lg={4}> <Grid>
<Box> <ProjectInfo
<h2>Проект - {project?.project?.title} </h2> project={project.project}
/>
<strong> <ProjectUsersColumnsWrapper
<br></br> members={members}
Дата создания проекта: {project?.project?.createdAt} />
</strong>
<strong>
<br></br>
Цвет: {project?.project?.color}
</strong>
<strong>
<br></br>
Автор проекта: {project?.project?.members[0]?.user.displayName}
</strong>
<strong>
<br></br>
Роль в проекте: {project?.project?.members[0]?.roleProject}
</strong>
<strong>
<br></br>
Задачи:
<br></br>
</strong>
<strong>
<br></br>
<div style={{ display: 'flex', direction: 'column' }}>
Участники проекта: <NewMember members={project?.project?.members} />
</div>
<ProjectUsersColumnsWrapper
members={members}
/>
</strong>
</Box>
</Grid> </Grid>
</> </>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment