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
85ebd8db
Commit
85ebd8db
authored
Dec 17, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#111
Вывел задачу через абсолюты
parent
752c4a67
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
39 deletions
+113
-39
CalendarColumnDayWeek.js
...lendarBody/CalendarColumnDayWeek/CalendarColumnDayWeek.js
+108
-0
CalendarRowDayWeek.js
...WeekCalendarBody/CalendarRowDayWeek/CalendarRowDayWeek.js
+0
-33
WeekCalendarBody.js
...lendars/WeekCalendar/WeekCalendarBody/WeekCalendarBody.js
+4
-4
ModalTask.js
planner-front/src/components/UI/ModalTask/ModalTask.js
+1
-2
No files found.
planner-front/src/components/Calendars/WeekCalendar/WeekCalendarBody/CalendarColumnDayWeek/CalendarColumnDayWeek.js
0 → 100644
View file @
85ebd8db
import
{
useMemo
}
from
"react"
;
import
{
getHoursInDayNumbers
,
getAvailableTasks
,
getLinesInDay
,
getSortedTasks
}
from
"../../../../../helpers/CalendarHelpers"
;
import
CalendarStandartCell
from
"../../../CalendarStandartCell/CalendarStandartCell"
;
import
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
Grid
}
from
"@mui/material"
;
function
CalendarColumnDayWeek
({
hoursInDay
,
tasks
,
month
,
year
,
day
,
hourFormat
})
{
const
[
columnDayHeight
,
setColumnDayHeight
]
=
useState
(
0
)
const
dayColumnRef
=
useRef
(
''
)
useEffect
(()
=>
{
setColumnDayHeight
(
prev
=>
dayColumnRef
.
current
.
offsetHeight
)
},
[
hourFormat
])
const
hours
=
useMemo
(()
=>
{
return
getHoursInDayNumbers
(
hoursInDay
)
},
[
hoursInDay
])
const
taskStyle
=
{
backgroundColor
:
'red'
,
height
:
`
${
columnDayHeight
/
hours
.
length
}
px`
,
width
:
'96%'
,
margin
:
'0 auto'
,
position
:
'absolute'
,
bottom
:
0
,
marginLeft
:
'auto'
,
marginRight
:
'auto'
,
left
:
'0'
,
right
:
'0'
,
}
const
availableTasks
=
useMemo
(()
=>
{
return
getAvailableTasks
(
tasks
,
year
,
month
,
day
)
},
[
tasks
,
month
,
year
,
day
])
const
sortedTasks
=
useMemo
(()
=>
{
return
getSortedTasks
(
availableTasks
)
},
[
availableTasks
])
console
.
log
(
columnDayHeight
)
const
linesInDay
=
useMemo
(()
=>
{
return
getLinesInDay
(
availableTasks
,
sortedTasks
,
hoursInDay
,
hours
,
hourFormat
)
},
[
availableTasks
,
hourFormat
,
hours
,
hoursInDay
,
sortedTasks
])
const
getBoxesInLine
=
(
line
,
hoursInDay
,
sortedTasks
)
=>
{
if
(
line
)
{
let
xs
=
12
/
hoursInDay
.
length
const
boxes
=
[]
for
(
let
i
=
0
;
i
<
line
.
length
;
i
++
)
{
if
(
!
isNaN
(
line
[
i
]))
{
}
else
{
const
task
=
sortedTasks
[
line
[
i
].
split
(
'-'
)[
1
]]
const
taskIsThere
=
boxes
.
find
((
taskFind
)
=>
{
if
(
taskFind
?.
task
?.
id
===
task
.
id
)
return
taskFind
return
false
})
const
step
=
columnDayHeight
/
hours
.
length
if
(
taskIsThere
)
{
taskIsThere
.
lastHour
=
i
taskIsThere
.
height
+=
step
}
else
{
boxes
.
push
({
top
:
step
*
i
,
height
:
step
,
firstHour
:
i
,
lastHour
:
i
,
task
:
sortedTasks
[
line
[
i
].
split
(
'-'
)[
1
]]})
}
}
}
return
boxes
}
}
console
.
log
(
getBoxesInLine
(
linesInDay
[
0
],
hoursInDay
,
sortedTasks
))
return
(
<>
<
Grid
item
xs
=
{
12
/
7
}
ref
=
{
dayColumnRef
}
sx
=
{{
position
:
'relative'
}}
>
{
getBoxesInLine
(
linesInDay
[
0
],
hoursInDay
,
sortedTasks
)?.
map
((
task
)
=>
{
return
(
<
div
style
=
{{
backgroundColor
:
'red'
,
height
:
`
${
task
.
height
}
px`
,
width
:
'96%'
,
margin
:
'0 auto'
,
position
:
'absolute'
,
top
:
task
.
top
,
marginLeft
:
'auto'
,
marginRight
:
'auto'
,
left
:
'0'
,
right
:
'0'
,
}}
>
<
/div>
)
})}
{
hoursInDay
?.
map
((
hour
,
i
)
=>
{
return
(
<
CalendarStandartCell
key
=
{
i
}
week
=
{
true
}
>
<
/CalendarStandartCell
>
)
})}
<
/Grid
>
<
/>
)
;
}
export
default
CalendarColumnDayWeek
;
\ No newline at end of file
planner-front/src/components/Calendars/WeekCalendar/WeekCalendarBody/CalendarRowDayWeek/CalendarRowDayWeek.js
deleted
100644 → 0
View file @
752c4a67
import
{
useMemo
}
from
"react"
;
import
{
getHoursInDayNumbers
,
getAvailableTasks
,
getLinesInDay
,
getSortedTasks
}
from
"../../../../../helpers/CalendarHelpers"
;
import
CalendarStandartCell
from
"../../../CalendarStandartCell/CalendarStandartCell"
;
function
CalendarRowDayWeek
({
hoursInDay
,
tasks
,
month
,
year
,
day
,
hourFormat
})
{
const
hours
=
useMemo
(()
=>
{
return
getHoursInDayNumbers
(
hoursInDay
)
},
[
hoursInDay
])
const
availableTasks
=
useMemo
(()
=>
{
return
getAvailableTasks
(
tasks
,
year
,
month
,
day
)
},
[
tasks
,
month
,
year
,
day
])
const
sortedTasks
=
useMemo
(()
=>
{
return
getSortedTasks
(
availableTasks
)
},
[
availableTasks
])
const
linesInDay
=
useMemo
(()
=>
{
return
getLinesInDay
(
availableTasks
,
sortedTasks
,
hoursInDay
,
hours
,
hourFormat
)
},
[
availableTasks
,
hourFormat
,
hours
,
hoursInDay
,
sortedTasks
])
return
(
<>
{
hoursInDay
?.
map
((
hour
,
i
)
=>
{
return
(
<
CalendarStandartCell
key
=
{
i
}
week
=
{
true
}
>
<
/CalendarStandartCell>
)
})}
<
/>
)
;
}
export
default
CalendarRowDayWeek
;
\ No newline at end of file
planner-front/src/components/Calendars/WeekCalendar/WeekCalendarBody/WeekCalendarBody.js
View file @
85ebd8db
...
@@ -3,11 +3,12 @@ import { Box } from "@mui/system";
...
@@ -3,11 +3,12 @@ import { Box } from "@mui/system";
import
CalendarRow
from
"../../CalendarRow/CalendarRow"
;
import
CalendarRow
from
"../../CalendarRow/CalendarRow"
;
import
CalendarSmallCell
from
"../../CalendarSmallCell/CalendarSmallCell"
;
import
CalendarSmallCell
from
"../../CalendarSmallCell/CalendarSmallCell"
;
import
CalendarStandartCell
from
"../../CalendarStandartCell/CalendarStandartCell"
;
import
CalendarStandartCell
from
"../../CalendarStandartCell/CalendarStandartCell"
;
import
Calendar
RowDayWeek
from
"./CalendarRowDayWeek/CalendarRow
DayWeek"
;
import
Calendar
ColumnDayWeek
from
"./CalendarColumnDayWeek/CalendarColumn
DayWeek"
;
import
{
getCurrentWeekDayString
}
from
"./Helpers"
;
import
{
getCurrentWeekDayString
}
from
"./Helpers"
;
function
WeekCalendarBody
({
week
,
hoursInDay
,
hourFormat
,
setHourFormat
,
date
,
tasks
})
{
function
WeekCalendarBody
({
week
,
hoursInDay
,
hourFormat
,
setHourFormat
,
date
,
tasks
})
{
return
(
return
(
<>
<>
<
Box
style
=
{{
marginBottom
:
'30px'
}}
>
<
Box
style
=
{{
marginBottom
:
'30px'
}}
>
...
@@ -47,8 +48,8 @@ function WeekCalendarBody({ week, hoursInDay, hourFormat, setHourFormat, date, t
...
@@ -47,8 +48,8 @@ function WeekCalendarBody({ week, hoursInDay, hourFormat, setHourFormat, date, t
<
CalendarRow
week
=
{
true
}
>
<
CalendarRow
week
=
{
true
}
>
{
week
?.
map
((
weekDay
,
i
)
=>
{
{
week
?.
map
((
weekDay
,
i
)
=>
{
return
(
return
(
<
Grid
item
key
=
{
i
}
xs
=
{
12
/
week
.
length
}
>
<
CalendarColumnDayWeek
<
CalendarRowDayWeek
key
=
{
i
}
hoursInDay
=
{
hoursInDay
}
hoursInDay
=
{
hoursInDay
}
tasks
=
{
tasks
}
tasks
=
{
tasks
}
month
=
{
date
.
month
}
month
=
{
date
.
month
}
...
@@ -56,7 +57,6 @@ function WeekCalendarBody({ week, hoursInDay, hourFormat, setHourFormat, date, t
...
@@ -56,7 +57,6 @@ function WeekCalendarBody({ week, hoursInDay, hourFormat, setHourFormat, date, t
day
=
{
weekDay
}
day
=
{
weekDay
}
hourFormat
=
{
hourFormat
}
hourFormat
=
{
hourFormat
}
/
>
/
>
<
/Grid
>
)
)
})}
})}
<
/CalendarRow
>
<
/CalendarRow
>
...
...
planner-front/src/components/UI/ModalTask/ModalTask.js
View file @
85ebd8db
...
@@ -23,7 +23,6 @@ export default function ModalTask({modal, handleClose, children}) {
...
@@ -23,7 +23,6 @@ export default function ModalTask({modal, handleClose, children}) {
window
.
removeEventListener
(
'resize'
,
detectSize
)
window
.
removeEventListener
(
'resize'
,
detectSize
)
}
}
},
[
windowDimenion
])
},
[
windowDimenion
])
const
modalRef
=
useRef
(
''
)
const
getYCordinatesToModal
=
()
=>
{
const
getYCordinatesToModal
=
()
=>
{
...
@@ -63,7 +62,7 @@ export default function ModalTask({modal, handleClose, children}) {
...
@@ -63,7 +62,7 @@ export default function ModalTask({modal, handleClose, children}) {
aria
-
describedby
=
"modal-modal-description"
aria
-
describedby
=
"modal-modal-description"
BackdropProps
=
{{
style
:
{
backgroundColor
:
'rgba(255,255,255, 0)'
}
}}
BackdropProps
=
{{
style
:
{
backgroundColor
:
'rgba(255,255,255, 0)'
}
}}
>
>
<
Box
sx
=
{
style
}
ref
=
{
modalRef
}
>
<
Box
sx
=
{
style
}
>
{
children
}
{
children
}
<
/Box
>
<
/Box
>
<
/Modal
>
<
/Modal
>
...
...
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