import React, { Component } from 'react'; import { Route, NavLink } from 'react-router-dom'; import { Header, Ballots, NewBallot, Settings, Footer } from './components'; import './assets/App.css'; //import DevTools from 'mobx-react-devtools' import Loading from './Loading'; import { inject, observer } from 'mobx-react'; @inject("commonStore") @observer class App extends Component { onBallotsRender = () => { const { commonStore } = this.props; commonStore.isActiveFilter = false; return ; } onActiveBallotsRender = () => { const { commonStore } = this.props; commonStore.isActiveFilter = true; return ; } onNewBallotRender = () => { return ; } onSettingsRender = () => { return ; } onSearch = (e) => { const { commonStore } = this.props; commonStore.setSearchTerm(e.target.value.toLowerCase()); } shouldShowNavPan = () => { const { commonStore } = this.props; const currentPath = this.props.location.pathname; let showNavPan = currentPath === `${commonStore.rootPath}` || currentPath === "/" || currentPath === `${commonStore.rootPath}/` || currentPath === `${commonStore.rootPath}/active`; return showNavPan; } render() { const { commonStore } = this.props; const loading = commonStore.loading ? : '' const nav = this.shouldShowNavPan() ?
All Active
: null; return (
{loading}
{nav} {/**/}
); } } export default App;