Projekt

Obecné

Profil

Stáhnout (1.76 KB) Statistiky
| Větev: | Tag: | Revize:
1
import React, { useCallback, useContext } from 'react';
2
import { Menu } from 'antd';
3
import { useRouter } from 'next/router';
4
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
import { LoggedUserContext } from '../../contexts/LoggedUserContext';
6
import {
7
    faUser,
8
    faFileExport,
9
    faFileLines,
10
    faUsers,
11
    faTags,
12
    faBookmark,
13
} from '@fortawesome/free-solid-svg-icons';
14

    
15
const AdminNavBar = () => {
16
    const router = useRouter();
17
    const { logout } = useContext(LoggedUserContext);
18
    const { SubMenu } = Menu;
19

    
20
    const handleLogout = useCallback(() => {
21
        logout();
22
        router.push('/login');
23
    }, [logout, router]);
24

    
25
    return (
26
        <Menu theme="dark" mode="horizontal">
27
            <Menu.Item style={{}} key="1" onClick={() => router.push('/documents/admin')}>
28
                <FontAwesomeIcon icon={faFileLines} /> Dokumenty
29
            </Menu.Item>
30
            <Menu.Item style={{}} key="2" onClick={() => router.push('/users')}>
31
                <FontAwesomeIcon icon={faUsers} /> Uživatelé
32
            </Menu.Item>
33
            <Menu.Item style={{}} key="3" onClick={() => router.push('/tags')}>
34
                <FontAwesomeIcon icon={faTags} /> Značky
35
            </Menu.Item>
36
            <Menu.Item style={{}} key="5" onClick={() => router.push('/export')}>
37
                <FontAwesomeIcon icon={faFileExport} /> Export
38
            </Menu.Item>
39

    
40
            <SubMenu
41
                icon={<FontAwesomeIcon icon={faUser} />}
42
                key="account"
43
                title={'Admin XY'} // TODO show username
44
            >
45
                <Menu.Item key="setting:2" onClick={() => handleLogout()}>
46
                    Odhlásit se
47
                </Menu.Item>
48
            </SubMenu>
49
        </Menu>
50
    );
51
};
52

    
53
export default AdminNavBar;
(1-1/2)