Can set relay forced state from UI
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-29 17:49:03 +01:00
parent 88a24565b4
commit abdca20a66
6 changed files with 178 additions and 10 deletions

View File

@@ -51,13 +51,14 @@ export function timeDiff(a: number, b: number): string {
return `${diffYears} years`;
}
export function timeDiffFromNow(t: number): string {
return timeDiff(t, time());
export function timeDiffFromNow(t: number, future?: boolean): string {
return future ? timeDiff(time(), t) : timeDiff(t, time());
}
export function TimeWidget(p: {
time?: number;
diff?: boolean;
future?: boolean;
}): React.ReactElement {
if (!p.time) return <></>;
return (
@@ -65,7 +66,9 @@ export function TimeWidget(p: {
title={formatDate(p.diff ? new Date().getTime() / 1000 - p.time : p.time)}
arrow
>
<span>{p.diff ? timeDiff(0, p.time) : timeDiffFromNow(p.time)}</span>
<span>
{p.diff ? timeDiff(0, p.time) : timeDiffFromNow(p.time, p.future)}
</span>
</Tooltip>
);
}