mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-24 02:51:20 -08:00
Toggle to show battery runtime estimate instead of percentage
This commit is contained in:
4 files changed
+10
-4
No files matched your search
@@ -1154,6 +1154,7 @@ settings-home-table_columns-desc = Choose which columns are shown in the tracker
|
||||
settings-home-display_group = Display
|
||||
settings-home-tracker_display = Tracker info
|
||||
settings-home-tracker_display-desc = Choose which extra details are shown on trackers
|
||||
settings-home-tracker_display-battery_runtime_estimate = Battery runtime estimate
|
||||
settings-home-tracker_display-battery_voltage = Battery voltage
|
||||
settings-home-tracker_display-numeric_signal = Numeric signal strength
|
||||
|
||||
|
||||
@@ -123,11 +123,14 @@ export function TrackersTableColumnsSettings({
|
||||
}
|
||||
|
||||
const trackerDisplayToggleOrder: (keyof TrackerDisplayConfig)[] = [
|
||||
'showBatteryRuntimeEstimate',
|
||||
'showBatteryVoltage',
|
||||
'showNumericSignal',
|
||||
];
|
||||
|
||||
const trackerDisplayToggleLabel: Record<keyof TrackerDisplayConfig, string> = {
|
||||
showBatteryRuntimeEstimate:
|
||||
'settings-home-tracker_display-battery_runtime_estimate',
|
||||
showBatteryVoltage: 'settings-home-tracker_display-battery_voltage',
|
||||
showNumericSignal: 'settings-home-tracker_display-numeric_signal',
|
||||
};
|
||||
|
||||
@@ -33,14 +33,14 @@ export function TrackerBattery({
|
||||
});
|
||||
|
||||
const charging = (voltage || 0) > 4.3;
|
||||
const debug = config?.debug;
|
||||
const showRuntime = config?.trackerDisplay?.showBatteryRuntimeEstimate;
|
||||
const showVoltage = voltage && config?.trackerDisplay?.showBatteryVoltage;
|
||||
|
||||
const pct = value > 2 ? 0 : Math.min(Math.max(value, 0), 1);
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
disabled={charging || !runtime || debug}
|
||||
disabled={charging || !runtime || !showRuntime}
|
||||
preferedDirection="left"
|
||||
content={<Typography>{percentFormatter.format(pct)}</Typography>}
|
||||
>
|
||||
@@ -50,7 +50,7 @@ export function TrackerBattery({
|
||||
</div>
|
||||
{((!charging || showVoltage) && (
|
||||
<div className="w-15">
|
||||
{!charging && runtime != null && runtime > 0 && (
|
||||
{!charging && runtime != null && runtime > 0 && showRuntime && (
|
||||
<Typography color={textColor}>
|
||||
{(runtime / BigInt(3600000000)).toString() +
|
||||
'h ' +
|
||||
@@ -61,7 +61,7 @@ export function TrackerBattery({
|
||||
'min'}
|
||||
</Typography>
|
||||
)}
|
||||
{!charging && (!runtime || debug) && (
|
||||
{!charging && (!runtime || !showRuntime) && (
|
||||
<Typography color={textColor}>
|
||||
{percentFormatter.format(pct)}
|
||||
</Typography>
|
||||
|
||||
@@ -69,11 +69,13 @@ export const trackersTableColumnOrder = [
|
||||
export type TrackersTableOptionalColumn = (typeof trackersTableColumnOrder)[number];
|
||||
|
||||
export interface TrackerDisplayConfig {
|
||||
showBatteryRuntimeEstimate: boolean;
|
||||
showBatteryVoltage: boolean;
|
||||
showNumericSignal: boolean;
|
||||
}
|
||||
|
||||
export const defaultTrackerDisplay: TrackerDisplayConfig = {
|
||||
showBatteryRuntimeEstimate: true,
|
||||
showBatteryVoltage: false,
|
||||
showNumericSignal: false,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user