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" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<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">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -168,14 +168,20 @@ function BatteryBar({ charge, capacity, config, label, status }) {
|
||||
</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;
|
||||
const normalized = (charge - config.warn) / span;
|
||||
const normalized = (charge - normalizedConfig.warn) / span;
|
||||
const percent = Math.min(1, Math.max(0, normalized));
|
||||
const percentDisplay = Math.round(percent * 100);
|
||||
const percentText = `${percentDisplay}%`;
|
||||
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 capText = capacity ? `${charge}/${capacity}` : `${charge}`;
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user