mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-07 00:13:53 +00:00
ba782d5d22
Fixes issues with approximating timers in the app views
34 lines
1.1 KiB
React
34 lines
1.1 KiB
React
import { useEffect } from 'react';
|
|
import { formatDisplay } from '../../../common/utils/dateConfig';
|
|
import NavLogo from '../../../common/components/nav/NavLogo';
|
|
import style from './MinimalTimer.module.scss';
|
|
|
|
export default function MinimalTimer(props) {
|
|
const { pres, time } = props;
|
|
|
|
// Set window title
|
|
useEffect(() => {
|
|
document.title = 'ontime - Minimal Timer';
|
|
}, []);
|
|
|
|
const showOverlay = pres.text !== '' && pres.visible;
|
|
const isPlaying = time.playstate !== 'pause';
|
|
const timer = formatDisplay(time.running, true);
|
|
const clean = timer.replaceAll(':', '');
|
|
|
|
return (
|
|
<div className={time.finished ? style.containerFinished : style.container}>
|
|
<div className={showOverlay ? style.messageOverlayActive : style.messageOverlay}>
|
|
<div className={style.message}>{pres.text}</div>
|
|
</div>
|
|
<NavLogo />
|
|
<div
|
|
style={{ fontSize: `${89 / (clean.length - 1)}vw` }}
|
|
className={isPlaying ? style.timer : style.timerPaused}
|
|
>
|
|
{time.isNegative ? `-${timer}` : timer}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|