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
8e13b66b
Commit
8e13b66b
authored
Dec 17, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#111
Вывел сразу все задачи
parent
85ebd8db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
23 deletions
+85
-23
CalendarColumnDayWeek.js
...lendarBody/CalendarColumnDayWeek/CalendarColumnDayWeek.js
+43
-23
CalendarWeekTask.js
...alendarColumnDayWeek/CalendarWeekTask/CalendarWeekTask.js
+42
-0
No files found.
planner-front/src/components/Calendars/WeekCalendar/WeekCalendarBody/CalendarColumnDayWeek/CalendarColumnDayWeek.js
View file @
8e13b66b
...
@@ -3,6 +3,7 @@ import { getHoursInDayNumbers, getAvailableTasks, getLinesInDay, getSortedTasks
...
@@ -3,6 +3,7 @@ import { getHoursInDayNumbers, getAvailableTasks, getLinesInDay, getSortedTasks
import
CalendarStandartCell
from
"../../../CalendarStandartCell/CalendarStandartCell"
;
import
CalendarStandartCell
from
"../../../CalendarStandartCell/CalendarStandartCell"
;
import
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
Grid
}
from
"@mui/material"
;
import
{
Grid
}
from
"@mui/material"
;
import
CalendarWeekTask
from
"./CalendarWeekTask/CalendarWeekTask"
;
...
@@ -39,21 +40,20 @@ function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat
...
@@ -39,21 +40,20 @@ function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat
return
getSortedTasks
(
availableTasks
)
return
getSortedTasks
(
availableTasks
)
},
[
availableTasks
])
},
[
availableTasks
])
console
.
log
(
columnDayHeight
)
const
linesInDay
=
useMemo
(()
=>
{
const
linesInDay
=
useMemo
(()
=>
{
return
getLinesInDay
(
availableTasks
,
sortedTasks
,
hoursInDay
,
hours
,
hourFormat
)
return
getLinesInDay
(
availableTasks
,
sortedTasks
,
hoursInDay
,
hours
,
hourFormat
)
},
[
availableTasks
,
hourFormat
,
hours
,
hoursInDay
,
sortedTasks
])
},
[
availableTasks
,
hourFormat
,
hours
,
hoursInDay
,
sortedTasks
])
const
getBoxesInLine
=
(
line
,
hoursInDay
,
sortedTasks
)
=>
{
const
getBoxesInLine
=
(
line
,
hoursInDay
,
sortedTasks
,
linesInDay
)
=>
{
if
(
line
)
{
if
(
line
)
{
let
xs
=
12
/
hoursInDay
.
length
let
xs
=
12
/
hoursInDay
.
length
const
boxes
=
[]
const
boxes
=
[]
for
(
let
i
=
0
;
i
<
line
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
line
.
length
;
i
++
)
{
if
(
!
isNaN
(
line
[
i
]))
{
if
(
!
isNaN
(
line
[
i
]))
{
}
else
{
}
else
{
const
task
=
sortedTasks
[
line
[
i
].
split
(
'-'
)[
1
]]
const
task
=
sortedTasks
[
line
[
i
].
split
(
'-'
)[
1
]]
const
taskIsThere
=
boxes
.
find
((
taskFind
)
=>
{
const
taskIsThere
=
boxes
.
find
((
taskFind
)
=>
{
if
(
taskFind
?.
task
?.
id
===
task
.
id
)
return
taskFind
if
(
taskFind
?.
task
?.
id
===
task
.
id
)
return
taskFind
return
false
return
false
})
})
...
@@ -62,37 +62,57 @@ function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat
...
@@ -62,37 +62,57 @@ function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat
taskIsThere
.
lastHour
=
i
taskIsThere
.
lastHour
=
i
taskIsThere
.
height
+=
step
taskIsThere
.
height
+=
step
}
else
{
}
else
{
let
tasksInHour
=
0
for
(
let
line
of
linesInDay
)
{
if
(
isNaN
(
line
[
i
]))
{
tasksInHour
++
}
}
boxes
.
push
({
boxes
.
push
({
top
:
step
*
i
,
tasksInHour
:
tasksInHour
,
top
:
step
*
i
,
height
:
step
,
height
:
step
,
firstHour
:
i
,
firstHour
:
i
,
lastHour
:
i
,
lastHour
:
i
,
task
:
sortedTasks
[
line
[
i
].
split
(
'-'
)[
1
]]})
task
:
sortedTasks
[
line
[
i
].
split
(
'-'
)[
1
]]
})
}
}
}
}
}
}
return
boxes
return
boxes
}
}
}
}
console
.
log
(
getBoxesInLine
(
linesInDay
[
0
],
hoursInDay
,
sortedTasks
))
const
arr
=
[
'red'
,
'blue'
,
'yellow'
,
'purple'
,
'green'
]
return
(
<>
return
(
<>
<
Grid
item
xs
=
{
12
/
7
}
ref
=
{
dayColumnRef
}
sx
=
{{
position
:
'relative'
}}
>
<
Grid
item
xs
=
{
12
/
7
}
ref
=
{
dayColumnRef
}
sx
=
{{
position
:
'relative'
}}
>
{
getBoxesInLine
(
linesInDay
[
0
],
hoursInDay
,
sortedTasks
)?.
map
((
task
)
=>
{
{
linesInDay
?.
map
((
line
,
i
)
=>
{
return
(
const
boxes
=
getBoxesInLine
(
line
,
hoursInDay
,
sortedTasks
,
linesInDay
)
<
div
style
=
{{
return
(
<>
backgroundColor
:
'red'
,
{
boxes
.
map
((
task
,
index
)
=>
{
height
:
`
${
task
.
height
}
px`
,
const
amount
=
task
.
tasksInHour
width
:
'96%'
,
const
oneTaskPrecentWidth
=
100
/
amount
margin
:
'0 auto'
,
const
left
=
oneTaskPrecentWidth
*
dayColumnRef
.
current
.
offsetWidth
/
100
*
i
position
:
'absolute'
,
const
oneTaskWidth
=
dayColumnRef
.
current
.
offsetWidth
-
(
oneTaskPrecentWidth
*
dayColumnRef
.
current
.
offsetWidth
/
100
)
*
i
top
:
task
.
top
,
const
zIndex
=
10
+
i
marginLeft
:
'auto'
,
return
(
marginRight
:
'auto'
,
<
CalendarWeekTask
left
:
'0'
,
key
=
{
index
}
right
:
'0'
,
width
=
{
oneTaskWidth
}
}}
>
height
=
{
task
.
height
}
left
=
{
left
}
<
/div>
)
task
=
{
task
.
task
}
top
=
{
task
.
top
}
zIndex
=
{
zIndex
}
>
<
/CalendarWeekTask
>
)
})}
<
/>
)
})}
})}
{
hoursInDay
?.
map
((
hour
,
i
)
=>
{
{
hoursInDay
?.
map
((
hour
,
i
)
=>
{
return
(
return
(
...
...
planner-front/src/components/Calendars/WeekCalendar/WeekCalendarBody/CalendarColumnDayWeek/CalendarWeekTask/CalendarWeekTask.js
0 → 100644
View file @
8e13b66b
import
{
Box
}
from
"@mui/material"
import
{
useEffect
,
useState
}
from
"react"
function
CalendarWeekTask
({
height
,
width
,
left
,
top
,
task
,
zIndex
})
{
const
[
color
,
setColor
]
=
useState
(
''
)
useEffect
(()
=>
{
if
(
task
.
priority
)
{
if
(
task
.
priority
===
'A'
)
setColor
(
'rgb(32, 138, 250)'
)
if
(
task
.
priority
===
'B'
)
setColor
(
'lightgreen'
)
if
(
task
.
priority
===
'C'
)
setColor
(
'yellow'
)
}
else
{
setColor
(
'rgb(171, 157, 157);'
)
}
},
[
task
])
const
styles
=
{
borderRadius
:
'5px'
,
border
:
'1px solid black'
,
backgroundColor
:
color
,
height
:
`
${
height
}
px`
,
width
:
`
${
width
}
px`
,
position
:
'absolute'
,
left
:
`
${
left
}
px`
,
top
:
top
,
zIndex
:
zIndex
,
textAlign
:
'left'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}
return
(
<
Box
sx
=
{
styles
}
>
<
span
style
=
{{
position
:
'absolute'
,
textOverflow
:
'ellipsis'
,
padding
:
'5px 0 0 10px'
}}
>
{
task
.
title
}
<
/span
>
<
/Box>
)
;
}
export
default
CalendarWeekTask
;
\ No newline at end of file
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