Commit 2f3dde89 authored by Ermolaev Timur's avatar Ermolaev Timur

#29 Подготовка к мержу

parent 9388b278
import { Grid, TextField } from "@mui/material";
import { useEffect, useState } from "react";
import React, { useEffect, useState } from "react";
const CalendarTask = ({year, month, tasks, day, hours, setCurrentTask, onChange, hourFormat}) => {
......@@ -23,7 +23,7 @@ const CalendarTask = ({year, month, tasks, day, hours, setCurrentTask, onChange,
if (day.dayNumber === task.infoForCell.startDay) {
if (((task.infoForCell.endHour <= hour || task.infoForCell.startHour <= hour) && (task.infoForCell.endHour > hour))
|| (task.infoForCell.startHour >= hour && task.infoForCell.endHour < hourDiffEnd)
|| (task.infoForCell.endMinute === 59 && task.infoForCell.endHour === hour)) {
|| (task.infoForCell.endMinute <= 59 && task.infoForCell.endHour === hour)) {
return task
}
}
......@@ -32,27 +32,9 @@ const CalendarTask = ({year, month, tasks, day, hours, setCurrentTask, onChange,
})
return tasksCell
}
const tasksCell = getTaskInDayCell(tasks, day, hours)
const renderTasks = (tasksCell) => {
tasksCell.map((task, i)=>{
return (
<Grid key={task.id} sx={{backgroundColor: 'lightgreen'}}>
<TextField
id={task.title}
variant="standard"
value={task.title}
name='title'
onClick={(e)=>{e.stopPropagation(); setCurrentTask(task)}}
onChange={onChange}>
</TextField>
</Grid>
)
})}
console.log(tasksCell[0])
return (<>
{tasksCell.length ? tasksCell.map((task, i)=>
{
......
......@@ -7,7 +7,7 @@ import CalendarTask from "./CalendarTask/CalendarTask";
function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, onChangeCellTaskTitle, setCurrentTask, hourFormat, setHourFormat}) {
const [hoursInDay, setHoursInDay] = useState(['8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00', '6:00'])
const [hoursInDay, setHoursInDay] = useState(['8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00'])
const [daysInMonth, setDaysInMonth] = useState([])
const [cellSizes, setCellSizes] = useState({})
useEffect(()=>{
......@@ -20,7 +20,7 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, onChang
useEffect(()=>{
if (hourFormat) {
const arr = ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00','20:00','21:00','22:00', '00:00', '7:00']
const arr = ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00','21:00','22:00']
const cells = arr.length
const xs = 10.8/cells
setCellSizes(()=>{
......@@ -28,7 +28,7 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, onChang
})
setHoursInDay(()=>arr)
} else {
const arr = ['8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00', '00:00', '7:00']
const arr = ['8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00']
const cells = arr.length
const xs = 10.8/cells
setCellSizes(()=>{
......
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