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
c90e117a
Commit
c90e117a
authored
Nov 18, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#56
Пофиксил разные баги с драг энд дроп и модальным окном
parent
bc35da21
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
CalendarRowDay.js
...onents/MonthCalendarBody/CalendarRowDay/CalendarRowDay.js
+4
-6
MonthCalendarBody.js
...ont/src/components/MonthCalendarBody/MonthCalendarBody.js
+4
-2
No files found.
planner-front/src/components/MonthCalendarBody/CalendarRowDay/CalendarRowDay.js
View file @
c90e117a
...
@@ -25,8 +25,8 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
...
@@ -25,8 +25,8 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
const
sortedTasks
=
useMemo
(()
=>
{
const
sortedTasks
=
useMemo
(()
=>
{
if
(
availableTasks
.
length
)
{
if
(
availableTasks
.
length
)
{
const
newSortedArr
=
[...
availableTasks
].
sort
(
function
(
a
,
b
){
const
newSortedArr
=
[...
availableTasks
].
sort
(
function
(
a
,
b
){
const
durattionFirstDate
=
new
Date
(
a
.
dateTimeDue
).
getTime
()
-
new
Date
(
a
.
dateTimeStart
).
getTime
()
const
durattionFirstDate
=
a
.
infoForCell
.
endHour
-
a
.
infoForCell
.
startHour
const
durattionSecondDate
=
new
Date
(
b
.
dateTimeDue
).
getTime
()
-
new
Date
(
b
.
dateTimeStart
).
getTime
()
const
durattionSecondDate
=
b
.
infoForCell
.
endHour
-
b
.
infoForCell
.
startHour
return
durattionSecondDate
-
durattionFirstDate
;
return
durattionSecondDate
-
durattionFirstDate
;
})
})
return
newSortedArr
return
newSortedArr
...
@@ -104,7 +104,7 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
...
@@ -104,7 +104,7 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
// if (boxes[boxes.length -1]?.task === null) {
// if (boxes[boxes.length -1]?.task === null) {
// boxes[boxes.length -1].xs += xs
// boxes[boxes.length -1].xs += xs
// } else {
// } else {
boxes
.
push
({
xs
:
xs
,
task
:
null
})
boxes
.
push
({
xs
:
xs
,
task
:
null
,
hour
:
line
[
i
]
})
// }
// }
}
else
{
}
else
{
const
task
=
sortedTasks
[
line
[
i
].
split
(
'-'
)[
1
]]
const
task
=
sortedTasks
[
line
[
i
].
split
(
'-'
)[
1
]]
...
@@ -131,8 +131,6 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
...
@@ -131,8 +131,6 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
e
.
preventDefault
();
e
.
preventDefault
();
dragTaskHandler
(
day
.
dayNumber
,
currentHour
)
dragTaskHandler
(
day
.
dayNumber
,
currentHour
)
}
}
console
.
log
(
sortedTasks
)
console
.
log
(
linesInDay
)
return
<>
return
<>
<
Grid
<
Grid
...
@@ -187,7 +185,7 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
...
@@ -187,7 +185,7 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
}
else
{
}
else
{
return
(
<
Grid
return
(
<
Grid
onDragOver
=
{(
e
)
=>
{
dragOverHandler
(
e
)}}
onDragOver
=
{(
e
)
=>
{
dragOverHandler
(
e
)}}
onDrop
=
{(
e
)
=>
{
dropHandler
(
e
,
parseInt
(
hours
[
index
])
)}}
onDrop
=
{(
e
)
=>
{
dropHandler
(
e
,
box
.
hour
)}}
item
xs
=
{
box
.
xs
}
sx
=
{{
height
:
'35px'
,
backgroundColor
:
'rgb(0,0,0,0)'
}}
>
item
xs
=
{
box
.
xs
}
sx
=
{{
height
:
'35px'
,
backgroundColor
:
'rgb(0,0,0,0)'
}}
>
<
/Grid>
)
<
/Grid>
)
...
...
planner-front/src/components/MonthCalendarBody/MonthCalendarBody.js
View file @
c90e117a
...
@@ -13,10 +13,11 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, current
...
@@ -13,10 +13,11 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, current
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
,});
const
handleOpen
=
(
e
)
=>
{
const
handleOpen
=
(
e
)
=>
{
console
.
log
(
e
)
setModal
(
{
setModal
(
{
open
:
true
,
open
:
true
,
yPage
:
e
.
page
Y
,
yPage
:
e
.
client
Y
,
xPage
:
e
.
page
X
,
xPage
:
e
.
client
X
,
yDivClick
:
e
.
nativeEvent
.
offsetY
,
yDivClick
:
e
.
nativeEvent
.
offsetY
,
xDivClick
:
e
.
nativeEvent
.
offsetX
,
xDivClick
:
e
.
nativeEvent
.
offsetX
,
yDiv
:
e
.
target
.
offsetHeight
,
yDiv
:
e
.
target
.
offsetHeight
,
...
@@ -40,6 +41,7 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, current
...
@@ -40,6 +41,7 @@ function MonthCalendarBody({month, year, tasks, createTaskInCellHandler, current
}
}
},
[
divRef
.
current
?.
offsetHeight
,
hourFormat
,
month
,
tasks
]);
},
[
divRef
.
current
?.
offsetHeight
,
hourFormat
,
month
,
tasks
]);
return
(
return
(
<
div
ref
=
{
divRef
}
style
=
{{
marginBottom
:
'30px'
}}
>
<
div
ref
=
{
divRef
}
style
=
{{
marginBottom
:
'30px'
}}
>
<
CalendarRow
<
CalendarRow
...
...
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