1
|
import 'antd/dist/antd.css';
|
2
|
import styles from '/styles/MainLayout.module.scss';
|
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';
|
7
|
|
8
|
/**
|
9
|
* Creates layout of main screens.
|
10
|
* @param props Html structure of a login form.
|
11
|
* @returns The login screen.
|
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
|
|
18
|
return (
|
19
|
<div className={styles.layoutWrapper}>
|
20
|
<div className={styles.header}>
|
21
|
{(isAdmin && <AdminNavBar />) || (isAnnotator && <UserNavBar />)}
|
22
|
</div>
|
23
|
<main className={styles.content}>{props.children}</main>
|
24
|
<div className={styles.footer} />
|
25
|
</div>
|
26
|
);
|
27
|
}
|