[e5b84dc] | 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';
|
---|
[7e88e46] | 10 | import StarsIcon from '@mui/icons-material/Stars';
|
---|
| 11 | import UserContext from '../../context/UserContext';
|
---|
| 12 | import SupervisorAccountIcon from '@mui/icons-material/SupervisorAccount';
|
---|
[fd5b100] | 13 | import CompareIcon from '@mui/icons-material/Compare';
|
---|
[e5b84dc] | 14 |
|
---|
| 15 | export class NavbarComponent extends Component {
|
---|
| 16 |
|
---|
| 17 | constructor(props) {
|
---|
| 18 | super(props)
|
---|
| 19 |
|
---|
| 20 | this.state = {
|
---|
[7e88e46] | 21 |
|
---|
[e5b84dc] | 22 | }
|
---|
| 23 | }
|
---|
[7e88e46] | 24 |
|
---|
| 25 | logOut = () => {
|
---|
| 26 | localStorage.clear()
|
---|
| 27 | window.location.href = "/"
|
---|
| 28 | }
|
---|
[e5b84dc] | 29 |
|
---|
| 30 | render() {
|
---|
| 31 | return (
|
---|
| 32 | <div className='phonelux-navbar'>
|
---|
[7e88e46] | 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 | {
|
---|
[d66b8eb] | 42 | localStorage.getItem('token') ?
|
---|
| 43 | <Tippy placement='bottom' content='Споредба на мобилни телефони'>
|
---|
| 44 | <Link style={{color: 'black'}} to={"/compareoffers"}>
|
---|
[fd5b100] | 45 | <CompareIcon style={{fontSize: '40px', marginTop: '10px', marginRight: '10px' }} className='navbar-comparephone-icon'/>
|
---|
[d66b8eb] | 46 | </Link>
|
---|
| 47 | </Tippy> : <></>
|
---|
| 48 | }
|
---|
| 49 | {
|
---|
[7e88e46] | 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 | :
|
---|
[e5b84dc] | 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>
|
---|
[7e88e46] | 66 | }
|
---|
[e5b84dc] | 67 |
|
---|
| 68 |
|
---|
| 69 | </div>
|
---|
| 70 | )
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
| 73 |
|
---|
[7e88e46] | 74 | NavbarComponent.contextType = UserContext
|
---|
| 75 |
|
---|
[e5b84dc] | 76 | export default NavbarComponent
|
---|