import React, { Component } from "react"; import DevicePanel from "../components/dashboard/DevicePanel"; import ScenesPanel from "../components/dashboard/ScenesPanel"; import AutomationsPanel from "../components/dashboard/AutomationsPanel"; import Navbar from "./Navbar"; import ScenesNavbar from "./ScenesNavbar"; import AutomationsNavbar from "./AutomationsNavbar"; import MyHeader from "../components/HeaderController"; import { Grid, Responsive, Button } from "semantic-ui-react"; import { panelStyle, mobilePanelStyle, } from "../components/dashboard/devices/styleComponents"; import { RemoteService } from "../remote"; import { connect } from "react-redux"; import { appActions } from "../storeActions"; class Dashboard extends Component { constructor(props) { super(props); this.state = this.initialState; this.setInitialState(); this.activeTab = "Automations"; //TODO Remove this to not put automations first this.selectTab = this.selectTab.bind(this); } get initialState() { return { activeTab: this.activeTab, }; } setInitialState() { this.setState(this.initialState); } get activeTab() { return this.props.activeTab; } set activeTab(tab) { this.props.setActiveTab(tab); } selectTab(e, { name }) { this.setState({ activeTab: name }); this.activeTab = name; } renderTab(tab) { switch (tab) { case "Devices": return ; case "Scenes": return ; case "Automations": return ; default: return

ERROR

; } } renderNavbar(tab) { switch (tab) { case "Devices": return ; case "Scenes": return ; case "Automations": return ; default: return

ERROR

; } } render() { return (
); } } const mapStateToProps = (state, _) => ({ activeTab: state.active.activeTab, }); const setActiveTab = (activeTab) => { return (dispatch) => dispatch(appActions.setActiveTab(activeTab)); }; const DashboardContainer = connect(mapStateToProps, { ...RemoteService, setActiveTab, })(Dashboard); export default DashboardContainer;