refactor: finish view directory migration

This commit is contained in:
Carlos Valente
2025-12-21 13:19:27 +01:00
committed by Carlos Valente
parent 2f3cf9825a
commit 08b8e73393
28 changed files with 32 additions and 32 deletions
@@ -0,0 +1,30 @@
/**
* encapsulate logic related to showing a running timer
*/
import { MaybeNumber } from 'ontime-types';
import { removeLeadingZero, removeSeconds } from 'ontime-utils';
import { formattedTime } from '../../../features/overview/overview.utils';
interface RunningTimeProps {
value: MaybeNumber;
hideSeconds?: boolean;
hideLeadingZero?: boolean;
className?: string;
}
export default function RunningTime(props: RunningTimeProps) {
const { value, hideSeconds, hideLeadingZero, className } = props;
let display = formattedTime(value, hideSeconds || hideLeadingZero ? 2 : 3);
if (hideLeadingZero) {
display = removeLeadingZero(display);
}
if (hideSeconds) {
display = removeSeconds(display);
}
return <div className={className}>{display}</div>;
}