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 | import PhoneIphoneIcon from '@mui/icons-material/PhoneIphone';
|
---|
14 |
|
---|
15 | export class NavbarComponent extends Component {
|
---|
16 |
|
---|
17 | constructor(props) {
|
---|
18 | super(props)
|
---|
19 |
|
---|
20 | this.state = {
|
---|
21 |
|
---|
22 | }
|
---|
23 | }
|
---|
24 |
|
---|
25 | logOut = () => {
|
---|
26 | localStorage.clear()
|
---|
27 | window.location.href = "/"
|
---|
28 | }
|
---|
29 |
|
---|
30 | render() {
|
---|
31 | return (
|
---|
32 | <div className='phonelux-navbar'>
|
---|
33 | {
|
---|
34 | localStorage.getItem('token') && this.context.role == 'SUPERADMIN' ?
|
---|
35 | <Tippy placement='bottom' content='Менаџмент со корисници'>
|
---|
36 | <Link style={{color: 'black'}} to={"/management/users"}>
|
---|
37 | <SupervisorAccountIcon style={{fontSize: '40px', marginTop: '10px', marginRight: '10px' }} className='navbar-superadmin-icon'/>
|
---|
38 | </Link>
|
---|
39 | </Tippy> : <></>
|
---|
40 | }
|
---|
41 | {
|
---|
42 | localStorage.getItem('token') ?
|
---|
43 | <Tippy placement='bottom' content='Споредба на мобилни телефони'>
|
---|
44 | <Link style={{color: 'black'}} to={"/compareoffers"}>
|
---|
45 | <PhoneIphoneIcon style={{fontSize: '40px', marginTop: '10px', marginRight: '10px' }} className='navbar-comparephone-icon'/>
|
---|
46 | </Link>
|
---|
47 | </Tippy> : <></>
|
---|
48 | }
|
---|
49 | {
|
---|
50 | localStorage.getItem('token') ?
|
---|
51 | <Tippy placement='bottom' content='Омилени понуди'>
|
---|
52 | <Link style={{color: 'black'}} to={"/user/"+this.context.userId+"/favouriteoffers"}>
|
---|
53 | <StarsIcon style={{fontSize: '40px', marginTop: '10px', marginRight: '10px' }} className='navbar-favouriteoffers-icon'/>
|
---|
54 | </Link>
|
---|
55 | </Tippy> : <></>
|
---|
56 | }
|
---|
57 |
|
---|
58 | { localStorage.getItem('token') ?
|
---|
59 | <Tippy placement='bottom' content='Одјави се'>
|
---|
60 | <LogoutIcon onClick={this.logOut} style={{fontSize: '40px', marginTop: '10px' }} className='navbar-logout-box-icon'/>
|
---|
61 | </Tippy>
|
---|
62 | :
|
---|
63 | <Tippy placement='bottom' content='Најави се'>
|
---|
64 | <Link style={{color: 'black'}} to={"/login"}> <PersonIcon style={{fontSize: '50px', marginTop: '10px' }} className='navbar-account-box-icon'/></Link>
|
---|
65 | </Tippy>
|
---|
66 | }
|
---|
67 |
|
---|
68 |
|
---|
69 | </div>
|
---|
70 | )
|
---|
71 | }
|
---|
72 | }
|
---|
73 |
|
---|
74 | NavbarComponent.contextType = UserContext
|
---|
75 |
|
---|
76 | export default NavbarComponent
|
---|