diff --git a/client/src/App.js b/client/src/App.js index 652d5a4..18d2348 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -196,12 +196,12 @@ function SolarPower({end, duration}) { ); } -function OutsideTemperature({end, duration}) { - const [data, loading, tickFormatter] = useSensor('temperature', 'Outside', end, duration); +function Temperature({name, sensorName, end, duration, yDomain, showHumidity, showFreezingLine}) { + const [data, loading, tickFormatter] = useSensor('temperature', sensorName, end, duration); return ( x.temperature_C?.toFixed(1) + ' °C'} loading={loading} @@ -211,62 +211,18 @@ function OutsideTemperature({end, duration}) { minTickGap={10} tickFormatter={tickFormatter} /> + {showHumidity && + + } - - v.toFixed(1) + ' °C'} - labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} - separator=': ' - /> - - - - - - - - - ); -} - -function NookTemperature({end, duration}) { - const [data, loading, tickFormatter] = useSensor('temperature', 'Nook', end, duration); - - return ( - x.temperature_C?.toFixed(1) + ' °C'} - loading={loading} - > - - - - - v.toFixed(1) + units[name]} @@ -274,14 +230,16 @@ function NookTemperature({end, duration}) { separator=': ' /> - - + {showFreezingLine && + + + } - + - - + {showHumidity && + + } ); } -function BedroomTemperature({end, duration}) { - const [data, loading, tickFormatter] = useSensor('temperature', 'Bedroom', end, duration); - - return ( - x.temperature_C?.toFixed(1) + ' °C'} - loading={loading} - > - - - - - - - v.toFixed(1) + units[name]} - labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} - separator=': ' - /> - - - - - - - - - - - ); -} - -function BasementTemperature({end, duration}) { - const [data, loading, tickFormatter] = useSensor('temperature', 'Basement', end, duration); - - return ( - x.temperature_C?.toFixed(1) + ' °C'} - loading={loading} - > - - - - - - - v.toFixed(1) + units[name]} - labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} - separator=': ' - /> - - - - - - - - ); -} - -function MiscTemperature({end, duration}) { - const [data, loading, tickFormatter] = useSensor('temperature', 'Misc', end, duration); - - return ( - x.temperature_C?.toFixed(1) + ' °C'} - loading={loading} - > - - - - - - - v.toFixed(1) + units[name]} - labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} - separator=': ' - /> - - - - - - - - ); -} - -function SeedsTemperature({end, duration}) { - const [data, loading, tickFormatter] = useSensor('temperature', 'Seeds', end, duration); - - return ( - x.temperature_C?.toFixed(1) + ' °C'} - loading={loading} - > - - - - - - - v.toFixed(1) + units[name]} - labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} - separator=': ' - /> - - - - - - - - ); -} function Thermostat({end, duration}) { const [data, loading, tickFormatter] = useSensor('thermostat', 'Venstar', end, duration); @@ -1018,12 +730,12 @@ function Graphs({end, duration}) { - - - - - - + + + + + +