From e0838cce6c5ed1684a2bf4a33e331efbd6c618ce Mon Sep 17 00:00:00 2001 From: sctanf <36978460+sctanf@users.noreply.github.com> Date: Thu, 22 Jan 2026 17:13:36 -0600 Subject: [PATCH] Battery indicators (#1714) --- .../components/commons/icon/BatteryIcon.tsx | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/gui/src/components/commons/icon/BatteryIcon.tsx b/gui/src/components/commons/icon/BatteryIcon.tsx index 94a8c8975..77311347c 100644 --- a/gui/src/components/commons/icon/BatteryIcon.tsx +++ b/gui/src/components/commons/icon/BatteryIcon.tsx @@ -11,6 +11,9 @@ export function BatteryIcon({ charging: boolean; }) { const col = useMemo(() => { + if (disabled) return 'fill-background-40'; + else if (charging) return 'fill-status-success'; + const colorsMap: { [key: number]: string } = { 0.4: 'fill-status-success', 0.2: 'fill-status-warning', @@ -20,10 +23,8 @@ export function BatteryIcon({ const val = Object.keys(colorsMap) .filter((key) => +key < value) .sort((a, b) => +b - +a)[0]; - return disabled - ? 'fill-background-40' - : colorsMap[+val] || 'fill-background-10'; - }, [value, disabled]); + return colorsMap[+val] || 'fill-background-10'; + }, [value, disabled, charging]); return ( - + - {charging && ( + {charging && value <= 1 && ( + )} + {charging && value > 1 && ( + )}