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
17b16f74
Commit
17b16f74
authored
Dec 29, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#135
Реализовал создание копий задачи
parent
ad2aeb04
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
29 deletions
+46
-29
CreateCopyTasksModeBlock.js
...dars/CreateCopyTasksModeBlock/CreateCopyTasksModeBlock.js
+2
-2
CalendarStandartCell.js
...Calendars/UI/CalendarStandartCell/CalendarStandartCell.js
+2
-2
CalendarColumnDayWeek.js
...lendarBody/CalendarColumnDayWeek/CalendarColumnDayWeek.js
+2
-1
WeekCalendarBody.js
...lendars/WeekCalendar/WeekCalendarBody/WeekCalendarBody.js
+2
-1
WeekCalendar.js
planner-front/src/containers/WeekCalendar/WeekCalendar.js
+38
-23
No files found.
planner-front/src/components/Calendars/CreateCopyTasksModeBlock/CreateCopyTasksModeBlock.js
View file @
17b16f74
...
...
@@ -21,10 +21,10 @@ const CreateCopyTasksModeBlock = ({ copyMode, copyModeReturn, copyModeStay }) =
return
(
<>
{
copyMode
?
<
Box
sx
=
{
style
}
>
<
Button
onClick
=
{
copyModeStay
}
>
<
Button
onClick
=
{
copyModeStay
}
sx
=
{{
fontWeight
:
800
}}
>
Остаться
<
/Button
>
<
Button
onClick
=
{
copyModeReturn
}
>
<
Button
onClick
=
{
copyModeReturn
}
sx
=
{{
fontWeight
:
800
}}
>
Вернуться
<
/Button
>
<
/Box
>
...
...
planner-front/src/components/Calendars/UI/CalendarStandartCell/CalendarStandartCell.js
View file @
17b16f74
...
...
@@ -3,7 +3,7 @@ import { memo, useEffect, useState } from "react";
import
DefaultTask
from
"../DefaultTask/DefaultTask"
;
const
heightCell
=
40
const
CalendarStandartCell
=
({
children
,
xs
,
hours
,
dayNumber
,
createTaskInCellHandler
,
handleOpen
,
modal
,
dragTaskHandler
,
linesInDay
,
week
,
copyTask
,
createCopyTask
,
month
,
year
})
=>
{
const
CalendarStandartCell
=
({
children
,
xs
,
hours
,
dayNumber
,
createTaskInCellHandler
,
handleOpen
,
modal
,
dragTaskHandler
,
linesInDay
,
week
,
copyTask
,
createCopyTask
,
month
,
year
,
copyMode
})
=>
{
const
[
isThisCell
,
setIsThisCell
]
=
useState
(
false
)
const
[
top
,
setTop
]
=
useState
(
0
)
const
cellClass
=
{
...
...
@@ -49,7 +49,7 @@ const CalendarStandartCell = ({ children, xs, hours, dayNumber, createTaskInCell
setTop
(
40
*
Math
.
ceil
((
e
.
nativeEvent
.
offsetY
-
5
)
/
40
-
1
))
}
}
if
(
copyTask
)
{
if
(
copyTask
||
copyMode
.
working
)
{
createCopyTask
(
dayNumber
,
parseInt
(
hours
.
split
(
':'
)[
0
]),
month
,
year
)
}
else
{
createTaskInCellHandler
(
dayNumber
,
hours
,
month
,
year
);
...
...
planner-front/src/components/Calendars/WeekCalendar/WeekCalendarBody/CalendarColumnDayWeek/CalendarColumnDayWeek.js
View file @
17b16f74
...
...
@@ -8,7 +8,7 @@ import { getTasksWithInfoForPosition, getWidthLeftZIndex } from "./Helpers";
function
CalendarColumnDayWeek
({
hoursInDay
,
tasks
,
month
,
year
,
day
,
hourFormat
,
handleOpen
,
setCurrentTask
,
copyTask
,
setCopyTask
,
createCopyTask
,
createTaskInCellHandler
,
modal
,
dragTaskHandler
})
{
function
CalendarColumnDayWeek
({
hoursInDay
,
tasks
,
month
,
year
,
day
,
hourFormat
,
handleOpen
,
setCurrentTask
,
copyTask
,
setCopyTask
,
createCopyTask
,
createTaskInCellHandler
,
modal
,
dragTaskHandler
,
copyMode
})
{
const
[
columnDaySize
,
setColumnDaySize
]
=
useState
({
width
:
0
,
height
:
0
})
...
...
@@ -84,6 +84,7 @@ function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat
month
=
{
month
}
year
=
{
year
}
dragTaskHandler
=
{
dragTaskHandler
}
copyMode
=
{
copyMode
}
>
<
/CalendarStandartCell
>
)
...
...
planner-front/src/components/Calendars/WeekCalendar/WeekCalendarBody/WeekCalendarBody.js
View file @
17b16f74
...
...
@@ -31,7 +31,7 @@ function WeekCalendarBody({ week, hoursInDay, hourFormat, setHourFormat, date, t
return
(
<>
<
Box
style
=
{{
marginBottom
:
copyMode
?
'100px'
:
'30px'
}}
>
<
Box
style
=
{{
marginBottom
:
copyMode
.
working
?
'100px'
:
'30px'
}}
>
<
Box
style
=
{{
position
:
'sticky'
,
top
:
'0px'
,
zIndex
:
'10'
,
backgroundColor
:
'lightgrey'
}}
>
<
CalendarRow
>
...
...
@@ -84,6 +84,7 @@ function WeekCalendarBody({ week, hoursInDay, hourFormat, setHourFormat, date, t
setCopyTask
=
{
setCopyTask
}
createCopyTask
=
{
createCopyTask
}
dragTaskHandler
=
{
dragTaskHandler
}
copyMode
=
{
copyMode
}
/
>
)
})}
...
...
planner-front/src/containers/WeekCalendar/WeekCalendar.js
View file @
17b16f74
...
...
@@ -19,7 +19,7 @@ function WeekCalendar() {
const
navigate
=
useNavigate
()
const
{
calendarTasks
,
copyMode
}
=
useSelector
(
state
=>
state
.
tasks
);
const
{
user
,
currentCalendarDisplayName
}
=
useSelector
(
state
=>
state
.
users
);
const
{
allUserProjects
}
=
useSelector
(
state
=>
state
.
projects
)
const
{
allUserProjects
}
=
useSelector
(
state
=>
state
.
projects
)
console
.
log
(
copyMode
)
const
[
weekGoal
,
setWeekGoal
]
=
useState
(
'Наладить режим сна'
)
const
[
weekPriorities
,
setWeekPriorities
]
=
useState
({
priorityOne
:
'Один'
,
priorityTwo
:
'Два'
,
priorityThree
:
'Три'
})
...
...
@@ -31,13 +31,13 @@ function WeekCalendar() {
const
[
userCalendarId
,
setUserCalendarId
]
=
useState
(
null
)
const
[
modal
,
setModal
]
=
useState
(
false
)
const
[
userId
,
setUserId
]
=
useState
(
''
)
console
.
log
(
copyTask
)
useEffect
(()
=>
{
const
year
=
new
Date
().
getFullYear
()
const
month
=
new
Date
().
getMonth
()
const
currentDay
=
moment
().
date
()
setDateNow
({
year
:
year
,
month
:
month
,
currentDay
:
currentDay
})
return
()
=>
{
return
()
=>
{
dispatch
(
deactivateCreateCopyTasksMode
())
}
},
[
dispatch
,
user
.
id
])
...
...
@@ -205,25 +205,40 @@ function WeekCalendar() {
},
[
currentTask
,
dispatch
,
user
.
id
,
userId
])
const
createCopyTask
=
useCallback
(
async
(
dayNumber
,
hour
,
month
,
year
)
=>
{
const
hourDiff
=
copyTask
.
infoForCell
.
endHour
-
copyTask
.
infoForCell
.
startHour
const
lastHour
=
hoursInDay
[
hoursInDay
.
length
-
1
].
split
(
':'
)[
0
]
let
due
if
(
hour
+
hourDiff
>=
lastHour
)
{
due
=
dateToISOLikeButLocal
(
new
Date
(
year
,
month
,
dayNumber
,
lastHour
,
59
))
if
(
copyMode
.
working
)
{
const
hourDiff
=
hourFormat
?
0
:
1
const
due
=
dateToISOLikeButLocal
(
new
Date
(
year
,
month
,
dayNumber
,
hour
+
hourDiff
,
59
))
const
start
=
dateToISOLikeButLocal
(
new
Date
(
year
,
month
,
dayNumber
,
hour
,
0
))
const
newTask
=
{
...
copyMode
.
task
,
dateTimeStart
:
start
,
dateTimeDue
:
due
,
taskId
:
copyMode
.
task
.
id
}
delete
newTask
.
infoForCell
delete
newTask
.
id
await
dispatch
(
addCopyCalendarTask
(
newTask
,
userId
))
}
else
{
due
=
dateToISOLikeButLocal
(
new
Date
(
year
,
month
,
dayNumber
,
hour
+
hourDiff
,
59
))
}
const
start
=
dateToISOLikeButLocal
(
new
Date
(
year
,
month
,
dayNumber
,
hour
,
0
))
const
newTask
=
{
...
copyTask
,
dateTimeStart
:
start
,
dateTimeDue
:
due
,
taskId
:
copyTask
.
mainTaskId
const
hourDiff
=
copyTask
.
infoForCell
.
endHour
-
copyTask
.
infoForCell
.
startHour
const
lastHour
=
hoursInDay
[
hoursInDay
.
length
-
1
].
split
(
':'
)[
0
]
let
due
if
(
hour
+
hourDiff
>=
lastHour
)
{
due
=
dateToISOLikeButLocal
(
new
Date
(
year
,
month
,
dayNumber
,
lastHour
,
59
))
}
else
{
due
=
dateToISOLikeButLocal
(
new
Date
(
year
,
month
,
dayNumber
,
hour
+
hourDiff
,
59
))
}
const
start
=
dateToISOLikeButLocal
(
new
Date
(
year
,
month
,
dayNumber
,
hour
,
0
))
const
newTask
=
{
...
copyTask
,
dateTimeStart
:
start
,
dateTimeDue
:
due
,
taskId
:
copyTask
.
mainTaskId
}
delete
newTask
.
infoForCell
delete
newTask
.
id
await
dispatch
(
addCopyCalendarTask
(
newTask
,
userId
))
setCopyTask
(
null
)
}
delete
newTask
.
infoForCell
delete
newTask
.
id
await
dispatch
(
addCopyCalendarTask
(
newTask
,
userId
))
setCopyTask
(
null
)
},
[
copyTask
,
dispatch
,
hoursInDay
,
userId
])
const
dragTaskHandler
=
useCallback
(
async
(
dayNumber
,
hour
,
month
,
year
)
=>
{
...
...
@@ -321,13 +336,13 @@ function WeekCalendar() {
copyTask
=
{
copyTask
}
setCopyTask
=
{
setCopyTask
}
dragTaskHandler
=
{
dragTaskHandler
}
copyMode
=
{
copyMode
.
working
}
copyMode
=
{
copyMode
}
/
>
<
CreateCopyTasksModeBlock
copyMode
=
{
copyMode
.
working
}
copyModeStay
=
{()
=>
{
copyModeStay
()
}}
copyModeReturn
=
{()
=>
{
copyModeReturn
()
}}
copyModeStay
=
{()
=>
{
copyModeStay
()
}}
copyModeReturn
=
{()
=>
{
copyModeReturn
()
}}
/
>
<
/
>
);
...
...
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