From 6ed40997866571126c43e0cd5982d2085b2e2813 Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Thu, 4 May 2017 20:26:51 -0600 Subject: [PATCH] More work and fixing stuf --- app/index.html | 2 -- app/script/App.tsx | 83 ++++++++++++++++++++++++++++------------------ app/style/app.css | 4 +++ 3 files changed, 55 insertions(+), 34 deletions(-) diff --git a/app/index.html b/app/index.html index e52e269..9d19565 100644 --- a/app/index.html +++ b/app/index.html @@ -6,7 +6,5 @@
- - \ No newline at end of file diff --git a/app/script/App.tsx b/app/script/App.tsx index 899694f..8955811 100644 --- a/app/script/App.tsx +++ b/app/script/App.tsx @@ -10,29 +10,70 @@ import "font-awesome/css/font-awesome.css" import "app/style/app.css"; @observer -class SectionRow extends React.PureComponent<{ section: Section }, void> { - render() { - const { name, state } = this.props.section; +class SectionTable extends React.PureComponent<{ sections: Section[] }, void> { + static renderRow(section: Section, index: number) { + const { name, state } = section; return ( - + Section {name} State: {state + ""} ); } + + render() { + return ( + + + Sections + + + Name + State + + + + { + this.props.sections.map(SectionTable.renderRow) + } + +
+ ); + } } @observer -class ProgramRow extends React.PureComponent<{ program: Program }, void> { - render() { - const { name, running } = this.props.program; +class ProgramTable extends React.PureComponent<{ programs: Program[] }, void> { + static renderRow(program: Program, i: number) { + const { name, running } = program; return ( - + Program {name} running: {running + ""} ); } + + render() { + return ( + + + + Programs + + + Name + Running + + + + { + this.props.programs.map(ProgramTable.renderRow) + } + +
+ ); + } } @observer @@ -58,30 +99,8 @@ class DeviceView extends React.PureComponent<{ device: SprinklersDevice }, void> - - - - Sections - - - - { - sections.map((s, i) => ) - } - -
- - - - Programs - - - - { - programs.map((p, i) => ) - } - -
+ + ); diff --git a/app/style/app.css b/app/style/app.css index 26eda8d..f6c6571 100644 --- a/app/style/app.css +++ b/app/style/app.css @@ -12,4 +12,8 @@ .section--state { +} + +.program--name { + width: 200px; } \ No newline at end of file