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
0ae42d59
Commit
0ae42d59
authored
Nov 26, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#71
Удалил стрелочки, изменил кнопку, пофиксил чуть отображение
parent
59ece50e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
122 deletions
+14
-122
CalendarRowDay.js
...onents/MonthCalendarBody/CalendarRowDay/CalendarRowDay.js
+2
-5
EmptyBox.js
...nts/MonthCalendarBody/CalendarRowDay/EmptyBox/EmptyBox.js
+1
-0
CalendarTask.js
...components/MonthCalendarBody/CalendarTask/CalendarTask.js
+10
-50
MonthCalendarBody.js
...ont/src/components/MonthCalendarBody/MonthCalendarBody.js
+1
-3
MonthCalendar.js
planner-front/src/containers/MonthCalendar/MonthCalendar.js
+0
-64
No files found.
planner-front/src/components/MonthCalendarBody/CalendarRowDay/CalendarRowDay.js
View file @
0ae42d59
import
{
Grid
}
from
"@mui/material"
;
import
{
memo
,
use
Effect
,
useMemo
,
useState
}
from
"react"
;
import
{
memo
,
use
Memo
}
from
"react"
;
import
CalendarStandartCell
from
"../CalendarStandartCell.js/CalendarStandartCell"
;
import
CalendarTask
from
"../CalendarTask/CalendarTask"
;
import
EmptyBox
from
"./EmptyBox/EmptyBox"
;
import
{
getAvailableTasks
,
getBoxesInLine
,
getLinesInDay
,
getSortedTasks
}
from
"./Helpers"
;
const
CalendarRowDay
=
({
xs
,
hoursInDay
,
createTaskInCellHandler
,
currentTask
,
handleOpen
,
modal
,
setCurrentTask
,
year
,
month
,
tasks
,
day
,
hourFormat
,
setCurrentLine
,
currentLine
,
dragTaskHandler
,
increaseTaskHandler
,
reduceTaskHandler
,
createCopyTask
,
setCopyTask
,
copyTask
})
=>
{
const
CalendarRowDay
=
({
xs
,
hoursInDay
,
createTaskInCellHandler
,
currentTask
,
handleOpen
,
modal
,
setCurrentTask
,
year
,
month
,
tasks
,
day
,
hourFormat
,
setCurrentLine
,
currentLine
,
dragTaskHandler
,
createCopyTask
,
setCopyTask
,
copyTask
})
=>
{
const
hours
=
useMemo
(()
=>
{
return
hoursInDay
.
map
((
hour
)
=>
parseInt
(
hour
.
split
(
':'
)[
0
]))},
...
...
@@ -68,11 +68,8 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
hour
=
{
parseInt
(
hours
[
index
])}
line
=
{
day
.
dayNumber
}
task
=
{
box
.
task
}
hourFormat
=
{
hourFormat
}
setCurrentTask
=
{
setCurrentTask
}
handleOpen
=
{
handleOpen
}
increaseTaskHandler
=
{
increaseTaskHandler
}
reduceTaskHandler
=
{
reduceTaskHandler
}
setCopyTask
=
{
setCopyTask
}
/
>
<
/Grid>
)
...
...
planner-front/src/components/MonthCalendarBody/CalendarRowDay/EmptyBox/EmptyBox.js
View file @
0ae42d59
...
...
@@ -38,6 +38,7 @@ const EmptyBox = ({hourNumber, handleOpen, dayNumber, xs, dragTaskHandler, modal
height
:
'35px'
,
backgroundColor
:
'rgb(0,0,0,0)'
,
zIndex
:
'6'
,
cursor
:
copyTask
?
'pointer'
:
'default'
}}
>
{
isThisCell
?
<
DefaultTask
/>
:
null
}
...
...
planner-front/src/components/MonthCalendarBody/CalendarTask/CalendarTask.js
View file @
0ae42d59
import
{
Button
,
Grid
}
from
"@mui/material"
;
import
React
,
{
memo
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
ArrowBackIcon
from
'@mui/icons-material/ArrowBack'
;
import
ArrowForwardIcon
from
'@mui/icons-material/ArrowForward'
;
import
{
Grid
}
from
"@mui/material"
;
import
React
,
{
memo
,
useEffect
,
useState
}
from
"react"
;
import
ContentCopyIcon
from
'@mui/icons-material/ContentCopy'
;
const
arrowClass
=
{
height
:
'20px'
,
cursor
:
'pointer'
,
transition
:
'0.5s'
,
"&:hover"
:
{
transition
:
'0.5s'
,
transform
:
'scale(1.2)'
}
}
const
CalendarTask
=
({
setCurrentTask
,
handleOpen
,
task
,
line
,
setCurrentLine
,
increaseTaskHandler
,
reduceTaskHandler
,
hourFormat
,
setCopyTask
})
=>
{
const
CalendarTask
=
({
setCurrentTask
,
handleOpen
,
task
,
line
,
setCurrentLine
,
setCopyTask
})
=>
{
const
[
color
,
setColor
]
=
useState
(
''
)
useEffect
(()
=>
{
...
...
@@ -57,45 +46,16 @@ const CalendarTask = ({setCurrentTask, handleOpen, task, line, setCurrentLine, i
onDragLeave
=
{(
e
)
=>
{
dragLeaveHandler
(
e
)}}
onDragStart
=
{(
e
)
=>
{
dragStartHandler
(
e
,
line
,
task
)}}
onDragEnd
=
{(
e
)
=>
{
dragEndHandler
(
e
)}}
sx
=
{{
position
:
'relative'
,
height
:
'30px'
,
backgroundColor
:
color
,
whiteSpace
:
'nowrap'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
,
borderRadius
:
'10px'
,
margin
:
'5px 10px'
,
display
:
'flex'
,
justifyContent
:
'flex-start'
,
alignItems
:
'center'
,
paddingLeft
:
'5px'
,
zIndex
:
'5'
,
justifyContent
:
'space-between
'
}}
sx
=
{{
position
:
'relative'
,
height
:
'30px'
,
backgroundColor
:
color
,
borderRadius
:
'10px'
,
margin
:
'5px 10px'
,
display
:
'flex'
,
alignItems
:
'center'
,
zIndex
:
'5'
,
justifyContent
:
'space-between'
,
padding
:
'0 15px
'
}}
onClick
=
{(
e
)
=>
{
onClickTaskHandler
(
e
,
task
)}}
>
{
task
.
infoForCell
.
endHour
===
task
.
infoForCell
.
startHour
&&
hourFormat
?
<>
<
div
tyle
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
style
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
ArrowBackIcon
sx
=
{
arrowClass
}
onClick
=
{(
e
)
=>
{
e
.
stopPropagation
();
increaseTaskHandler
(
line
,
task
,
true
)}}
/
>
<
ArrowForwardIcon
sx
=
{
arrowClass
}
onClick
=
{(
e
)
=>
{
e
.
stopPropagation
();
reduceTaskHandler
(
line
,
task
,
true
)}}
/
>
<
ArrowBackIcon
sx
=
{
arrowClass
}
onClick
=
{(
e
)
=>
{
e
.
stopPropagation
();
reduceTaskHandler
(
line
,
task
,
false
)}}
/
>
<
ArrowForwardIcon
sx
=
{
arrowClass
}
onClick
=
{(
e
)
=>
{
e
.
stopPropagation
();
increaseTaskHandler
(
line
,
task
,
false
)}}
/
>
<
/div
>
<
/div
>
<
div
>
<
span
style
=
{{
maxWidth
:
'60%'
,
whiteSpace
:
'nowrap'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}}
>
{
task
.
title
}
<
/div
>
<
/
>
<
/span
>
<
ContentCopyIcon
sx
=
{{
width
:
'20px'
,
cursor
:
'pointer'
}}
onClick
=
{(
e
)
=>
{
e
.
stopPropagation
();
setCopyTask
(
task
)}}
>
<
/
ContentCopyIcon
>
:
<>
<
div
style
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
ArrowBackIcon
sx
=
{
arrowClass
}
onClick
=
{(
e
)
=>
{
e
.
stopPropagation
();
increaseTaskHandler
(
line
,
task
,
true
)}}
/
>
<
ArrowForwardIcon
sx
=
{
arrowClass
}
onClick
=
{(
e
)
=>
{
e
.
stopPropagation
();
reduceTaskHandler
(
line
,
task
,
true
)}}
/
>
<
/div
>
{
task
.
title
}
<
div
style
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Button
sx
=
{{
color
:
'black'
,
fontWeight
:
'600'
}}
onClick
=
{(
e
)
=>
{
e
.
stopPropagation
();
setCopyTask
(
task
)}}
>
Copy
<
/Button
>
<
ArrowBackIcon
sx
=
{
arrowClass
}
onClick
=
{(
e
)
=>
{
e
.
stopPropagation
();
reduceTaskHandler
(
line
,
task
,
false
)}}
/
>
<
ArrowForwardIcon
sx
=
{
arrowClass
}
onClick
=
{(
e
)
=>
{
e
.
stopPropagation
();
increaseTaskHandler
(
line
,
task
,
false
)}}
/
>
<
/div
>
<
/
>
}
<
/Grid
>
<
/>
)
};
...
...
planner-front/src/components/MonthCalendarBody/MonthCalendarBody.js
View file @
0ae42d59
...
...
@@ -8,7 +8,7 @@ import MonthCalendarModalContent from "../MonthCalendarModalContent/MonthCalenda
import
CalendarRowDay
from
"./CalendarRowDay/CalendarRowDay"
;
function
MonthCalendarBody
({
month
,
year
,
tasks
,
createTaskInCellHandler
,
currentTask
,
setCurrentTask
,
hourFormat
,
setHourFormat
,
onChangeCurrentTaskHandler
,
sendNewTaskHandler
,
deleteTaskHandler
,
cellSizes
,
hoursInDay
,
daysInMonth
,
dragTaskHandler
,
increaseTaskHandler
,
reduceTaskHandler
,
createCopyTask
,
setCopyTask
,
copyTask
})
{
function
MonthCalendarBody
({
month
,
year
,
tasks
,
createTaskInCellHandler
,
currentTask
,
setCurrentTask
,
hourFormat
,
setHourFormat
,
onChangeCurrentTaskHandler
,
sendNewTaskHandler
,
deleteTaskHandler
,
cellSizes
,
hoursInDay
,
daysInMonth
,
dragTaskHandler
,
createCopyTask
,
setCopyTask
,
copyTask
})
{
const
[
currentLine
,
setCurrentLine
]
=
useState
(
''
)
const
[
modal
,
setModal
]
=
useState
({
open
:
false
,
y
:
0
,
x
:
0
,});
...
...
@@ -71,8 +71,6 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, current
tasks
=
{
tasks
}
day
=
{
day
}
hourFormat
=
{
hourFormat
}
increaseTaskHandler
=
{
increaseTaskHandler
}
reduceTaskHandler
=
{
reduceTaskHandler
}
createCopyTask
=
{
createCopyTask
}
copyTask
=
{
copyTask
}
setCopyTask
=
{
setCopyTask
}
...
...
planner-front/src/containers/MonthCalendar/MonthCalendar.js
View file @
0ae42d59
...
...
@@ -145,68 +145,6 @@ function MonthCalendar() {
setCurrentTask
({})
}
const
increaseTaskHandler
=
async
(
dayNumber
,
task
,
isStartTask
)
=>
{
const
timeEndHour
=
task
.
infoForCell
.
endHour
const
timeStartHour
=
task
.
infoForCell
.
startHour
let
hourDiff
if
(
hourFormat
)
{
hourDiff
=
1
}
else
{
hourDiff
=
2
}
let
due
let
start
if
(
isStartTask
)
{
due
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
timeEndHour
,
59
))
start
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
timeStartHour
-
hourDiff
,
0
))
}
else
{
due
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
timeEndHour
+
hourDiff
,
59
))
start
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
timeStartHour
,
0
))
}
const
newObj
=
{
...
task
,
dateTimeStart
:
start
,
dateTimeDue
:
due
}
delete
newObj
.
infoForCell
await
dispatch
(
editCalendarTask
(
newObj
))
setCurrentTask
({})
}
const
reduceTaskHandler
=
async
(
dayNumber
,
task
,
isStartTask
)
=>
{
const
timeEndHour
=
task
.
infoForCell
.
endHour
const
timeStartHour
=
task
.
infoForCell
.
startHour
let
hourDiff
let
hourDiffCheck
if
(
hourFormat
)
{
hourDiff
=
1
hourDiffCheck
=
0
}
else
{
hourDiff
=
2
hourDiffCheck
=
1
}
let
due
let
start
if
(
task
.
infoForCell
.
endHour
-
task
.
infoForCell
.
startHour
-
hourDiffCheck
!==
0
)
{
if
(
isStartTask
)
{
due
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
timeEndHour
,
59
))
start
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
timeStartHour
+
hourDiff
,
0
))
}
else
{
due
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
timeEndHour
-
hourDiff
,
59
))
start
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
timeStartHour
,
0
))
}
const
newObj
=
{
...
task
,
dateTimeStart
:
start
,
dateTimeDue
:
due
}
delete
newObj
.
infoForCell
await
dispatch
(
editCalendarTask
(
newObj
))
setCurrentTask
({})
}
}
const
sendNewTaskHandler
=
async
()
=>
{
const
timeEndHour
=
currentTask
.
infoForCell
.
endHour
const
timeStartHour
=
currentTask
.
infoForCell
.
startHour
...
...
@@ -279,8 +217,6 @@ function MonthCalendar() {
hoursInDay
=
{
hoursInDay
}
daysInMonth
=
{
daysInMonth
}
dragTaskHandler
=
{
dragTaskHandler
}
increaseTaskHandler
=
{
increaseTaskHandler
}
reduceTaskHandler
=
{
reduceTaskHandler
}
createCopyTask
=
{
createCopyTask
}
copyTask
=
{
copyTask
}
setCopyTask
=
{
setCopyTask
}
...
...
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