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
7f789605
Commit
7f789605
authored
Nov 21, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#54
Реализовал увелечение задачи
parent
812e601b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
13 deletions
+90
-13
CalendarRowDay.js
...onents/MonthCalendarBody/CalendarRowDay/CalendarRowDay.js
+3
-3
CalendarTask.js
...components/MonthCalendarBody/CalendarTask/CalendarTask.js
+19
-7
MonthCalendarBody.js
...ont/src/components/MonthCalendarBody/MonthCalendarBody.js
+3
-1
MonthCalendar.js
planner-front/src/containers/MonthCalendar/MonthCalendar.js
+65
-2
No files found.
planner-front/src/components/MonthCalendarBody/CalendarRowDay/CalendarRowDay.js
View file @
7f789605
...
@@ -4,7 +4,7 @@ import CalendarStandartCell from "../CalendarStandartCell.js/CalendarStandartCel
...
@@ -4,7 +4,7 @@ import CalendarStandartCell from "../CalendarStandartCell.js/CalendarStandartCel
import
CalendarTask
from
"../CalendarTask/CalendarTask"
;
import
CalendarTask
from
"../CalendarTask/CalendarTask"
;
import
EmptyBox
from
"./EmptyBox/EmptyBox"
;
import
EmptyBox
from
"./EmptyBox/EmptyBox"
;
const
CalendarRowDay
=
({
xs
,
hoursInDay
,
createTaskInCellHandler
,
currentTask
,
handleOpen
,
modal
,
setCurrentTask
,
year
,
month
,
tasks
,
day
,
hourFormat
,
setCurrentLine
,
currentLine
,
dragTaskHandler
})
=>
{
const
CalendarRowDay
=
({
xs
,
hoursInDay
,
createTaskInCellHandler
,
currentTask
,
handleOpen
,
modal
,
setCurrentTask
,
year
,
month
,
tasks
,
day
,
hourFormat
,
setCurrentLine
,
currentLine
,
dragTaskHandler
,
increaseTaskHandler
,
reduceTaskHandler
})
=>
{
const
hours
=
useMemo
(()
=>
{
const
hours
=
useMemo
(()
=>
{
return
hoursInDay
.
map
((
hour
)
=>
parseInt
(
hour
.
split
(
':'
)[
0
]))},
return
hoursInDay
.
map
((
hour
)
=>
parseInt
(
hour
.
split
(
':'
)[
0
]))},
...
@@ -163,7 +163,6 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
...
@@ -163,7 +163,6 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
{
boxes
.
map
((
box
,
index
)
=>
{
{
boxes
.
map
((
box
,
index
)
=>
{
if
(
box
.
task
)
{
if
(
box
.
task
)
{
return
(
<
Grid
return
(
<
Grid
key
=
{
i
}
item
xs
=
{
box
.
xs
}
item
xs
=
{
box
.
xs
}
sx
=
{{
height
:
'35px'
,
marginBottom
:
'5px'
}}
sx
=
{{
height
:
'35px'
,
marginBottom
:
'5px'
}}
>
>
...
@@ -177,11 +176,12 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
...
@@ -177,11 +176,12 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
task
=
{
box
.
task
}
task
=
{
box
.
task
}
setCurrentTask
=
{
setCurrentTask
}
setCurrentTask
=
{
setCurrentTask
}
handleOpen
=
{
handleOpen
}
handleOpen
=
{
handleOpen
}
increaseTaskHandler
=
{
increaseTaskHandler
}
reduceTaskHandler
=
{
reduceTaskHandler
}
/
>
/
>
<
/Grid>
)
<
/Grid>
)
}
else
{
}
else
{
return
(
<
EmptyBox
return
(
<
EmptyBox
key
=
{
i
}
modal
=
{
modal
}
modal
=
{
modal
}
dayNumber
=
{
day
.
dayNumber
}
dayNumber
=
{
day
.
dayNumber
}
hourNumber
=
{
box
.
hour
}
hourNumber
=
{
box
.
hour
}
...
...
planner-front/src/components/MonthCalendarBody/CalendarTask/CalendarTask.js
View file @
7f789605
import
{
Grid
}
from
"@mui/material"
;
import
{
Grid
}
from
"@mui/material"
;
import
React
,
{
memo
,
useEffect
,
useRef
}
from
"react"
;
import
React
,
{
memo
,
useEffect
,
useRef
,
useState
}
from
"react"
;
const
CalendarTask
=
({
setCurrentTask
,
handleOpen
,
task
,
line
,
setCurrentLine
,
currentLine
,
currentTask
,
dragTaskHandler
,
hou
r
})
=>
{
const
CalendarTask
=
({
setCurrentTask
,
handleOpen
,
task
,
line
,
setCurrentLine
,
increaseTaskHandler
,
reduceTaskHandle
r
})
=>
{
const
[
color
,
setColor
]
=
useState
(
''
)
const
[
color
,
setColor
]
=
useState
(
''
)
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -25,19 +25,28 @@ const CalendarTask = ({setCurrentTask, handleOpen, task, line, setCurrentLine, c
...
@@ -25,19 +25,28 @@ const CalendarTask = ({setCurrentTask, handleOpen, task, line, setCurrentLine, c
let
width
=
parseInt
(
styles
.
width
,
10
);
let
width
=
parseInt
(
styles
.
width
,
10
);
let
x
=
0
;
let
x
=
0
;
// Right resize
const
lastPoint
=
{
x
:
null
,
y
:
null
}
const
onMouseMoveRightResize
=
(
event
)
=>
{
const
onMouseMoveRightResize
=
(
event
)
=>
{
const
dx
=
event
.
clientX
-
x
;
event
.
stopPropagation
()
x
=
event
.
clientX
;
const
leftOrRight
=
(
width
=
width
+
dx
;
event
.
clientX
>
lastPoint
.
x
?
'right'
resizeableEle
.
style
.
width
=
`
${
width
}
px`
;
:
event
.
clientX
<
lastPoint
.
x
?
'left'
:
'none'
)
if
(
leftOrRight
===
'right'
)
{
increaseTaskHandler
(
line
,
task
,
false
)
}
lastPoint
.
x
=
event
.
clientX
lastPoint
.
y
=
event
.
clientY
};
};
const
onMouseUpRightResize
=
(
event
)
=>
{
const
onMouseUpRightResize
=
(
event
)
=>
{
event
.
stopPropagation
()
document
.
removeEventListener
(
"mousemove"
,
onMouseMoveRightResize
);
document
.
removeEventListener
(
"mousemove"
,
onMouseMoveRightResize
);
};
};
const
onMouseDownRightResize
=
(
event
)
=>
{
const
onMouseDownRightResize
=
(
event
)
=>
{
event
.
stopPropagation
()
x
=
event
.
clientX
;
x
=
event
.
clientX
;
resizeableEle
.
style
.
left
=
styles
.
left
;
resizeableEle
.
style
.
left
=
styles
.
left
;
resizeableEle
.
style
.
right
=
null
;
resizeableEle
.
style
.
right
=
null
;
...
@@ -47,6 +56,7 @@ const CalendarTask = ({setCurrentTask, handleOpen, task, line, setCurrentLine, c
...
@@ -47,6 +56,7 @@ const CalendarTask = ({setCurrentTask, handleOpen, task, line, setCurrentLine, c
// Left resize
// Left resize
const
onMouseMoveLeftResize
=
(
event
)
=>
{
const
onMouseMoveLeftResize
=
(
event
)
=>
{
event
.
stopPropagation
()
const
dx
=
event
.
clientX
-
x
;
const
dx
=
event
.
clientX
-
x
;
x
=
event
.
clientX
;
x
=
event
.
clientX
;
width
=
width
-
dx
;
width
=
width
-
dx
;
...
@@ -54,10 +64,12 @@ const CalendarTask = ({setCurrentTask, handleOpen, task, line, setCurrentLine, c
...
@@ -54,10 +64,12 @@ const CalendarTask = ({setCurrentTask, handleOpen, task, line, setCurrentLine, c
};
};
const
onMouseUpLeftResize
=
(
event
)
=>
{
const
onMouseUpLeftResize
=
(
event
)
=>
{
event
.
stopPropagation
()
document
.
removeEventListener
(
"mousemove"
,
onMouseMoveLeftResize
);
document
.
removeEventListener
(
"mousemove"
,
onMouseMoveLeftResize
);
};
};
const
onMouseDownLeftResize
=
(
event
)
=>
{
const
onMouseDownLeftResize
=
(
event
)
=>
{
event
.
stopPropagation
()
x
=
event
.
clientX
;
x
=
event
.
clientX
;
resizeableEle
.
style
.
right
=
styles
.
right
;
resizeableEle
.
style
.
right
=
styles
.
right
;
resizeableEle
.
style
.
left
=
null
;
resizeableEle
.
style
.
left
=
null
;
...
...
planner-front/src/components/MonthCalendarBody/MonthCalendarBody.js
View file @
7f789605
...
@@ -8,7 +8,7 @@ import MonthCalendarModalContent from "../MonthCalendarModalContent/MonthCalenda
...
@@ -8,7 +8,7 @@ import MonthCalendarModalContent from "../MonthCalendarModalContent/MonthCalenda
import
CalendarRowDay
from
"./CalendarRowDay/CalendarRowDay"
;
import
CalendarRowDay
from
"./CalendarRowDay/CalendarRowDay"
;
function
MonthCalendarBody
({
month
,
year
,
tasks
,
createTaskInCellHandler
,
currentTask
,
setCurrentTask
,
hourFormat
,
setHourFormat
,
onChangeCurrentTaskHandler
,
sendNewTaskHandler
,
deleteTaskHandler
,
cellSizes
,
hoursInDay
,
daysInMonth
,
dragTaskHandler
})
{
function
MonthCalendarBody
({
month
,
year
,
tasks
,
createTaskInCellHandler
,
currentTask
,
setCurrentTask
,
hourFormat
,
setHourFormat
,
onChangeCurrentTaskHandler
,
sendNewTaskHandler
,
deleteTaskHandler
,
cellSizes
,
hoursInDay
,
daysInMonth
,
dragTaskHandler
,
increaseTaskHandler
,
reduceTaskHandler
})
{
const
[
currentLine
,
setCurrentLine
]
=
useState
(
''
)
const
[
currentLine
,
setCurrentLine
]
=
useState
(
''
)
const
[
modal
,
setModal
]
=
useState
({
open
:
false
,
y
:
0
,
x
:
0
,});
const
[
modal
,
setModal
]
=
useState
({
open
:
false
,
y
:
0
,
x
:
0
,});
...
@@ -83,6 +83,8 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, current
...
@@ -83,6 +83,8 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, current
tasks
=
{
tasks
}
tasks
=
{
tasks
}
day
=
{
day
}
day
=
{
day
}
hourFormat
=
{
hourFormat
}
hourFormat
=
{
hourFormat
}
increaseTaskHandler
=
{
increaseTaskHandler
}
reduceTaskHandler
=
{
reduceTaskHandler
}
>
>
<
/CalendarRowDay
>
<
/CalendarRowDay
>
<
/CalendarRow
>
<
/CalendarRow
>
...
...
planner-front/src/containers/MonthCalendar/MonthCalendar.js
View file @
7f789605
...
@@ -133,11 +133,72 @@ function MonthCalendar() {
...
@@ -133,11 +133,72 @@ function MonthCalendar() {
const
hourDiff
=
timeEndHour
-
timeStartHour
const
hourDiff
=
timeEndHour
-
timeStartHour
const
due
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
hour
+
hourDiff
,
59
))
const
due
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
hour
+
hourDiff
,
59
))
const
start
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
hour
,
0
))
const
start
=
dateToISOLikeButLocal
(
new
Date
(
dateNow
.
year
,
dateNow
.
month
,
dayNumber
,
hour
,
0
))
await
dispatch
(
editTask
(
{
const
newObj
=
{
...
currentTask
,
...
currentTask
,
dateTimeStart
:
start
,
dateTimeStart
:
start
,
dateTimeDue
:
due
dateTimeDue
:
due
}))
}
delete
newObj
.
infoForCell
await
dispatch
(
editTask
(
newObj
))
setCurrentTask
({})
}
const
increaseTaskHandler
=
async
(
dayNumber
,
task
,
isStartTask
)
=>
{
const
timeEnd
=
task
.
dateTimeDue
.
split
(
'T'
)[
1
]
const
timeEndHour
=
parseInt
(
timeEnd
.
split
(
':'
)[
0
])
const
timeStart
=
task
.
dateTimeStart
.
split
(
'T'
)[
1
]
const
timeStartHour
=
parseInt
(
timeStart
.
split
(
':'
)[
0
])
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
(
editTask
(
newObj
))
setCurrentTask
({})
}
const
reduceTaskHandler
=
async
(
dayNumber
,
task
,
isStartTask
)
=>
{
const
timeEnd
=
task
.
dateTimeDue
.
split
(
'T'
)[
1
]
const
timeEndHour
=
parseInt
(
timeEnd
.
split
(
':'
)[
0
])
const
timeStart
=
task
.
dateTimeStart
.
split
(
'T'
)[
1
]
const
timeStartHour
=
parseInt
(
timeStart
.
split
(
':'
)[
0
])
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
(
editTask
(
newObj
))
setCurrentTask
({})
setCurrentTask
({})
}
}
...
@@ -193,6 +254,8 @@ function MonthCalendar() {
...
@@ -193,6 +254,8 @@ function MonthCalendar() {
hoursInDay
=
{
hoursInDay
}
hoursInDay
=
{
hoursInDay
}
daysInMonth
=
{
daysInMonth
}
daysInMonth
=
{
daysInMonth
}
dragTaskHandler
=
{
dragTaskHandler
}
dragTaskHandler
=
{
dragTaskHandler
}
increaseTaskHandler
=
{
increaseTaskHandler
}
reduceTaskHandler
=
{
reduceTaskHandler
}
/
>
/
>
<
/
>
<
/
>
...
...
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