2016-02-13 16:49:32 -06:00
import React from 'react' ;
import _ from 'lodash' ;
function repeatEnergy _datum1 ( energy _datum , energy _datumIndex ) {
return React . createElement ( 'tr' , { 'key' : energy _datum . react _key } , React . createElement ( 'td' , { } ) , React . createElement ( 'td' , { } , energy _datum . day _to _s ) , React . createElement ( 'td' , { } , energy _datum . consumption _to _s ) , React . createElement ( 'td' , { } , energy _datum . production _to _s ) ) ;
}
export default function ( ) {
2016-02-15 11:38:41 -06:00
return React . createElement ( 'div' , { 'id' : 'energy_view' } , this . state . loading _data ? React . createElement ( 'div' , { 'className' : 'alert alert-warning' } , '\n Retrieving energy data for the ' , this . props . house . name , ' household...\n ' ) : null , this . props . view === 'graph' ? React . createElement ( 'div' , { } , React . createElement ( 'h4' , { } , 'Select Data' ) , React . createElement ( 'div' , {
2016-02-13 16:49:32 -06:00
'className' : 'btn-group' ,
'role' : 'group'
} , React . createElement ( 'button' , {
'data-value' : 'consumption' ,
'className' : _ . keys ( _ . pick ( { active : this . state . graph _attr === 'consumption' } , _ . identity ) ) . join ( ' ' ) + ' ' + 'btn btn-primary' ,
'onClick' : this . setGraphAttr ,
'type' : 'button'
} , 'Consumption' ) , React . createElement ( 'button' , {
'data-value' : 'production' ,
'className' : _ . keys ( _ . pick ( { active : this . state . graph _attr === 'production' } , _ . identity ) ) . join ( ' ' ) + ' ' + 'btn btn-primary' ,
'onClick' : this . setGraphAttr ,
'type' : 'button'
2016-02-15 11:38:41 -06:00
} , 'Production' ) ) ) : null , this . props . view === 'table' ? React . createElement ( 'table' , { 'className' : 'table' } , React . createElement ( 'thead' , { } , React . createElement ( 'tr' , { } , React . createElement ( 'th' , { } ) , React . createElement ( 'th' , { } , 'Day' ) , React . createElement ( 'th' , { } , 'Consumption (kWh)' ) , React . createElement ( 'th' , { } , 'Production (kWh)' ) ) ) , React . createElement . apply ( this , [
2016-02-13 16:49:32 -06:00
'tbody' ,
{ } ,
_ . map ( this . props . house . energy _data , repeatEnergy _datum1 . bind ( this ) )
2016-02-15 11:38:41 -06:00
] ) ) : null , this . props . view === 'graph' ? React . createElement ( 'div' , { 'id' : 'energy_graph' } ) : null ) ;
2016-02-13 16:49:32 -06:00
} ;