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
0fc9b731
Commit
0fc9b731
authored
Nov 17, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#55
Начал изменять логику отображения
parent
da037e57
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
2 deletions
+43
-2
CalendarRowDay.js
...onents/MonthCalendarBody/CalendarRowDay/CalendarRowDay.js
+43
-2
No files found.
planner-front/src/components/MonthCalendarBody/CalendarRowDay/CalendarRowDay.js
View file @
0fc9b731
...
@@ -95,6 +95,33 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
...
@@ -95,6 +95,33 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
return
lines
return
lines
},
[
availableTasks
.
length
,
hourFormat
,
hours
,
hoursInDay
,
sortedTasks
])
},
[
availableTasks
.
length
,
hourFormat
,
hours
,
hoursInDay
,
sortedTasks
])
const
getBoxesInLine
=
(
line
)
=>
{
if
(
line
)
{
let
xs
=
12
/
hoursInDay
.
length
const
boxes
=
[]
for
(
let
i
=
0
;
i
<
line
.
length
;
i
++
)
{
if
(
!
isNaN
(
line
[
i
]))
{
if
(
boxes
[
boxes
.
length
-
1
]?.
task
===
null
)
{
boxes
[
boxes
.
length
-
1
].
xs
+=
xs
}
else
{
boxes
.
push
({
xs
:
xs
,
task
:
null
})
}
}
else
{
const
task
=
sortedTasks
[
line
[
i
].
split
(
'-'
)[
1
]]
const
taskIsThere
=
boxes
.
find
((
taskFind
)
=>
{
if
(
taskFind
?.
task
?.
id
===
task
.
id
)
return
taskFind
})
if
(
taskIsThere
)
{
taskIsThere
.
xs
+=
xs
}
else
{
boxes
.
push
({
xs
:
xs
,
task
:
sortedTasks
[
line
[
i
].
split
(
'-'
)[
1
]]})
}
}
}
return
boxes
}
}
return
<>
return
<>
<
Grid
<
Grid
container
container
...
@@ -120,7 +147,7 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
...
@@ -120,7 +147,7 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
handleOpen
=
{
handleOpen
}
handleOpen
=
{
handleOpen
}
modal
=
{
modal
}
modal
=
{
modal
}
>
>
<
CalendarTask
{
/*
<CalendarTask
setCurrentTask={setCurrentTask}
setCurrentTask={setCurrentTask}
hours={hour}
hours={hour}
modal={modal}
modal={modal}
...
@@ -129,10 +156,24 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
...
@@ -129,10 +156,24 @@ const CalendarRowDay = ({xs, hoursInDay, createTaskInCellHandler, currentTask, h
currentTask={currentTask}
currentTask={currentTask}
linesForCell={linesForCell.length ? linesForCell : null}
linesForCell={linesForCell.length ? linesForCell : null}
sortedTasks={sortedTasks}
sortedTasks={sortedTasks}
/>
/>
*/
}
<
/CalendarStandartCell
>
<
/CalendarStandartCell
>
)
)
})}
})}
{
linesInDay
?.
map
((
line
)
=>
{
const
boxes
=
getBoxesInLine
(
line
)
return
(
<
Grid
container
sx
=
{{
backgroundColor
:
'grey'
,
height
:
'40px'
,
borderBottom
:
'1px solid red'
}}
>
{
boxes
.
map
((
box
)
=>
{
if
(
box
.
task
)
{
return
(
<
Grid
item
xs
=
{
box
.
xs
}
sx
=
{{
backgroundColor
:
'green'
,
height
:
'40px'
}}
><
/Grid>
)
}
else
{
return
(
<
Grid
item
xs
=
{
box
.
xs
}
sx
=
{{
backgroundColor
:
'white'
,
height
:
'40px'
}}
><
/Grid>
)
}
})}
<
/Grid>
)
})}
<
/Grid
>
<
/Grid
>
<
/
>
<
/
>
};
};
...
...
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