show voltage in less situations

This commit is contained in:
sctanf
2025-12-14 14:17:03 -06:00
parent d3eafb8d06
commit c9783d097b
3 changed files with 7 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ export function TrackerBattery({
voltage,
runtime,
disabled,
moreInfo = false,
textColor = 'primary',
}: {
/**
@@ -17,6 +18,7 @@ export function TrackerBattery({
voltage?: number | null;
runtime?: bigint | null;
disabled?: boolean;
moreInfo?: boolean;
textColor?: string;
}) {
const { currentLocales } = useLocaleConfig();
@@ -30,7 +32,8 @@ export function TrackerBattery({
});
const charging = (voltage || 0) > 4.3;
const showVoltage = voltage && config?.debug;
const debug = config?.debug || config?.devSettings.moreInfo;
const showVoltage = moreInfo && voltage && debug;
return (
<div className="flex gap-2">
@@ -47,7 +50,7 @@ export function TrackerBattery({
'min'}
</Typography>
)}
{!charging && (!runtime || showVoltage) && (
{!charging && (!runtime || debug) && (
<Typography color={textColor}>
{percentFormatter.format(value)}
</Typography>

View File

@@ -53,6 +53,7 @@ function TrackerBig({
value={device.hardwareStatus.batteryPctEstimate / 100}
runtime={device.hardwareStatus.batteryRuntimeEstimate}
disabled={tracker.status === TrackerStatusEnum.DISCONNECTED}
moreInfo={true}
/>
)}
<div className="flex gap-2">

View File

@@ -231,6 +231,7 @@ function Row({
voltage={device.hardwareStatus.batteryVoltage}
runtime={device.hardwareStatus.batteryRuntimeEstimate}
disabled={tracker.status === TrackerStatusEnum.DISCONNECTED}
moreInfo={config?.devSettings.moreInfo}
textColor={fontColor}
/>
)}