Revize 8c45ccb0
Přidáno uživatelem hrubyjar před asi 2 roky(ů)
webapp/layouts/MainLayout.tsx | ||
---|---|---|
1 |
import { UserNavBar } from '../components/navigation/UserNavBar'; |
|
2 |
import { AdminNavBar } from '../components/navigation/AdminNavBar'; |
|
3 | 1 |
import 'antd/dist/antd.css'; |
4 | 2 |
import styles from '/styles/MainLayout.module.scss'; |
5 |
import React from 'react'; |
|
3 |
import { useContext } from 'react'; |
|
4 |
import { LoggedUserContext } from '../contexts/LoggedUserContext'; |
|
5 |
import AdminNavBar from '../components/navigation/AdminNavBar'; |
|
6 |
import UserNavBar from '../components/navigation/UserNavBar'; |
|
6 | 7 |
|
7 | 8 |
/** |
8 | 9 |
* Creates layout of main screens. |
... | ... | |
10 | 11 |
* @returns The login screen. |
11 | 12 |
*/ |
12 | 13 |
export function MainLayout(props: { children: React.ReactNode }) { |
14 |
const { role } = useContext(LoggedUserContext); |
|
15 |
const isAdmin = role === 'ADMINISTRATOR'; |
|
16 |
const isAnnotator = role === 'ANNOTATOR'; |
|
17 |
|
|
13 | 18 |
return ( |
14 | 19 |
<div className={styles.layoutWrapper}> |
15 | 20 |
<div className={styles.header}> |
16 |
{/** |
|
17 |
@todo: Select correct navigation bar |
|
18 |
{user && <UserNavBar />} |
|
19 |
{admin && <AdminNavBar />} |
|
20 |
**/} |
|
21 |
{(isAdmin && <AdminNavBar />) || (isAnnotator && <UserNavBar />)} |
|
21 | 22 |
</div> |
22 | 23 |
<main className={styles.content}>{props.children}</main> |
23 |
<div className={styles.footer}></div>
|
|
24 |
<div className={styles.footer} />
|
|
24 | 25 |
</div> |
25 | 26 |
); |
26 | 27 |
} |
Také k dispozici: Unified diff
Token management implemented, redirections