mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 15:09:10 +00:00
Hotfix/countdown delay (#175)
* hotfix/countdown-delay: fix styling on overran event * hotfix/countdown-delay: prevent falsy issue * hotfix/countdown-delay: show delay in countdown * hotfix/countdown-delay: version bump
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ontime-ui",
|
"name": "ontime-ui",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chakra-ui/react": "^2.0.0-next.3",
|
"@chakra-ui/react": "^2.0.0-next.3",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useMemo, useState } from 'react';
|
||||||
import { Link, useSearchParams } from 'react-router-dom';
|
import { Link, useSearchParams } from 'react-router-dom';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ import { formatDisplay, millisToSeconds } from '../../../common/utils/dateConfig
|
|||||||
import getDelayTo from '../../../common/utils/getDelayTo';
|
import getDelayTo from '../../../common/utils/getDelayTo';
|
||||||
import { stringFromMillis } from '../../../common/utils/time';
|
import { stringFromMillis } from '../../../common/utils/time';
|
||||||
|
|
||||||
import { fetchTimerData, sanitiseTitle } from './countdown.helpers';
|
import { fetchTimerData, sanitiseTitle, timerMessages } from './countdown.helpers';
|
||||||
|
|
||||||
import style from './Countdown.module.scss';
|
import style from './Countdown.module.scss';
|
||||||
|
|
||||||
@@ -61,7 +61,17 @@ export default function Countdown(props) {
|
|||||||
setRunningTimer(timer);
|
setRunningTimer(timer);
|
||||||
}, [follow, selectedId, time]);
|
}, [follow, selectedId, time]);
|
||||||
|
|
||||||
const standby = time.playstate !== 'start' && selectedId === follow?.id;
|
const standby = useMemo(
|
||||||
|
() => time.playstate !== 'start' && selectedId === follow?.id,
|
||||||
|
[follow?.id, selectedId, time.playstate]
|
||||||
|
);
|
||||||
|
|
||||||
|
const isRunningFinished = useMemo(
|
||||||
|
() => time.finished && runningMessage === timerMessages.running,
|
||||||
|
[time.finished, runningMessage]
|
||||||
|
);
|
||||||
|
|
||||||
|
const isSelected = useMemo(() => runningMessage === timerMessages.running, [runningMessage]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.container}>
|
<div className={style.container}>
|
||||||
@@ -106,10 +116,14 @@ export default function Countdown(props) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={style.status}>{runningMessage}</div>
|
<div className={style.status}>{runningMessage}</div>
|
||||||
<span className={`${style.countdownClock} ${standby ? style.standby : ''} ${time.finished ? style.finished : ''}`}>
|
<span
|
||||||
|
className={`${style.countdownClock} ${standby ? style.standby : ''} ${
|
||||||
|
isRunningFinished ? style.finished : ''
|
||||||
|
}`}
|
||||||
|
>
|
||||||
{formatDisplay(
|
{formatDisplay(
|
||||||
time.running ? runningTimer : runningTimer + millisToSeconds(delay),
|
isSelected ? runningTimer : runningTimer + millisToSeconds(delay),
|
||||||
time.running || time.waiting
|
isSelected || time.waiting
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
<div className={style.title}>{follow.title || 'Untitled Event'}</div>
|
<div className={style.title}>{follow.title || 'Untitled Event'}</div>
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ontime",
|
"name": "ontime",
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"author": "Carlos Valente",
|
"author": "Carlos Valente",
|
||||||
"description": "Time keeping for live events",
|
"description": "Time keeping for live events",
|
||||||
"repository": "https://github.com/cpvalente/ontime",
|
"repository": "https://github.com/cpvalente/ontime",
|
||||||
|
|||||||
Reference in New Issue
Block a user