import {observer} from "mobx-react"; import * as React from "react"; import {Table} from "semantic-ui-react"; import {Program, Schedule} from "../sprinklers"; @observer export class ScheduleView extends React.PureComponent<{ schedule: Schedule }, {}> { render() { return (
{JSON.stringify(this.props.schedule)}
); } } @observer export default class ProgramTable extends React.PureComponent<{ programs: Program[] }, {}> { private static renderRow(program: Program, i: number): JSX.Element[] { if (!program) { return null; } const {name, running, enabled, schedule, sequence} = program; return [ {"" + (i + 1)} {name} {running ? "Running" : "Not running"} {enabled ? "Enabled" : "Not enabled"} , , ]; } render() { return ( Programs # Name Running? Enabled? { Array.prototype.concat.apply([], this.props.programs.map(ProgramTable.renderRow)) }
); } }