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
261266f1
Commit
261266f1
authored
Dec 29, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#135
Добавил инактивные клетки, которые дальше дедлайна
parent
54ec2d57
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
35 deletions
+90
-35
CalendarRowDay.js
...lendar/MonthCalendarBody/CalendarRowDay/CalendarRowDay.js
+1
-0
CalendarStandartCell.js
...Calendars/UI/CalendarStandartCell/CalendarStandartCell.js
+87
-35
CalendarColumnDayWeek.js
...lendarBody/CalendarColumnDayWeek/CalendarColumnDayWeek.js
+1
-0
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+1
-0
No files found.
planner-front/src/components/Calendars/MonthCalendar/MonthCalendarBody/CalendarRowDay/CalendarRowDay.js
View file @
261266f1
...
...
@@ -81,6 +81,7 @@ const CalendarRowDay = ({ xs, hoursInDay, createTaskInCellHandler, currentTask,
copyTask
=
{
copyTask
}
createCopyTask
=
{
createCopyTask
}
month
=
{
month
}
year
=
{
year
}
>
<
/CalendarStandartCell
>
)
...
...
planner-front/src/components/Calendars/UI/CalendarStandartCell/CalendarStandartCell.js
View file @
261266f1
import
{
Grid
}
from
"@mui/material"
;
import
{
memo
,
use
Effect
,
useState
}
from
"react"
;
import
{
memo
,
use
Callback
,
useEffect
,
useMemo
,
useState
}
from
"react"
;
import
DefaultTask
from
"../DefaultTask/DefaultTask"
;
const
heightCell
=
40
const
CalendarStandartCell
=
({
children
,
xs
,
hours
,
dayNumber
,
createTaskInCellHandler
,
handleOpen
,
modal
,
dragTaskHandler
,
linesInDay
,
week
,
copyTask
,
createCopyTask
,
month
,
year
,
copyMode
})
=>
{
const
CalendarStandartCell
=
({
children
,
xs
,
hours
,
dayNumber
,
createTaskInCellHandler
,
handleOpen
,
modal
,
dragTaskHandler
,
linesInDay
,
week
,
copyTask
,
createCopyTask
,
month
,
year
,
copyMode
,
copyModeTask
})
=>
{
const
[
isThisCell
,
setIsThisCell
]
=
useState
(
false
)
const
[
top
,
setTop
]
=
useState
(
0
)
const
cellClass
=
{
position
:
'relative'
,
height
:
linesInDay
?.
length
?
`
${
heightCell
*
linesInDay
.
length
+
5
}
px`
:
`
${
45
}
px`
,
borderRight
:
'1px solid black'
,
borderBottom
:
week
?
'1px solid black'
:
null
,
transition
:
week
?
'0.3s'
:
null
,
'&:hover'
:
{
transition
:
'0.3s'
,
cursor
:
children
?
null
:
'#d6d2d2'
,
background
:
children
?
null
:
'#d6d2d2'
},
}
const
isDeadLine
=
useMemo
(()
=>
{
if
(
copyTask
?.
dateTimeDeadLine
)
{
if
(
new
Date
(
copyTask
?.
dateTimeDeadLine
).
getTime
()
-
new
Date
(
year
,
month
,
dayNumber
,
parseInt
(
hours
?.
split
(
':'
)[
0
])).
getTime
()
<
0
)
{
return
true
}
}
else
{
if
(
copyModeTask
?.
dateTimeDeadLine
)
{
if
(
new
Date
(
copyModeTask
?.
dateTimeDeadLine
).
getTime
()
-
new
Date
(
year
,
month
,
dayNumber
,
parseInt
(
hours
?.
split
(
':'
)[
0
])).
getTime
()
<
0
)
{
return
true
}
}
else
{
return
false
}
}
},[
copyTask
,
copyModeTask
,
year
,
month
,
dayNumber
,
hours
])
console
.
log
(
copyTask
)
const
cellClass
=
useMemo
(()
=>
{
const
backgroundColor
=
isDeadLine
?
'#fa9b9be3'
:
'null'
return
({
position
:
'relative'
,
height
:
linesInDay
?.
length
?
`
${
heightCell
*
linesInDay
.
length
+
5
}
px`
:
`
${
45
}
px`
,
borderRight
:
'1px solid black'
,
borderBottom
:
week
?
'1px solid black'
:
null
,
padding
:
week
?
'2px'
:
null
,
transition
:
week
?
'0.3s'
:
null
,
backgroundColor
:
backgroundColor
,
'&:hover'
:
{
transition
:
'0.3s'
,
cursor
:
children
?
null
:
'#d6d2d2'
,
background
:
children
?
null
:
'#d6d2d2'
}
})
},
[
children
,
linesInDay
?.
length
,
week
,
isDeadLine
])
useEffect
(()
=>
{
if
(
!
modal
)
{
...
...
@@ -25,23 +48,23 @@ const CalendarStandartCell = ({ children, xs, hours, dayNumber, createTaskInCell
}
},
[
modal
])
const
dragOverHandler
=
(
e
)
=>
{
const
dragOverHandler
=
useCallback
(
(
e
)
=>
{
e
.
preventDefault
();
e
.
target
.
style
.
background
=
children
?
null
:
'#d6d2d2'
}
const
dragLeaveHandler
=
(
e
)
=>
{
}
,
[
children
])
const
dragLeaveHandler
=
useCallback
(
(
e
)
=>
{
e
.
preventDefault
();
e
.
target
.
style
.
background
=
null
}
}
,
[])
const
dropHandler
=
(
e
)
=>
{
const
dropHandler
=
useCallback
(
(
e
)
=>
{
e
.
stopPropagation
()
e
.
preventDefault
();
e
.
target
.
style
.
background
=
null
dragTaskHandler
(
dayNumber
,
parseInt
(
hours
.
split
(
':'
)[
0
]),
month
,
year
)
}
}
,
[
dayNumber
,
hours
,
month
,
year
,
dragTaskHandler
])
const
onClickHandler
=
(
e
)
=>
{
const
onClickHandler
=
useCallback
(
(
e
)
=>
{
if
(
!
week
)
{
if
(
e
.
nativeEvent
.
offsetY
<=
5
)
{
setTop
(
40
*
Math
.
ceil
((
e
.
nativeEvent
.
offsetY
)
/
40
-
1
))
...
...
@@ -56,22 +79,51 @@ const CalendarStandartCell = ({ children, xs, hours, dayNumber, createTaskInCell
setIsThisCell
(
true
);
handleOpen
(
e
)
}
}
}
,
[
week
,
copyTask
,
copyMode
,
dayNumber
,
hours
,
month
,
year
,
createTaskInCellHandler
,
createCopyTask
,
handleOpen
])
return
<>
<
Grid
item
xs
=
{
xs
}
sx
=
{
cellClass
}
onClick
=
{(
e
)
=>
{
onClickHandler
(
e
)
}}
onDragOver
=
{(
e
)
=>
{
dragOverHandler
(
e
)
}}
onDragLeave
=
{(
e
)
=>
{
dragLeaveHandler
(
e
)
}}
onDrop
=
{(
e
)
=>
{
dropHandler
(
e
)
}}
>
{
children
}
{
isThisCell
?
<
DefaultTask
week
=
{
week
}
top
=
{
top
}
/> : null
}
const
returnCells
=
useMemo
(()
=>
{
if
(
copyTask
||
copyMode
)
{
if
(
isDeadLine
)
{
return
(
<
Grid
item
xs
=
{
xs
}
sx
=
{
cellClass
}
>
<
/Grid>
)
}
else
{
return
(
<
Grid
item
xs
=
{
xs
}
sx
=
{
cellClass
}
onClick
=
{(
e
)
=>
{
onClickHandler
(
e
)
}}
onDragOver
=
{(
e
)
=>
{
dragOverHandler
(
e
)
}}
onDragLeave
=
{(
e
)
=>
{
dragLeaveHandler
(
e
)
}}
onDrop
=
{(
e
)
=>
{
dropHandler
(
e
)
}}
>
{
children
}
{
isThisCell
?
<
DefaultTask
week
=
{
week
}
top
=
{
top
}
/> : null
}
<
/Grid>
)
}
}
return
(
<>
<
Grid
item
xs
=
{
xs
}
sx
=
{
cellClass
}
onClick
=
{(
e
)
=>
{
onClickHandler
(
e
)
}}
onDragOver
=
{(
e
)
=>
{
dragOverHandler
(
e
)
}}
onDragLeave
=
{(
e
)
=>
{
dragLeaveHandler
(
e
)
}}
onDrop
=
{(
e
)
=>
{
dropHandler
(
e
)
}}
>
{
children
}
{
isThisCell
?
<
DefaultTask
week
=
{
week
}
top
=
{
top
}
/> : null
}
<
/Grid
>
<
/>
)
<
/Grid
>
},
[
cellClass
,
children
,
copyMode
,
copyTask
,
dragOverHandler
,
dropHandler
,
isThisCell
,
onClickHandler
,
top
,
week
,
xs
,
dragLeaveHandler
,
isDeadLine
])
return
<>
{
returnCells
}
<
/
>
};
...
...
planner-front/src/components/Calendars/WeekCalendar/WeekCalendarBody/CalendarColumnDayWeek/CalendarColumnDayWeek.js
View file @
261266f1
...
...
@@ -87,6 +87,7 @@ function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat
year
=
{
year
}
dragTaskHandler
=
{
dragTaskHandler
}
copyMode
=
{
copyMode
.
working
}
copyModeTask
=
{
copyMode
.
task
}
>
<
/CalendarStandartCell
>
)
...
...
planner-front/src/store/reducers/tasksReducer.js
View file @
261266f1
...
...
@@ -49,6 +49,7 @@ const tasksReduсer = (state = initialState, action) => {
mainTaskId
:
task
.
id
,
executor
:
task
.
executor
,
author
:
task
.
author
,
dateTimeDeadLine
:
task
.
dateTimeDeadLine
,
priority
:
task
.
priority
,
title
:
task
.
title
,
description
:
task
.
description
...
...
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