1 | import React, { Component } from 'react'
|
---|
2 | import './NavbarComponent.css'
|
---|
3 | import AccountBoxIcon from '@mui/icons-material/AccountBox';
|
---|
4 | import { style } from '@mui/system';
|
---|
5 | import Tippy from '@tippyjs/react';
|
---|
6 | import 'tippy.js/dist/tippy.css'
|
---|
7 | import { Link } from 'react-router-dom';
|
---|
8 | import PersonIcon from '@mui/icons-material/Person';
|
---|
9 | import LogoutIcon from '@mui/icons-material/Logout';
|
---|
10 | import StarsIcon from '@mui/icons-material/Stars';
|
---|
11 | import UserContext from '../../context/UserContext';
|
---|
12 | import SupervisorAccountIcon from '@mui/icons-material/SupervisorAccount';
|
---|
13 |
|
---|
14 | export class NavbarComponent extends Component {
|
---|
15 |
|
---|
16 | constructor(props) {
|
---|
17 | super(props)
|
---|
18 |
|
---|
19 | this.state = {
|
---|
20 |
|
---|
21 | }
|
---|
22 | }
|
---|
23 |
|
---|
24 | logOut = () => {
|
---|
25 | localStorage.clear()
|
---|
26 | window.location.href = "/"
|
---|
27 | }
|
---|
28 |
|
---|
29 | render() {
|
---|
30 | return (
|
---|
31 | <div className='phonelux-navbar'>
|
---|
32 | {
|
---|
33 | localStorage.getItem('token') && this.context.role == 'SUPERADMIN' ?
|
---|
34 | <Tippy placement='bottom' content='Менаџмент со корисници'>
|
---|
35 | <Link style={{color: 'black'}} to={"/management/users"}>
|
---|
36 | <SupervisorAccountIcon style={{fontSize: '40px', marginTop: '10px', marginRight: '10px' }} className='navbar-superadmin-icon'/>
|
---|
37 | </Link>
|
---|
38 | </Tippy> : <></>
|
---|
39 | }
|
---|
40 | {
|
---|
41 | localStorage.getItem('token') ?
|
---|
42 | <Tippy placement='bottom' content='Омилени понуди'>
|
---|
43 | <Link style={{color: 'black'}} to={"/user/"+this.context.userId+"/favouriteoffers"}>
|
---|
44 | <StarsIcon style={{fontSize: '40px', marginTop: '10px', marginRight: '10px' }} className='navbar-favouriteoffers-icon'/>
|
---|
45 | </Link>
|
---|
46 | </Tippy> : <></>
|
---|
47 | }
|
---|
48 |
|
---|
49 | { localStorage.getItem('token') ?
|
---|
50 | <Tippy placement='bottom' content='Одјави се'>
|
---|
51 | <LogoutIcon onClick={this.logOut} style={{fontSize: '40px', marginTop: '10px' }} className='navbar-logout-box-icon'/>
|
---|
52 | </Tippy>
|
---|
53 | :
|
---|
54 | <Tippy placement='bottom' content='Најави се'>
|
---|
55 | <Link style={{color: 'black'}} to={"/login"}> <PersonIcon style={{fontSize: '50px', marginTop: '10px' }} className='navbar-account-box-icon'/></Link>
|
---|
56 | </Tippy>
|
---|
57 | }
|
---|
58 |
|
---|
59 |
|
---|
60 | </div>
|
---|
61 | )
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | NavbarComponent.contextType = UserContext
|
---|
66 |
|
---|
67 | export default NavbarComponent
|
---|