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
6fc542a3
Commit
6fc542a3
authored
Nov 02, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#13
Реализовал разные меню в хедере для разных ролей пользователей
parent
d1decf4e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
130 additions
and
51 deletions
+130
-51
AdminMenu.js
planner-front/src/components/Menus/AdminMenu/AdminMenu.js
+57
-0
AnonymousMenu.js
...front/src/components/Menus/AnonymousMenu/AnonymousMenu.js
+16
-0
WorkerMenu.js
planner-front/src/components/Menus/WorkerMenu/WorkerMenu.js
+41
-0
AppToolBar.js
planner-front/src/components/UI/AppToolBar/AppToolBar.js
+16
-51
No files found.
planner-front/src/components/Menus/AdminMenu/AdminMenu.js
0 → 100644
View file @
6fc542a3
import
{
Button
}
from
"@mui/material"
;
import
{
NavLink
}
from
"react-router-dom"
;
const
AdminMenu
=
()
=>
{
return
<>
<
Button
component
=
{
NavLink
}
to
=
"/week"
color
=
"inherit"
size
=
"large"
>
Неделя
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/month"
color
=
"inherit"
size
=
"large"
>
Месяц
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/my-tasks"
color
=
"inherit"
size
=
"large"
>
Мои
задачи
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/workers-tasks"
color
=
"inherit"
size
=
"large"
>
Задачи
сотрудников
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/sign-up"
color
=
"inherit"
size
=
"large"
>
Создать
сотрудника
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/profile/test"
color
=
"inherit"
size
=
"large"
>
Профиль
<
/Button
>
<
/
>
};
export
default
AdminMenu
;
\ No newline at end of file
planner-front/src/components/Menus/AnonymousMenu/AnonymousMenu.js
0 → 100644
View file @
6fc542a3
import
{
Button
}
from
"@mui/material"
;
import
{
NavLink
}
from
"react-router-dom"
;
const
AnonymousMenu
=
()
=>
{
return
<>
<
Button
component
=
{
NavLink
}
color
=
"inherit"
to
=
"/log-in"
>
Вход
<
/Button
>
<
/
>
};
export
default
AnonymousMenu
;
planner-front/src/components/Menus/WorkerMenu/WorkerMenu.js
0 → 100644
View file @
6fc542a3
import
{
Button
}
from
"@mui/material"
;
import
{
NavLink
}
from
"react-router-dom"
;
const
WorkerMenu
=
({
user
})
=>
{
return
<>
<
Button
component
=
{
NavLink
}
to
=
"/week"
color
=
"inherit"
size
=
"large"
>
Неделя
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/month"
color
=
"inherit"
size
=
"large"
>
Месяц
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/my-tasks"
color
=
"inherit"
size
=
"large"
>
Мои
задачи
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/profile/test"
color
=
"inherit"
size
=
"large"
>
Профиль
<
/Button
>
<
/
>
};
export
default
WorkerMenu
;
planner-front/src/components/UI/AppToolBar/AppToolBar.js
View file @
6fc542a3
import
{
AppBar
,
Box
,
Toolbar
,
Typography
,
Button
}
from
"@mui/material"
;
import
{
AppBar
,
Box
,
Toolbar
,
Typography
}
from
"@mui/material"
;
import
{
NavLink
}
from
"react-router-dom"
;
import
{
useSelector
}
from
"react-redux"
;
import
HasAccess
from
"../HasAccess/HasAccess"
;
import
AnonymousMenu
from
"../../Menus/AnonymousMenu/AnonymousMenu"
;
import
WorkerMenu
from
"../../Menus/WorkerMenu/WorkerMenu"
;
import
AdminMenu
from
"../../Menus/AdminMenu/AdminMenu"
;
const
AppToolbar
=
()
=>
{
const
user
=
useSelector
(
state
=>
state
.
users
.
user
);
...
...
@@ -16,54 +19,16 @@ const AppToolbar = () => {
<
NavLink
to
=
'/'
style
=
{{
textDecoration
:
'none'
,
color
:
'inherit'
}}
>
Task
Manager
<
/NavLink
>
<
/Typography>
<
Button
component
=
{
NavLink
}
to
=
"/week"
color
=
"inherit"
size
=
"large"
>
Неделя
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/month"
color
=
"inherit"
size
=
"large"
>
Месяц
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/my-tasks"
color
=
"inherit"
size
=
"large"
>
Мои
задачи
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/workers-tasks"
color
=
"inherit"
size
=
"large"
>
Задачи
сотрудников
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/sign-up"
color
=
"inherit"
size
=
"large"
>
Создать
сотрудника
<
/Button
>
<
Button
component
=
{
NavLink
}
to
=
"/profile/test"
color
=
"inherit"
size
=
"large"
>
Профиль
<
/Button
>
<
HasAccess
allowed
=
{
!
user
}
>
<
AnonymousMenu
/>
<
/HasAccess
>
<
HasAccess
roles
=
{[
'user'
]}
>
<
WorkerMenu
/>
<
/HasAccess
>
<
HasAccess
roles
=
{[
'superuser'
]}
>
<
AdminMenu
/>
<
/HasAccess
>
<
/Toolbar
>
<
/AppBar
>
<
/Box
>
...
...
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