Commit 6e67312d authored by Ermolaev Timur's avatar Ermolaev Timur

#148 Исправил отображение ролей в проекте

parent d2e030a8
......@@ -36,7 +36,7 @@ const ProjectInfo = ({ project, handleOpen, currentRoleInProject,onClickTasksHan
<Typography variant="body1" sx={styleText}>
Задачи: <ArrowIncrementButton onClick={()=>{onClickTasksHandler()}}/>
</Typography>
{currentRoleInProject === 'admin' ?
{currentRoleInProject === 'Админ' ?
<Typography variant="body1" sx={styleText}>
Добавить участника: <PersonAddIcon style={{ cursor: 'pointer' }} onClick={() => { handleOpen() }} />
</Typography>
......
import { Grid } from "@mui/material";
import DeleteIcon from "@mui/icons-material/Delete";
import { deleteMember } from "../../../store/actions/projectsActions";
import { memo } from "react";
const ProjectMembersItem = ({ user }) => {
const style = {
width: '90%',
border: '1px solid black',
borderRadius: '5px',
padding: '15px 15px',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center'
}
return <>
<Grid sx={style}>
{user?.displayName}
<DeleteIcon
/>
</Grid>
</>
};
export default memo(ProjectMembersItem);
......@@ -48,7 +48,7 @@ const ProjectMembersItem = ({ user, deleteMemberHandler, currentRoleInProject, d
>
{user?.displayName}
{currentRoleInProject === 'admin' && user.id !== userId ?
{currentRoleInProject === 'Админ' && user.id !== userId ?
<DeleteIcon
sx={{ cursor: 'pointer' }}
onClick={deleteMemberHandler}
......
......@@ -23,7 +23,16 @@ const ProjectItem = ({ title, members, onClickProjectHandler, onClickGoToSpecifi
const { user } = useSelector(state => state.users);
const currentRoleInProject = useMemo(() => {
return members.find((member) => member.user.id === user.id)?.roleProject
switch (members.find((member) => member.user.id === user.id)?.roleProject) {
case 'admin':
return 'Админ'
case 'user':
return 'Юзер'
case 'watcher':
return 'Наблюдатель'
default:
return ''
}
}, [members, user.id])
return <>
......
import { Grid } from "@mui/material";
import { useNavigate, useParams } from "react-router-dom";
import { useSelector, useDispatch } from "react-redux";
import { useCallback, useEffect, useMemo, useState } from "react";
......@@ -39,7 +38,16 @@ const FullProject = ({ projectId }) => {
}, [project])
const currentRoleInProject = useMemo(() => {
return members.find((member) => member.user.id === user.id)?.roleProject
switch (members.find((member) => member.user.id === user.id)?.roleProject) {
case 'admin':
return 'Админ'
case 'user':
return 'Юзер'
case 'watcher':
return 'Наблюдатель'
default:
return ''
}
}, [members, user.id])
const onChangeRoleHandler = useCallback((e, value) => {
......
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