source: phonelux-frontend/src/components/NavbarComponent/NavbarComponent.js

Last change on this file was 47f4eaf, checked in by Marko <Marko@…>, 20 months ago

Final features implemented

  • Property mode set to 100644
File size: 3.8 KB
Line 
1import React, { Component } from 'react'
2import './NavbarComponent.css'
3import AccountBoxIcon from '@mui/icons-material/AccountBox';
4import { style } from '@mui/system';
5import Tippy from '@tippyjs/react';
6import 'tippy.js/dist/tippy.css'
7import { Link } from 'react-router-dom';
8import PersonIcon from '@mui/icons-material/Person';
9import LogoutIcon from '@mui/icons-material/Logout';
10import StarsIcon from '@mui/icons-material/Stars';
11import UserContext from '../../context/UserContext';
12import SupervisorAccountIcon from '@mui/icons-material/SupervisorAccount';
13import CompareIcon from '@mui/icons-material/Compare';
14import BugReportIcon from '@mui/icons-material/BugReport';
15import ReportIcon from '@mui/icons-material/Report';
16import UpdateIcon from '@mui/icons-material/Update';
17
18export 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
93NavbarComponent.contextType = UserContext
94
95export default NavbarComponent
Note: See TracBrowser for help on using the repository browser.