mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 06:59:09 +00:00
refactor: finish view directory migration
This commit is contained in:
committed by
Carlos Valente
parent
2f3cf9825a
commit
08b8e73393
@@ -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>;
|
||||
}
|
||||
Reference in New Issue
Block a user