import React from 'react'; import ReactDOM from 'react-dom'; import './include/index.css'; import './include/adminlte.min.css'; // import './include/adminlte.min.js'; import API from './api.js'; import Header from './header.js'; import Sidebar from './sidebar.js'; import UserOverview from './users.js'; import Overview from './overview.js' import Icon from "./icon"; import Dialog from "./dialog"; class AdminDashboard extends React.Component { constructor(props) { super(props); this.api = new API(); this.state = { currentView: "dashboard", loaded: false, dialog: { hidden: true } }; } onChangeView(view) { console.log("changing view to: " + view); this.setState({ ...this.state, currentView: view || "dashboard" }); } showDialog(props) { props = props || { hidden: true }; if (!props.hasOwnProperty("hidden")) props.hidden = false; this.setState({ ...this.state, dialog: props }); } render() { if (!this.state.loaded) { this.api.fetchUser().then(Success => { if (!Success) { document.location = "/admin"; } else { this.setState({...this.state, loaded: true}); } }); return Loading… } console.log("Rendering mainview with:", this.state.dialog); const dialog = const content = this.createContent(); return
{content} {dialog}
} createContent() { if (this.state.currentView === "users") { return } else { return } } } ReactDOM.render( , document.getElementById('root') );