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

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

parent 9388b278
import { Grid, TextField } from "@mui/material"; 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}) => { const CalendarTask = ({year, month, tasks, day, hours, setCurrentTask, onChange, hourFormat}) => {
...@@ -23,7 +23,7 @@ const CalendarTask = ({year, month, tasks, day, hours, setCurrentTask, onChange, ...@@ -23,7 +23,7 @@ const CalendarTask = ({year, month, tasks, day, hours, setCurrentTask, onChange,
if (day.dayNumber === task.infoForCell.startDay) { if (day.dayNumber === task.infoForCell.startDay) {
if (((task.infoForCell.endHour <= hour || task.infoForCell.startHour <= hour) && (task.infoForCell.endHour > hour)) if (((task.infoForCell.endHour <= hour || task.infoForCell.startHour <= hour) && (task.infoForCell.endHour > hour))
|| (task.infoForCell.startHour >= hour && task.infoForCell.endHour < hourDiffEnd) || (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 return task
} }
} }
...@@ -32,27 +32,9 @@ const CalendarTask = ({year, month, tasks, day, hours, setCurrentTask, onChange, ...@@ -32,27 +32,9 @@ const CalendarTask = ({year, month, tasks, day, hours, setCurrentTask, onChange,
}) })
return tasksCell return tasksCell
} }
const tasksCell = getTaskInDayCell(tasks, day, hours) 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 (<> return (<>
{tasksCell.length ? tasksCell.map((task, i)=> {tasksCell.length ? tasksCell.map((task, i)=>
{ {
......
...@@ -7,7 +7,7 @@ import CalendarTask from "./CalendarTask/CalendarTask"; ...@@ -7,7 +7,7 @@ import CalendarTask from "./CalendarTask/CalendarTask";
function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, onChangeCellTaskTitle, setCurrentTask, hourFormat, setHourFormat}) { 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 [daysInMonth, setDaysInMonth] = useState([])
const [cellSizes, setCellSizes] = useState({}) const [cellSizes, setCellSizes] = useState({})
useEffect(()=>{ useEffect(()=>{
...@@ -20,7 +20,7 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, onChang ...@@ -20,7 +20,7 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, onChang
useEffect(()=>{ useEffect(()=>{
if (hourFormat) { 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 cells = arr.length
const xs = 10.8/cells const xs = 10.8/cells
setCellSizes(()=>{ setCellSizes(()=>{
...@@ -28,7 +28,7 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, onChang ...@@ -28,7 +28,7 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, onChang
}) })
setHoursInDay(()=>arr) setHoursInDay(()=>arr)
} else { } 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 cells = arr.length
const xs = 10.8/cells const xs = 10.8/cells
setCellSizes(()=>{ 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