49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import {connect} from 'react-redux';
|
|
import Datetime from 'react-datetime';
|
|
import MainMenu from '../../containers/MenuControl';
|
|
import Loading from '../../containers/LoadingControl';
|
|
import Dialog from '../DialogControl';
|
|
import Dashboard from '../../containers/DashBoard';
|
|
import {toggle_dashboard} from '../../actions'
|
|
|
|
class AdmPage extends React.Component {
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
}
|
|
|
|
componentDidMount(){
|
|
let showDashboard = localStorage.getItem('show_dashboard');
|
|
if(showDashboard != null && showDashboard == 1){
|
|
this.props.toggleDashboard(true);
|
|
}
|
|
}
|
|
|
|
render() {
|
|
let {i18n, children} = this.props;
|
|
if(!i18n || Object.keys(i18n).length == 0 || !i18n.t || !i18n.getResource) return null;
|
|
return (
|
|
<div style={{height: '100%'}}>
|
|
<Loading />
|
|
<Dialog />
|
|
<MainMenu i18n={i18n} >
|
|
<Dashboard />
|
|
{children}
|
|
</MainMenu>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
const mapStateToProps = (state) => ({
|
|
i18n: state.i18n
|
|
})
|
|
|
|
const mapDispatchToProps = (dispatch, ownProps) =>({
|
|
toggleDashboard: (flag)=>{
|
|
dispatch(toggle_dashboard(flag))
|
|
}
|
|
})
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(AdmPage); |