refactor: invert offset

This commit is contained in:
Carlos Valente
2024-04-26 14:58:58 +02:00
committed by Carlos Valente
parent 8b5034efbf
commit 8da8a08464
5 changed files with 34 additions and 72 deletions
@@ -116,7 +116,7 @@ function RuntimeOverview() {
const { clock, offset } = useRuntimePlaybackOverview();
const offsetText = getOffsetText(offset);
const offsetClasses = offset === null ? undefined : offset > 0 ? style.behind : style.ahead;
const offsetClasses = offset === null ? undefined : offset <= 0 ? style.behind : style.ahead;
return (
<>
@@ -38,10 +38,5 @@ export function getOffsetText(offset: MaybeNumber): string {
if (offset === null) {
return enDash;
}
const isAhead = offset <= 0;
let offsetText = millisToString(Math.abs(offset), { fallback: enDash });
if (offsetText !== enDash) {
offsetText = isAhead ? `+${offsetText}` : `${enDash}${offsetText}`;
}
return offsetText;
return millisToString(offset, { fallback: enDash });
}