import React from 'react';
import { Grid, Row, Col } from 'react-bootstrap';
import { Profile, Fluidbar, WaitIcon } from '../../components/index';
import { app } from '../../core/app';
import SidebarContent from '../sidebar-content';
import { WORKSPACE_CHANGE, WORKSPACE_CHANGING } from '../../core/actions';
import SessionUtils from '../session-utils';
import Dashboard from './index-dashboard';
import MyActivities from './index-my-activities';
const menu = [
{
title: 'Dashboard',
icon: 'dashboard',
default: true,
path: '/dashboard',
view: Dashboard
},
{
title: 'My activities',
icon: 'history',
path: '/myactivities',
view: MyActivities
}
];
/**
* The page controller of the public module
*/
export default class Index extends React.Component {
constructor(props) {
super(props);
this._appEvent = this._appEvent.bind(this);
this.state = { session: app.getState().session };
}
componentDidMount() {
// set handler to receive information about actions
app.add(this._appEvent);
}
componentWillUnmount() {
app.remove(this._appEvent);
}
_appEvent(action, data) {
if (action === WORKSPACE_CHANGE) {
this.setState({ session: data.session });
return;
}
if (action === WORKSPACE_CHANGING) {
this.setState({ session: null });
return;
}
}
render() {
const session = this.state.session;
if (!session) {
return