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
28b542ed
Commit
28b542ed
authored
Dec 12, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#103
Релизовал вывод информации чей это календарь
parent
1fba0e35
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
85 additions
and
33 deletions
+85
-33
users.ts
planner-api/src/routers/users.ts
+14
-0
CalendarModalContent.js
...ts/Calendars/CalendarModalContent/CalendarModalContent.js
+2
-2
MonthCalendarBody.js
...dars/MonthCalendar/MonthCalendarBody/MonthCalendarBody.js
+1
-1
MonthAndYearInfo.js
.../MonthCalendarHeader/MonthAndYearInfo/MonthAndYearInfo.js
+3
-2
MonthCalendarHeader.js
.../MonthCalendar/MonthCalendarHeader/MonthCalendarHeader.js
+21
-18
DefaultModal.js
planner-front/src/components/UI/DefaultModal/DefaultModal.js
+1
-1
MonthCalendar.js
planner-front/src/containers/MonthCalendar/MonthCalendar.js
+14
-3
WeekCalendar.js
planner-front/src/containers/WeekCalendar/WeekCalendar.js
+1
-1
userActionTypes.js
planner-front/src/store/actionTypes/userActionTypes.js
+3
-1
usersActions.js
planner-front/src/store/actions/usersActions.js
+19
-1
usersReducer.js
planner-front/src/store/reducers/usersReducer.js
+6
-3
No files found.
planner-api/src/routers/users.ts
View file @
28b542ed
...
@@ -7,6 +7,7 @@ import path from 'path';
...
@@ -7,6 +7,7 @@ import path from 'path';
import
{
config
}
from
"../config"
import
{
config
}
from
"../config"
import
{
Project
}
from
'../models/Project'
;
import
{
Project
}
from
'../models/Project'
;
import
{
Member
,
MemberRole
}
from
'../models/Member'
;
import
{
Member
,
MemberRole
}
from
'../models/Member'
;
import
{
auth
}
from
'../helpers'
;
const
router
:
Router
=
express
.
Router
();
const
router
:
Router
=
express
.
Router
();
const
dataSource
=
myDataSource
;
const
dataSource
=
myDataSource
;
...
@@ -35,6 +36,19 @@ const users = await dataSource
...
@@ -35,6 +36,19 @@ const users = await dataSource
return
res
.
send
({
users
})
return
res
.
send
({
users
})
})
})
//** return displayName of user, requested by userId */
router
.
get
(
'/display-name/:userId'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
const
{
userId
}
=
req
.
params
const
displayName
=
await
dataSource
.
createQueryBuilder
()
.
select
([
'user.displayName'
])
.
from
(
User
,
"user"
)
.
where
(
"user.id = :userId"
,
{
userId
})
.
getOne
()
if
(
!
displayName
)
return
res
.
status
(
404
).
send
({
message
:
'displayName not found'
})
return
res
.
send
(
displayName
)
})
//** return all users of DB */
//** return all users of DB */
router
.
get
(
'/all-fields/'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
router
.
get
(
'/all-fields/'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
...
...
planner-front/src/components/Calendars/
MonthCalendarModalContent/Month
CalendarModalContent.js
→
planner-front/src/components/Calendars/
CalendarModalContent/
CalendarModalContent.js
View file @
28b542ed
...
@@ -4,7 +4,7 @@ import { priorities } from "../../../constants";
...
@@ -4,7 +4,7 @@ import { priorities } from "../../../constants";
import
CustomSelect
from
'../../UI/СustomSelect/СustomSelect'
import
CustomSelect
from
'../../UI/СustomSelect/СustomSelect'
function
Month
CalendarModalContent
({
title
,
onChangeCurrentTaskHandler
,
description
,
priority
,
sendNewTaskHandler
,
deleteTaskHandler
,
startHour
,
endHour
})
{
function
CalendarModalContent
({
title
,
onChangeCurrentTaskHandler
,
description
,
priority
,
sendNewTaskHandler
,
deleteTaskHandler
,
startHour
,
endHour
})
{
return
(
<>
return
(
<>
<
TextField
<
TextField
id
=
"task-description-title"
id
=
"task-description-title"
...
@@ -61,4 +61,4 @@ function MonthCalendarModalContent({ title, onChangeCurrentTaskHandler, descript
...
@@ -61,4 +61,4 @@ function MonthCalendarModalContent({ title, onChangeCurrentTaskHandler, descript
<
/>
)
;
<
/>
)
;
}
}
export
default
memo
(
MonthCalendarModalContent
);
export
default
memo
(
CalendarModalContent
);
\ No newline at end of file
\ No newline at end of file
planner-front/src/components/Calendars/MonthCalendar/MonthCalendarBody/MonthCalendarBody.js
View file @
28b542ed
...
@@ -4,7 +4,7 @@ import CalendarRow from "../../CalendarRow/CalendarRow";
...
@@ -4,7 +4,7 @@ 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
ModalTask
from
"../../../UI/ModalTask/ModalTask"
import
ModalTask
from
"../../../UI/ModalTask/ModalTask"
import
MonthCalendarModalContent
from
"../../
MonthCalendarModalContent/Month
CalendarModalContent"
;
import
MonthCalendarModalContent
from
"../../
CalendarModalContent/
CalendarModalContent"
;
import
CalendarRowDay
from
"./CalendarRowDay/CalendarRowDay"
;
import
CalendarRowDay
from
"./CalendarRowDay/CalendarRowDay"
;
...
...
planner-front/src/components/Calendars/MonthCalendar/MonthCalendarHeader/MonthAndYearInfo/MonthAndYearInfo.js
View file @
28b542ed
...
@@ -12,7 +12,8 @@ function MonthAndYearInfo({ currentMonthString, year, incrementMonth, decrementM
...
@@ -12,7 +12,8 @@ function MonthAndYearInfo({ currentMonthString, year, incrementMonth, decrementM
flexGrow
:
1
,
flexGrow
:
1
,
display
:
'flex'
,
display
:
'flex'
,
alignItems
:
'center'
,
alignItems
:
'center'
,
gap
:
'10px'
gap
:
'10px'
,
marginBottom
:
'20px'
}}
}}
id
=
'test_month_info'
id
=
'test_month_info'
>
>
...
@@ -21,7 +22,7 @@ function MonthAndYearInfo({ currentMonthString, year, incrementMonth, decrementM
...
@@ -21,7 +22,7 @@ function MonthAndYearInfo({ currentMonthString, year, incrementMonth, decrementM
/
>
/
>
<
Box
sx
=
{{
flexBasis
:
'150px'
}}
>
<
Box
sx
=
{{
flexBasis
:
'150px'
}}
>
<
Typography
<
Typography
variant
=
"h
6
"
variant
=
"h
5
"
sx
=
{{
sx
=
{{
display
:
'flex'
,
display
:
'flex'
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
...
...
planner-front/src/components/Calendars/MonthCalendar/MonthCalendarHeader/MonthCalendarHeader.js
View file @
28b542ed
import
{
AppBar
,
Button
,
Toolbar
}
from
'@mui/material'
;
import
{
AppBar
,
Button
,
Toolbar
,
Typography
}
from
'@mui/material'
;
import
{
Box
}
from
'@mui/system'
;
import
{
Box
}
from
'@mui/system'
;
import
MonthAndYearInfo
from
'./MonthAndYearInfo/MonthAndYearInfo'
;
import
MonthAndYearInfo
from
'./MonthAndYearInfo/MonthAndYearInfo'
;
function
MonthCalendarHeader
({
currentMonthString
,
decrementMonth
,
incrementMonth
,
calendarType
,
onChangeWorkerHandler
,
onChangeCalendarTypeHandler
,
worker
,
year
,
setModal
})
{
function
MonthCalendarHeader
({
currentMonthString
,
decrementMonth
,
incrementMonth
,
calendarType
,
onChangeWorkerHandler
,
onChangeCalendarTypeHandler
,
worker
,
year
,
setModal
,
currentCalendarDisplayName
})
{
return
(
return
(
<>
<>
...
@@ -10,22 +10,25 @@ function MonthCalendarHeader({ currentMonthString, decrementMonth, incrementMont
...
@@ -10,22 +10,25 @@ function MonthCalendarHeader({ currentMonthString, decrementMonth, incrementMont
<
AppBar
position
=
"static"
>
<
AppBar
position
=
"static"
>
<
Toolbar
>
<
Toolbar
>
<
Box
>
<
Typography
variant
=
"h5"
sx
=
{{
margin
:
"20px 0 20px 0"
}}
>
Календарь
:
{
currentCalendarDisplayName
}
<
/Typography
>
<
MonthAndYearInfo
<
MonthAndYearInfo
currentMonthString
=
{
currentMonthString
}
currentMonthString
=
{
currentMonthString
}
decrementMonth
=
{
decrementMonth
}
decrementMonth
=
{
decrementMonth
}
incrementMonth
=
{
incrementMonth
}
incrementMonth
=
{
incrementMonth
}
year
=
{
year
}
year
=
{
year
}
/
>
/
>
<
/Box
>
<
div
style
=
{{
marginLeft
:
'20px'
}}
>
<
Button
<
Button
onClick
=
{()
=>
{
setModal
((
prevState
)
=>!
prevState
)
}}
onClick
=
{()
=>
{
setModal
((
prevState
)
=>
!
prevState
)
}}
color
=
"inherit"
color
=
"inherit"
size
=
"large"
size
=
"large"
sx
=
{{
marginLeft
:
'auto'
}}
>
>
Выбрать
сотрудника
Выбрать
сотрудника
<
/Button
>
<
/Button
>
<
/div
>
<
/Toolbar
>
<
/Toolbar
>
<
/AppBar
>
<
/AppBar
>
<
/Box
>
<
/Box
>
...
...
planner-front/src/components/UI/DefaultModal/DefaultModal.js
View file @
28b542ed
...
@@ -17,7 +17,7 @@ const style = {
...
@@ -17,7 +17,7 @@ const style = {
};
};
export
default
function
DefaultModal
({
modal
,
setModal
})
{
export
default
function
DefaultModal
({
modal
,
setModal
})
{
console
.
log
(
modal
)
const
handleClose
=
()
=>
setModal
(
false
);
const
handleClose
=
()
=>
setModal
(
false
);
return
(
return
(
...
...
planner-front/src/containers/MonthCalendar/MonthCalendar.js
View file @
28b542ed
import
{
useEffect
,
useCallback
,
useState
,
useMemo
}
from
'react'
;
import
{
useEffect
,
useCallback
,
useState
,
useMemo
}
from
'react'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useParams
}
from
'react-router-dom'
;
import
MonthCalendarBody
from
'../../components/Calendars/MonthCalendar/MonthCalendarBody/MonthCalendarBody'
;
import
MonthCalendarBody
from
'../../components/Calendars/MonthCalendar/MonthCalendarBody/MonthCalendarBody'
;
import
MonthCalendarHeader
from
'../../components/Calendars/MonthCalendar/MonthCalendarHeader/MonthCalendarHeader'
;
import
MonthCalendarHeader
from
'../../components/Calendars/MonthCalendar/MonthCalendarHeader/MonthCalendarHeader'
;
import
DefaultModal
from
'../../components/UI/DefaultModal/DefaultModal'
;
import
DefaultModal
from
'../../components/UI/DefaultModal/DefaultModal'
;
import
{
dateToISOLikeButLocal
,
getCurrentMonthString
,
getDaysInMonth
}
from
'../../helpers/CalendarHelpers'
;
import
{
dateToISOLikeButLocal
,
getCurrentMonthString
,
getDaysInMonth
}
from
'../../helpers/CalendarHelpers'
;
import
{
addCalendarTask
,
addCopyCalendarTask
,
deleteCalendarTask
,
editCalendarTask
,
fetchCalendarTasks
}
from
'../../store/actions/tasksActions'
;
import
{
addCalendarTask
,
addCopyCalendarTask
,
deleteCalendarTask
,
editCalendarTask
,
fetchCalendarTasks
}
from
'../../store/actions/tasksActions'
;
import
{
fetchCurrentCalendarDisplayName
}
from
'../../store/actions/usersActions'
;
function
MonthCalendar
()
{
function
MonthCalendar
()
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
{
calendarTasks
}
=
useSelector
(
state
=>
state
.
tasks
);
const
{
calendarTasks
}
=
useSelector
(
state
=>
state
.
tasks
);
const
user
=
useSelector
(
state
=>
state
.
users
?.
user
);
const
{
user
,
currentCalendarDisplayName
}
=
useSelector
(
state
=>
state
.
users
);
const
params
=
useParams
()
const
[
hourFormat
,
setHourFormat
]
=
useState
(
false
);
const
[
hourFormat
,
setHourFormat
]
=
useState
(
false
);
const
[
dateNow
,
setDateNow
]
=
useState
({
month
:
''
,
year
:
''
})
const
[
dateNow
,
setDateNow
]
=
useState
({
month
:
''
,
year
:
''
})
...
@@ -26,8 +29,15 @@ function MonthCalendar() {
...
@@ -26,8 +29,15 @@ function MonthCalendar() {
month
:
new
Date
().
getMonth
(),
month
:
new
Date
().
getMonth
(),
year
:
new
Date
().
getFullYear
(),
year
:
new
Date
().
getFullYear
(),
})
})
if
(
params
.
id
)
{
setUserId
(
params
.
id
)
dispatch
(
fetchCalendarTasks
(
params
.
id
))
dispatch
(
fetchCurrentCalendarDisplayName
(
params
.
id
))
}
else
{
setUserId
(
user
.
id
)
setUserId
(
user
.
id
)
dispatch
(
fetchCalendarTasks
(
user
.
id
))
dispatch
(
fetchCalendarTasks
(
user
.
id
))
dispatch
(
fetchCurrentCalendarDisplayName
(
user
.
id
))
}
},
[
dispatch
])
},
[
dispatch
])
...
@@ -224,6 +234,7 @@ function MonthCalendar() {
...
@@ -224,6 +234,7 @@ function MonthCalendar() {
worker
=
{
worker
}
worker
=
{
worker
}
setModal
=
{
setModal
}
setModal
=
{
setModal
}
calendarType
=
{
calendarType
}
calendarType
=
{
calendarType
}
currentCalendarDisplayName
=
{
currentCalendarDisplayName
}
/
>
/
>
<
MonthCalendarBody
<
MonthCalendarBody
month
=
{
dateNow
.
month
}
month
=
{
dateNow
.
month
}
...
...
planner-front/src/containers/WeekCalendar/WeekCalendar.js
View file @
28b542ed
planner-front/src/store/actionTypes/userActionTypes.js
View file @
28b542ed
...
@@ -15,3 +15,5 @@ export const FETCH_USERS_FAILURE = "FETCH_USERS_FAILURE";
...
@@ -15,3 +15,5 @@ export const FETCH_USERS_FAILURE = "FETCH_USERS_FAILURE";
export
const
FETCH_USERS_ALL_FIELDS_REQUEST
=
"FETCH_USERS_ALL_FIELDS_REQUEST"
;
export
const
FETCH_USERS_ALL_FIELDS_REQUEST
=
"FETCH_USERS_ALL_FIELDS_REQUEST"
;
export
const
FETCH_USERS_ALL_FIELDS_SUCCESS
=
"FETCH_USERS_ALL_FIELDS_SUCCESS"
;
export
const
FETCH_USERS_ALL_FIELDS_SUCCESS
=
"FETCH_USERS_ALL_FIELDS_SUCCESS"
;
export
const
FETCH_USERS_ALL_FIELDS_FAILURE
=
"FETCH_USERS_ALL_FIELDS_FAILURE"
;
export
const
FETCH_USERS_ALL_FIELDS_FAILURE
=
"FETCH_USERS_ALL_FIELDS_FAILURE"
;
export
const
FETCH_DISPLAYNAME_SUCCESS
=
"FETCH_DISPLAYNAME_SUCCESS"
;
\ No newline at end of file
planner-front/src/store/actions/usersActions.js
View file @
28b542ed
import
axios
from
"../../axiosPlanner"
;
import
axios
from
"../../axiosPlanner"
;
import
{
FETCH_USERS_FAILURE
,
FETCH_USERS_REQUEST
,
FETCH_USERS_SUCCESS
,
LOGIN_USER_FAILURE
,
LOGIN_USER_SUCCESS
,
LOGOUT_USER_FAILURE
,
LOGOUT_USER_SUCCESS
,
REGISTER_USER_FAILURE
,
REGISTER_USER_REQUEST
,
REGISTER_USER_SUCCESS
,
FETCH_USERS_ALL_FIELDS_REQUEST
,
import
{
FETCH_USERS_FAILURE
,
FETCH_USERS_REQUEST
,
FETCH_USERS_SUCCESS
,
LOGIN_USER_FAILURE
,
LOGIN_USER_SUCCESS
,
LOGOUT_USER_FAILURE
,
LOGOUT_USER_SUCCESS
,
REGISTER_USER_FAILURE
,
REGISTER_USER_REQUEST
,
REGISTER_USER_SUCCESS
,
FETCH_USERS_ALL_FIELDS_REQUEST
,
FETCH_USERS_ALL_FIELDS_SUCCESS
,
FETCH_USERS_ALL_FIELDS_SUCCESS
,
FETCH_USERS_ALL_FIELDS_FAILURE
,
}
from
"../actionTypes/userActionTypes"
FETCH_USERS_ALL_FIELDS_FAILURE
,
FETCH_DISPLAYNAME_SUCCESS
,
}
from
"../actionTypes/userActionTypes"
import
{
showNotification
}
from
"./commonActions"
;
import
{
showNotification
}
from
"./commonActions"
;
const
registerUserRequest
=
()
=>
{
const
registerUserRequest
=
()
=>
{
...
@@ -136,3 +137,20 @@ export const fetchUsersAllFields = () => {
...
@@ -136,3 +137,20 @@ export const fetchUsersAllFields = () => {
}
}
};
};
const
fetchCurrentCalendarDisplayNameSuccess
=
(
displayName
)
=>
{
return
{
type
:
FETCH_DISPLAYNAME_SUCCESS
,
displayName
}
}
export
const
fetchCurrentCalendarDisplayName
=
(
userId
)
=>
{
return
async
dispatch
=>
{
dispatch
(
fetchUsersAllFieldsRequest
());
try
{
const
response
=
await
axios
.
get
(
`/users/display-name/
${
userId
}
`
);
dispatch
(
fetchCurrentCalendarDisplayNameSuccess
(
response
.
data
.
displayName
));
}
catch
(
e
)
{
dispatch
(
fetchUsersAllFieldsFailure
(
e
.
response
.
data
));
}
}
};
planner-front/src/store/reducers/usersReducer.js
View file @
28b542ed
import
{
REGISTER_USER_REQUEST
,
REGISTER_USER_SUCCESS
,
REGISTER_USER_FAILURE
,
LOGIN_USER_SUCCESS
,
LOGIN_USER_FAILURE
,
LOGOUT_USER_SUCCESS
,
FETCH_USERS_SUCCESS
,
FETCH_USERS_ALL_FIELDS_SUCCESS
}
from
"../actionTypes/userActionTypes"
;
import
{
REGISTER_USER_REQUEST
,
REGISTER_USER_SUCCESS
,
REGISTER_USER_FAILURE
,
LOGIN_USER_SUCCESS
,
LOGIN_USER_FAILURE
,
LOGOUT_USER_SUCCESS
,
FETCH_USERS_SUCCESS
,
FETCH_USERS_ALL_FIELDS_SUCCESS
,
FETCH_DISPLAYNAME_SUCCESS
}
from
"../actionTypes/userActionTypes"
;
const
initialState
=
{
const
initialState
=
{
user
:
null
,
user
:
null
,
users
:
[],
users
:
[],
usersAllFields
:[],
usersAllFields
:[],
currentCalendarDisplayName
:
''
,
registerError
:
null
,
registerError
:
null
,
loginError
:
null
,
loginError
:
null
,
loading
:
false
loading
:
false
...
@@ -30,6 +31,8 @@ const usersReducer = (state = initialState, action) => {
...
@@ -30,6 +31,8 @@ const usersReducer = (state = initialState, action) => {
return
{...
state
,
loading
:
false
,
users
:
action
.
users
};
return
{...
state
,
loading
:
false
,
users
:
action
.
users
};
case
FETCH_USERS_ALL_FIELDS_SUCCESS
:
case
FETCH_USERS_ALL_FIELDS_SUCCESS
:
return
{...
state
,
loading
:
false
,
usersAllFields
:
action
.
users
};
return
{...
state
,
loading
:
false
,
usersAllFields
:
action
.
users
};
case
FETCH_DISPLAYNAME_SUCCESS
:
return
{...
state
,
loading
:
false
,
currentCalendarDisplayName
:
action
.
displayName
};
default
:
default
:
return
state
;
return
state
;
}
}
...
...
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