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