Commit 95a5903f authored by Ermolaev Timur's avatar Ermolaev Timur

#148 Исправил ошибку с селектом и кей пропом

parent d0dc6458
...@@ -40,8 +40,7 @@ const CalendarRowDay = ({ xs, hoursInDay, createTaskInCellHandler, currentTask, ...@@ -40,8 +40,7 @@ const CalendarRowDay = ({ xs, hoursInDay, createTaskInCellHandler, currentTask,
> >
{linesInDay?.map((line, i) => { {linesInDay?.map((line, i) => {
const tasks = getTasksWithInfoForPosition(line, hoursInDay, sortedTasks, i, rowDaySize.width) const tasks = getTasksWithInfoForPosition(line, hoursInDay, sortedTasks, i, rowDaySize.width)
return (<> return (tasks.map((task) => {
{tasks.map((task) => {
const step = rowDaySize.width / hoursInDay.length const step = rowDaySize.width / hoursInDay.length
return ( return (
<CalendarTask <CalendarTask
...@@ -61,8 +60,8 @@ const CalendarRowDay = ({ xs, hoursInDay, createTaskInCellHandler, currentTask, ...@@ -61,8 +60,8 @@ const CalendarRowDay = ({ xs, hoursInDay, createTaskInCellHandler, currentTask,
> >
</CalendarTask> </CalendarTask>
) )
})} })
</>) )
})} })}
{hoursInDay.map((hour, i) => { {hoursInDay.map((hour, i) => {
......
...@@ -34,7 +34,7 @@ function CalendarModalTaskContent({ title, onChangeCurrentTaskHandler, descripti ...@@ -34,7 +34,7 @@ function CalendarModalTaskContent({ title, onChangeCurrentTaskHandler, descripti
/> />
<div style={{ display: 'flex', gap: '20px', margin: '20px 0' }}> <div style={{ display: 'flex', gap: '20px', margin: '20px 0' }}>
<CustomSelect <CustomSelect
defaultValue={null} defaultValue={priorities[0]?.value}
value={priority} value={priority}
name={'priority'} name={'priority'}
variant={'outlined'} variant={'outlined'}
......
...@@ -22,7 +22,6 @@ const CalendarStandartCell = ({ children, xs, hours, dayNumber, createTaskInCell ...@@ -22,7 +22,6 @@ const CalendarStandartCell = ({ children, xs, hours, dayNumber, createTaskInCell
} }
},[copyTask, copyModeTask, year, month, dayNumber, hours]) },[copyTask, copyModeTask, year, month, dayNumber, hours])
// console.log(copyTask)
const cellClass = useMemo(() => { const cellClass = useMemo(() => {
const backgroundColor = isDeadLine ? '#fa9b9be3' : 'null' const backgroundColor = isDeadLine ? '#fa9b9be3' : 'null'
return ({ return ({
......
import { useMemo } from "react"; import React, { useMemo } from "react";
import { getHoursInDayNumbers, getAvailableTasks, getLinesInDay, getSortedTasks } from "../../../../../helpers/CalendarHelpers"; import { getHoursInDayNumbers, getAvailableTasks, getLinesInDay, getSortedTasks } from "../../../../../helpers/CalendarHelpers";
import CalendarStandartCell from "../../../UI/CalendarStandartCell/CalendarStandartCell"; import CalendarStandartCell from "../../../UI/CalendarStandartCell/CalendarStandartCell";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
...@@ -8,7 +8,7 @@ import { getTasksWithInfoForPosition, getWidthLeftZIndex } from "./Helpers"; ...@@ -8,7 +8,7 @@ import { getTasksWithInfoForPosition, getWidthLeftZIndex } from "./Helpers";
function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat, handleOpen, setCurrentTask, copyTask, setCopyTask, createCopyTask, createTaskInCellHandler, modal, dragTaskHandler, copyMode, deleteTaskHandler }) { function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat, handleOpen, setCurrentTask, copyTask, setCopyTask, createCopyTask, createTaskInCellHandler, modal, dragTaskHandler, copyMode, deleteTaskHandler}) {
const [columnDaySize, setColumnDaySize] = useState({ width: 0, height: 0 }) const [columnDaySize, setColumnDaySize] = useState({ width: 0, height: 0 })
...@@ -39,8 +39,7 @@ function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat ...@@ -39,8 +39,7 @@ function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat
<Grid item xs={12 / 7} ref={dayColumnRef} sx={{ position: 'relative' }}> <Grid item xs={12 / 7} ref={dayColumnRef} sx={{ position: 'relative' }}>
{linesInDay?.map((line, i) => { {linesInDay?.map((line, i) => {
const boxes = getTasksWithInfoForPosition(line, sortedTasks, linesInDay, columnDaySize.height, hours) const boxes = getTasksWithInfoForPosition(line, sortedTasks, linesInDay, columnDaySize.height, hours)
return (<> return boxes.map((task) => {
{boxes.map((task) => {
const { width, left, zIndex } = getWidthLeftZIndex(task, columnDaySize.width, i) const { width, left, zIndex } = getWidthLeftZIndex(task, columnDaySize.width, i)
const step = columnDaySize.height / hours.length const step = columnDaySize.height / hours.length
const tasksLength = task.tasksInHour const tasksLength = task.tasksInHour
...@@ -64,11 +63,9 @@ function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat ...@@ -64,11 +63,9 @@ function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat
hourFormat={hourFormat} hourFormat={hourFormat}
copyModeTask={copyMode.task} copyModeTask={copyMode.task}
deleteTaskHandler={deleteTaskHandler} deleteTaskHandler={deleteTaskHandler}
> />
</CalendarWeekTask>
) )
})} })
</>)
})} })}
{hoursInDay?.map((hour, i) => { {hoursInDay?.map((hour, i) => {
......
...@@ -15,7 +15,7 @@ export const anonymoysMenuButtons = [ ...@@ -15,7 +15,7 @@ export const anonymoysMenuButtons = [
] ]
export const priorities = [ export const priorities = [
{ value: null, text: '--Приоритет--' }, { value: '', text: '--Приоритет--' },
{ value: 'A', text: 'A' }, { value: 'A', text: 'A' },
{ value: 'B', text: 'B' }, { value: 'B', text: 'B' },
{ value: 'C', text: 'C' } { value: 'C', text: 'C' }
......
...@@ -20,7 +20,7 @@ function MonthCalendar() { ...@@ -20,7 +20,7 @@ function MonthCalendar() {
const [hourFormat, setHourFormat] = useState(false); const [hourFormat, setHourFormat] = useState(false);
const [dateNow, setDateNow] = useState({ month: '', year: '' }) const [dateNow, setDateNow] = useState({ month: '', year: '' })
const [workerInfo, setWorkerInfo] = useState({ project: '', worker: '' }); const [workerInfo, setWorkerInfo] = useState({ project: '', worker: '' });
const [currentTask, setCurrentTask] = useState({ title: '', description: '', priority: null, infoForCell: { startHour: null, endHour: null } }) const [currentTask, setCurrentTask] = useState({ title: '', description: '', priority: '', infoForCell: { startHour: null, endHour: null } })
const [copyTask, setCopyTask] = useState(null) const [copyTask, setCopyTask] = useState(null)
const [cellSizes, setCellSizes] = useState({}) const [cellSizes, setCellSizes] = useState({})
const [userId, setUserId] = useState('') const [userId, setUserId] = useState('')
...@@ -141,7 +141,7 @@ function MonthCalendar() { ...@@ -141,7 +141,7 @@ function MonthCalendar() {
const newTask = { const newTask = {
title: "Задача", title: "Задача",
description: "описание", description: "описание",
priority: null, priority: '',
dateTimeStart: dateToISOLikeButLocal(new Date(dateNow.year, dateNow.month, dayNumber, hour, 0)), dateTimeStart: dateToISOLikeButLocal(new Date(dateNow.year, dateNow.month, dayNumber, hour, 0)),
dateTimeDue: dateToISOLikeButLocal(new Date(dateNow.year, dateNow.month, dayNumber, hourDue, 59)), dateTimeDue: dateToISOLikeButLocal(new Date(dateNow.year, dateNow.month, dayNumber, hourDue, 59)),
infoForCell: { infoForCell: {
......
...@@ -23,7 +23,7 @@ function WeekCalendar() { ...@@ -23,7 +23,7 @@ function WeekCalendar() {
const [workerInfo, setWorkerInfo] = useState({ project: '', worker: '' }); const [workerInfo, setWorkerInfo] = useState({ project: '', worker: '' });
const [dateNow, setDateNow] = useState({ year: '', month: '', currentDay: '' }) const [dateNow, setDateNow] = useState({ year: '', month: '', currentDay: '' })
const [currentTask, setCurrentTask] = useState({ title: '', description: '', priority: null, infoForCell: { startHour: null, endHour: null } }) const [currentTask, setCurrentTask] = useState({ title: '', description: '', priority: '', infoForCell: { startHour: null, endHour: null } })
const [hourFormat, setHourFormat] = useState(false); const [hourFormat, setHourFormat] = useState(false);
const [copyTask, setCopyTask] = useState(null) const [copyTask, setCopyTask] = useState(null)
const [userCalendarId, setUserCalendarId] = useState(null) const [userCalendarId, setUserCalendarId] = useState(null)
...@@ -138,7 +138,7 @@ function WeekCalendar() { ...@@ -138,7 +138,7 @@ function WeekCalendar() {
const newTask = { const newTask = {
title: "Задача", title: "Задача",
description: "описание", description: "описание",
priority: null, priority: '',
dateTimeStart: dateToISOLikeButLocal(new Date(year, month, dayNumber, hour, 0)), dateTimeStart: dateToISOLikeButLocal(new Date(year, month, dayNumber, hour, 0)),
dateTimeDue: dateToISOLikeButLocal(new Date(year, month, dayNumber, hourDue, 59)), dateTimeDue: dateToISOLikeButLocal(new Date(year, month, dayNumber, hourDue, 59)),
infoForCell: { infoForCell: {
......
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