Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
planner-team-one
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
21
Issues
21
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Евгений Положенцев
planner-team-one
Commits
2f3dde89
Commit
2f3dde89
authored
Nov 08, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#29
Подготовка к мержу
parent
9388b278
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
24 deletions
+6
-24
CalendarTask.js
...components/MonthCalendarBody/CalendarTask/CalendarTask.js
+3
-21
MonthCalendarBody.js
...ont/src/components/MonthCalendarBody/MonthCalendarBody.js
+3
-3
No files found.
planner-front/src/components/MonthCalendarBody/CalendarTask/CalendarTask.js
View file @
2f3dde89
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
}
}
}
}
...
@@ -35,24 +35,6 @@ const CalendarTask = ({year, month, tasks, day, hours, setCurrentTask, onChange,
...
@@ -35,24 +35,6 @@ const CalendarTask = ({year, month, tasks, day, hours, setCurrentTask, onChange,
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
)
=>
{
{
...
...
planner-front/src/components/MonthCalendarBody/MonthCalendarBody.js
View file @
2f3dde89
...
@@ -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
(()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment