Commit f766ad1f authored by Ermolaev Timur's avatar Ermolaev Timur

Merge branch 'task-114-fix/fix_modal' into 'development'

#114 Немного подправил расчеты

See merge request !92
parents a495d104 50dc0d6a
import Box from '@mui/material/Box';
import Modal from '@mui/material/Modal';
import { useEffect, useState } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';
export default function ModalTask({modal, handleClose, children}) {
export default function ModalTask({ modal, handleClose, children, week }) {
const [windowDimenion, detectHW] = useState({
winWidth: window.innerWidth,
......@@ -24,21 +24,30 @@ export default function ModalTask({modal, handleClose, children}) {
}
}, [windowDimenion])
const getYCordinatesToModal = () => {
if (windowDimenion.winHeight > modal.yClickСordinates + 450) {
return modal.yClickСordinates - modal.yDiv - modal.yDivClick
const getYCordinatesToModal = useCallback(() => {
if (week) {
if (windowDimenion.winHeight > modal.yClickСordinates + 450) {
return modal.yClickСordinates - modal.yDivClick
} else {
return modal.yClickСordinates - 450
}
} else {
return modal.yClickСordinates - modal.yDiv - modal.yDivClick - ((modal.yClickСordinates + 450) - windowDimenion.winHeight) - 30
if (windowDimenion.winHeight > modal.yClickСordinates + 450) {
return modal.yClickСordinates - modal.yDiv - modal.yDivClick
} else {
return modal.yClickСordinates - modal.yDiv - modal.yDivClick - ((modal.yClickСordinates + 450) - windowDimenion.winHeight) - 30
}
}
}
const getXCordinatesToModal = () => {
}, [windowDimenion.winHeight, modal])
const getXCordinatesToModal = useCallback(() => {
if (windowDimenion.winWidth > modal.xClickСordinates + 270 + modal.xDiv) {
return modal.xClickСordinates + modal.xDiv - modal.xDivClick + 10
} else {
return windowDimenion.winWidth - (windowDimenion.winWidth - modal.xClickСordinates) - modal.xDivClick - 270 - 80
}
}
}, [windowDimenion.winWidth, modal])
const style = {
display: 'flex',
flexDirection: 'column',
......
......@@ -3,7 +3,7 @@ import { useCallback, useState } from "react";
import CalendarRow from "../../CalendarRow/CalendarRow";
import CalendarSmallCell from "../../CalendarSmallCell/CalendarSmallCell";
import CalendarStandartCell from "../../CalendarStandartCell/CalendarStandartCell";
import ModalTask from "../../../UI/ModalTask/ModalTask"
import ModalTask from "../../ModalTask/ModalTask"
import MonthCalendarModalContent from "../../CalendarModalTaskContent/CalendarModalTaskContent";
import CalendarRowDay from "./CalendarRowDay/CalendarRowDay";
......
......@@ -30,7 +30,7 @@ function CalendarWeekTask({ height, width, left, top, task, zIndex, handleOpen,
});
setZIndexStyle(100)
handleOpen(e)
}, [handleOpen, setCurrentTask])
}, [handleOpen, setCurrentTask, month])
const styles = {
boxSizing: 'border-box',
......
import { Grid } from "@mui/material";
import { Box } from "@mui/system";
import { useCallback, useState } from "react";
import ModalTask from "../../../UI/ModalTask/ModalTask";
import ModalTask from "../../ModalTask/ModalTask";
import MonthCalendarModalContent from "../../CalendarModalTaskContent/CalendarModalTaskContent";
import CalendarRow from "../../CalendarRow/CalendarRow";
import CalendarSmallCell from "../../CalendarSmallCell/CalendarSmallCell";
......@@ -95,6 +95,7 @@ function WeekCalendarBody({ week, hoursInDay, hourFormat, setHourFormat, date, t
<ModalTask
modal={modal}
handleClose={() => { handleClose() }}
week={true}
>
<MonthCalendarModalContent
title={currentTask.title}
......
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