From 9f41a26c6b4c32f9474b44d673ffc7b86279e3e2 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Thu, 30 Jul 2026 09:08:48 +0000 Subject: [PATCH] Fix regen-tank inversion in water softener diagram MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The regenerating tank is the one NOT currently in service — on an alternating twin-tank softener, service switches to the other tank the moment one depletes, and the just-depleted tank regenerates offline. Was previously showing regen on the in-service tank. Also splits the flow indicator so it visually tracks whichever tank is actually regenerating. --- .../src/components/WaterSoftenerDiagram.tsx | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/WaterSoftenerDiagram.tsx b/frontend/src/components/WaterSoftenerDiagram.tsx index edc79da..4531c67 100644 --- a/frontend/src/components/WaterSoftenerDiagram.tsx +++ b/frontend/src/components/WaterSoftenerDiagram.tsx @@ -89,6 +89,23 @@ export default function WaterSoftenerDiagram({ asset }: { asset: AssetStatus }) const bPct = bValL !== null && cfg.tank_b_max_l ? (bValL / cfg.tank_b_max_l) * 100 : null const brinePct = numericValue(brineField) + // On an alternating twin-tank softener, service switches to the other tank + // the moment one depletes, and the just-depleted tank regenerates offline — + // so the regenerating tank is whichever one is NOT tank_in_service. A single + // tank has no partner to switch to, so it simply tracks regen_active. + const aRegenerating = single ? regenActive : regenActive && bInService + const bRegenerating = regenActive && !bInService + + function Flow({ active }: { active: boolean }) { + return ( + + ) + } + return (
{regenActive && ( @@ -105,26 +122,25 @@ export default function WaterSoftenerDiagram({ asset }: { asset: AssetStatus }) variant="single" regenerating={false} /> - + {!single && ( - + <> + + + )}