mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-15 17:12:59 -04:00
guh
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
|||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>webui</title>
|
<title>webui</title>
|
||||||
<script type="module" crossorigin src="/assets/index-DeMYMr-m.js"></script>
|
<script type="module" crossorigin src="/assets/index-sCjLoHHT.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-BLqBO1Eu.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-BLqBO1Eu.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -168,14 +168,20 @@ function BatteryBar({ charge, capacity, config, label, status }) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const span = config.full - config.warn;
|
const normalizedConfig = {
|
||||||
|
full: config.full ?? config.Full ?? 0,
|
||||||
|
warn: config.warn ?? config.Warn ?? 0,
|
||||||
|
urgent: config.urgent ?? config.Urgent ?? null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const span = normalizedConfig.full - normalizedConfig.warn;
|
||||||
if (span <= 0) return null;
|
if (span <= 0) return null;
|
||||||
const normalized = (charge - config.warn) / span;
|
const normalized = (charge - normalizedConfig.warn) / span;
|
||||||
const percent = Math.min(1, Math.max(0, normalized));
|
const percent = Math.min(1, Math.max(0, normalized));
|
||||||
const percentDisplay = Math.round(percent * 100);
|
const percentDisplay = Math.round(percent * 100);
|
||||||
const percentText = `${percentDisplay}%`;
|
const percentText = `${percentDisplay}%`;
|
||||||
const depleted = normalized <= 0;
|
const depleted = normalized <= 0;
|
||||||
const urgent = config.urgent != null && charge <= config.urgent;
|
const urgent = normalizedConfig.urgent != null && charge <= normalizedConfig.urgent;
|
||||||
const barClass = depleted ? 'bg-red-500 animate-pulse' : urgent ? 'bg-amber-400' : 'bg-emerald-500';
|
const barClass = depleted ? 'bg-red-500 animate-pulse' : urgent ? 'bg-amber-400' : 'bg-emerald-500';
|
||||||
const capText = capacity ? `${charge}/${capacity}` : `${charge}`;
|
const capText = capacity ? `${charge}/${capacity}` : `${charge}`;
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user