mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-17 21:24:11 +00:00
25 lines
678 B
TypeScript
25 lines
678 B
TypeScript
import { MILLIS_PER_HOUR } from 'ontime-utils';
|
|
|
|
import { useClock } from '../../../../common/hooks/useSocket';
|
|
import { getRelativePositionX } from '../timeline.utils';
|
|
|
|
import style from './TimelineProgressBar.module.scss';
|
|
|
|
interface ProgressBarProps {
|
|
startHour: number;
|
|
endHour: number;
|
|
}
|
|
|
|
export default function ProgressBar(props: ProgressBarProps) {
|
|
const { startHour, endHour } = props;
|
|
const { clock } = useClock();
|
|
|
|
const width = getRelativePositionX(startHour * MILLIS_PER_HOUR, endHour * MILLIS_PER_HOUR, clock);
|
|
|
|
return (
|
|
<div className={style.progressBar}>
|
|
<div className={style.progress} style={{ width: `${width}%` }} />
|
|
</div>
|
|
);
|
|
}
|