сделала вывод кнопки удаления задачи только в задачах, где пользователь -автор,…

сделала вывод кнопки удаления задачи только в задачах, где пользователь -автор, переписала стили модалки
parent 3d1e05fc
...@@ -10,7 +10,7 @@ const WorkerMenu = () => { ...@@ -10,7 +10,7 @@ const WorkerMenu = () => {
const [anchorEl, setAnchorEl] = useState(null); const [anchorEl, setAnchorEl] = useState(null);
const open = Boolean(anchorEl); const open = Boolean(anchorEl);
const user = useSelector(state => state.users.user) const user = useSelector(state => state.users.user)
console.log(user)
const handleClick = (event) => { const handleClick = (event) => {
setAnchorEl(event.currentTarget); setAnchorEl(event.currentTarget);
}; };
......
.modal{ .modal{
width: 200px;
height: 200px;
background-color: rgb(180, 243, 243);
display: flex; display: flex;
margin:10% 20%; flex-direction: column;
padding: 30px; padding: 10px;
word-break: break-all; align-items: center;
transition-duration:0.5s; position: absolute;
top: 200px;
left: 200px;
width: 300px;
height: 300px;
background-color: white;
border: 2px solid #000;
box-shadow: 24px;
border-radius:5px
} }
.modalBox{ .modalBox{
display: flex; display: flex;
......
...@@ -2,64 +2,95 @@ import { Modal, IconButton } from "@mui/material"; ...@@ -2,64 +2,95 @@ import { Modal, IconButton } from "@mui/material";
import "./TaskModal.css"; import "./TaskModal.css";
import { Done } from "@mui/icons-material"; import { Done } from "@mui/icons-material";
import Input from "@mui/material/Input"; import Input from "@mui/material/Input";
import TextField from "@mui/material/Input";
const TaskModal = ({handleClose,open,task,onChange,user }) => { const TaskModal = ({handleClose,open,task,onChange,user }) => {
return ( return (
<Modal <Modal
aria-labelledby="transition-modal-title" aria-labelledby="modal-modal-title"
aria-describedby="transition-modal-description" aria-describedby="modal-modal-description"
className={"modal"} BackdropProps={{ style: { backgroundColor: 'rgba(255,255,255, 0)' } }}
closeAfterTransition closeAfterTransition
onClose={handleClose} onClose={handleClose}
open={open} open={open}
> >
{task?.isEditMode && task.author.id===user.id ? ( {task?.isEditMode && task.author.id===user.id ? (
<div className="modalBox"> <div className="modal">
<Input <Input
label="название"
color="secondary"
value={task.title} value={task.title}
name="title" name="title"
onChange={(e) => onChange(e, task)} onChange={(e) => onChange(e, task)}
style={{ style={{
width: "auto", width: "auto",
fontSize: "12px",
color: "white",
fontWeight: "600", fontWeight: "600",
height: "40px",
fontWeight: "600",
width:"280px",
margin:"10px",
padding:"5px",
border: '2px solid #D3D3D3',
borderRadius:"5px"
}} }}
/> />
<Input <TextField
label="описание"
value={task.description} value={task.description}
name="description" name="description"
onChange={(e) => onChange(e, task)} onChange={(e) => onChange(e, task)}
style={{ width: "auto", fontSize: "12px", color: "white" }} multiline={true}
/> sx={{
<IconButton aria-label="done" onClick={handleClose}> fontWeight: "400",
width:"280px",
margin:"10px",
padding:"5px",
border: '2px solid #D3D3D3',
borderRadius:"5px",
height:"300px",
whiteSpace:"normal"
}}
/>
<IconButton aria-label="done" onClick={handleClose}
sx={{margingBottom:"5px",marginTop:"auto"}}>
<Done /> <Done />
</IconButton> </IconButton>
</div> </div>
) : ( ) : (
<div className="modalBox"> <div className="modal">
{task && task.title && ( {task && task.title && (
<div <div
style={{ style={{
width: "200px", height: "40px",
height: "200px", fontWeight: "600",
color: "white", width:"280px",
fontWeight: "600", margin:"10px",
padding:"5px",
border: '2px solid #D3D3D3',
borderRadius:"5px"
}} }}
> >
{task.title} {task.title}
</div> </div>
)} )}
{task && task.description && ( {task && task.description && (
<div style={{ width: "200px", height: "200px", color: "white" }}> <div
style={{margin:"10px",
border: '2px solid #D3D3D3',
borderRadius:"5px",
width:"280px",
height: "200px",
margin:"10px",
padding:"5px",
}}>
{task.description} {task.description}
</div> </div>
)} )}
<IconButton <IconButton
sx={{ marginLeft: 0, color: "white" }}
aria-label="close" aria-label="close"
onClick={handleClose} onClick={handleClose}
sx={{margingBottom:"5px",marginTop:"auto"}}
> >
X X
</IconButton> </IconButton>
......
...@@ -388,10 +388,7 @@ console.log(tasks) ...@@ -388,10 +388,7 @@ console.log(tasks)
.format("hh:mm A"), .format("hh:mm A"),
user:user user:user
}}> }}>
{/* <span>"время завершения"+ {moment(task.dateTimeDue) </CustomTableCell>
.utc()
.format("hh:mm A")}</span> */}
</CustomTableCell>
</> </>
)} )}
...@@ -475,7 +472,8 @@ console.log(tasks) ...@@ -475,7 +472,8 @@ console.log(tasks)
)} )}
</Tooltip> </Tooltip>
</TableCell> </TableCell>
<TableCell> {task.author.id===user.id ?
(<TableCell>
<Tooltip title="Удалить"> <Tooltip title="Удалить">
<IconButton <IconButton
onClick={(id) => { onClick={(id) => {
...@@ -485,7 +483,8 @@ console.log(tasks) ...@@ -485,7 +483,8 @@ console.log(tasks)
<DeleteIcon /> <DeleteIcon />
</IconButton> </IconButton>
</Tooltip> </Tooltip>
</TableCell> </TableCell>):null}
</TableRow> </TableRow>
); );
})} })}
......
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