import { observer } from "mobx-react";
import * as React from "react";
import { Button, Item } from "semantic-ui-react";
import { DeviceView } from "@client/components";
import { AppState, injectState } from "@client/state";
class DevicesPage extends React.Component<{ appState: AppState }> {
refreshDevices = () => {
this.props.appState.sprinklersRpc.doAuthenticate();
}
render() {
const { appState } = this.props;
const userData = appState.userStore.getUserData();
let deviceNodes: React.ReactNode;
if (!userData) {
deviceNodes = Not logged in;
} else if (!userData.devices || !userData.devices.length) {
deviceNodes = You have no devices;
} else {
deviceNodes = userData.devices.map(device => (
));
}
return (
Devices
{deviceNodes}
);
}
}
export default injectState(observer(DevicesPage));