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 && ( + )}