From 1052cf9bb9a528c05f99618ecc1488fb14d0896f Mon Sep 17 00:00:00 2001 From: "Tanner Collin (aider)" Date: Thu, 3 Jul 2025 22:32:46 +0000 Subject: [PATCH] refactor: abstract air quality components --- client/src/App.js | 188 ++-------------------------------------------- 1 file changed, 6 insertions(+), 182 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index 9f48d30..652d5a4 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -781,12 +781,12 @@ function LivingRoomDust({end, duration}) { ); } -function LivingRoomAir({end, duration}) { - const [data, loading, tickFormatter] = useSensor('air', 'Living Room', end, duration); +function Air({name, sensorName, end, duration}) { + const [data, loading, tickFormatter] = useSensor('air', sensorName, end, duration); return ( x.max_p10?.toFixed(1) + ' ug/m³'} loading={loading} @@ -870,183 +870,7 @@ function LivingRoomAir({end, duration}) { ); } -function KitchenAir({end, duration}) { - const [data, loading, tickFormatter] = useSensor('air', 'Kitchen', end, duration); - return ( - x.max_p10?.toFixed(1) + ' ug/m³'} - loading={loading} - > - - - - - - - - v + units[name]} - labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} - separator=': ' - /> - - - - - - - - - - - - ); -} - -function BedroomAir({end, duration}) { - const [data, loading, tickFormatter] = useSensor('air', 'Bedroom', end, duration); - - return ( - x.max_p10?.toFixed(1) + ' ug/m³'} - loading={loading} - > - - - - - - - - v + units[name]} - labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} - separator=': ' - /> - - - - - - - - - - - - ); -} function BedroomSleep({end, duration}) { const [data, loading, tickFormatter] = useSensor('sleep', 'Bedroom', end, duration); @@ -1191,9 +1015,9 @@ function Graphs({end, duration}) {
- - - + + +