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
d1decf4e
Commit
d1decf4e
authored
Nov 02, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#13
Добавил хедер и navigation меню внутри
parent
69b665e4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
3 deletions
+84
-3
App.js
planner-front/src/App.js
+4
-3
AppToolBar.js
planner-front/src/components/UI/AppToolBar/AppToolBar.js
+72
-0
HasAccess.js
planner-front/src/components/UI/HasAccess/HasAccess.js
+8
-0
No files found.
planner-front/src/App.js
View file @
d1decf4e
import
{
Routes
,
Route
,
Outlet
,
Navigate
,
BrowserRouter
}
from
"react-router-dom"
;
import
{
Container
}
from
"@mui/material"
;
import
{
useSelector
}
from
"react-redux"
;
import
AppToolbar
from
"./components/UI/AppToolBar/AppToolBar"
;
const
App
=
()
=>
{
...
...
@@ -9,7 +10,7 @@ const App = () => {
<
Routes
>
<
Route
element
=
{
<>
<
span
>
header
<
/span
>
<
AppToolbar
/
>
<
main
>
<
Container
>
<
Outlet
/>
...
...
@@ -20,8 +21,8 @@ const App = () => {
<
Route
path
=
{
"/"
}
element
=
{
<
h1
>
week
page
<
/h1>}/
>
<
Route
path
=
{
"/week"
}
element
=
{
<
h1
>
week
page
<
/h1>}/
>
<
Route
path
=
{
"/month"
}
element
=
{
<
h1
>
month
page
<
/h1>}/
>
<
Route
path
=
{
"/mytasks"
}
element
=
{
<
h1
>
my
tasks
page
<
/h1>}/
>
<
Route
path
=
{
"/workerstasks"
}
element
=
{
<
h1
>
workers
tasks
page
<
/h1>}/
>
<
Route
path
=
{
"/my
-
tasks"
}
element
=
{
<
h1
>
my
tasks
page
<
/h1>}/
>
<
Route
path
=
{
"/workers
-
tasks"
}
element
=
{
<
h1
>
workers
tasks
page
<
/h1>}/
>
<
Route
path
=
{
"/profile/:id"
}
element
=
{
<
h1
>
profile
page
<
/h1>}/
>
<
Route
path
=
{
"/sign-up"
}
element
=
{
<
h1
>
sign
-
up
page
<
/h1>}/
>
<
Route
path
=
{
"/log-in"
}
element
=
{
<
h1
>
log
-
in
page
<
/h1>}/
>
...
...
planner-front/src/components/UI/AppToolBar/AppToolBar.js
0 → 100644
View file @
d1decf4e
import
{
AppBar
,
Box
,
Toolbar
,
Typography
,
Button
}
from
"@mui/material"
;
import
{
NavLink
}
from
"react-router-dom"
;
import
{
useSelector
}
from
"react-redux"
;
import
HasAccess
from
"../HasAccess/HasAccess"
;
const
AppToolbar
=
()
=>
{
const
user
=
useSelector
(
state
=>
state
.
users
.
user
);
return
<
Box
sx
=
{{
flexGrow
:
1
,
mb
:
"40px"
}}
>
<
AppBar
position
=
"static"
>
<
Toolbar
>
<
Typography
variant
=
"h4"
component
=
"div"
sx
=
{{
flexGrow
:
1
}}
>
<
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
>
<
/Toolbar
>
<
/AppBar
>
<
/Box
>
};
export
default
AppToolbar
;
planner-front/src/components/UI/HasAccess/HasAccess.js
0 → 100644
View file @
d1decf4e
import
{
useSelector
}
from
"react-redux"
;
const
HasAccess
=
({
allowed
,
roles
,
children
})
=>
{
const
user
=
useSelector
(
state
=>
state
.
users
?.
user
);
return
allowed
||
roles
?.
includes
(
user
?.
role
)
?
children
:
null
;
};
export
default
HasAccess
;
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