From d5f5e08a3c600e728129fa3dd66dc81715e4aea3 Mon Sep 17 00:00:00 2001 From: "Tanner Collin (aider)" Date: Thu, 3 Jul 2025 22:27:39 +0000 Subject: [PATCH] refactor: Abstract Lux components into single component --- client/src/App.js | 100 +++------------------------------------------- 1 file changed, 6 insertions(+), 94 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index 56951d7..434993b 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1088,100 +1088,12 @@ function BedroomSleep({end, duration}) { ); } -function LivingRoomLux({end, duration}) { - const [data, loading, tickFormatter] = useSensor('lux', 'Living Room', end, duration); +function Lux({name, sensorName, end, duration}) { + const [data, loading, tickFormatter] = useSensor('lux', sensorName, end, duration); return ( x.lux?.toFixed(1) + ' lx'} - loading={loading} - > - - - - - - v.toFixed(1) + units[name]} - labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} - separator=': ' - /> - - - - - - ); -} - -function KitchenLux({end, duration}) { - const [data, loading, tickFormatter] = useSensor('lux', 'Kitchen', end, duration); - - return ( - x.lux?.toFixed(1) + ' lx'} - loading={loading} - > - - - - - - v.toFixed(1) + units[name]} - labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} - separator=': ' - /> - - - - - - ); -} - -function BedroomLux({end, duration}) { - const [data, loading, tickFormatter] = useSensor('lux', 'Bedroom', end, duration); - - return ( - x.lux?.toFixed(1) + ' lx'} loading={loading} @@ -1292,9 +1204,9 @@ function Graphs({end, duration}) { - - - + + +