69 lines
1.6 KiB
JavaScript
69 lines
1.6 KiB
JavaScript
import React from 'react';
|
|
import Header from 'components/Header';
|
|
import Sidenav from 'components/Sidenav';
|
|
import Footer from 'components/Footer';
|
|
import Notifications from 'components/Notifications';
|
|
import Notification from 'components/Shared/Notification';
|
|
import GeolocationService from './Geolocation';
|
|
import {
|
|
loggedUser,
|
|
visitReporter,
|
|
} from 'utils/authorization';
|
|
|
|
class MainApp extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.props = props;
|
|
this.state = {
|
|
user: {
|
|
useruuid: '',
|
|
name: ''
|
|
}
|
|
}
|
|
|
|
this.handleRide = this.handleRide.bind(this);
|
|
}
|
|
|
|
componentDidMount() {
|
|
const user = JSON.parse(localStorage.getItem('loggedUser'));
|
|
if (user) {
|
|
this.setState(Object.assign(this.state, { user: user }));
|
|
}
|
|
}
|
|
|
|
handleRide(ride) {
|
|
if (this.props.onRideUpdate) {
|
|
this.props.onRideUpdate(ride);
|
|
}
|
|
}
|
|
|
|
render() {
|
|
const { children, location } = this.props;
|
|
|
|
return (
|
|
<div className="main-app-container">
|
|
<Sidenav />
|
|
|
|
<section id="page-container" className="app-page-container">
|
|
<Header />
|
|
|
|
<div className="app-content-wrapper">
|
|
<div className="app-content">
|
|
<div className="full-height">
|
|
{children}
|
|
</div>
|
|
</div>
|
|
|
|
<Footer />
|
|
</div>
|
|
</section>
|
|
{!loggedUser.anyOf(visitReporter) &&
|
|
<Notifications user={this.state.user} onRideUpdate={this.handleRide} />
|
|
}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
module.exports = MainApp;
|