fix: presenter view

presenter view shows time correctly when rolling
This commit is contained in:
cv
2021-05-26 20:42:05 +02:00
parent f78c16fb8c
commit c310249cd3
2 changed files with 6 additions and 7 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ const withSocket = (Component) => {
}); });
const [timer, setTimer] = useState({ const [timer, setTimer] = useState({
clock: null, clock: null,
currentSeconds: null, running: null,
startedAt: null, startedAt: null,
expectedFinish: null, expectedFinish: null,
}); });
@@ -221,7 +221,7 @@ const withSocket = (Component) => {
// get clock string // get clock string
const timeManager = { const timeManager = {
...timer, ...timer,
finished: timer.running <= 0 && timer.startedAt, finished: playback === 'start' && timer.running <= 0 && timer.startedAt,
clock: stringFromMillis(timer.clock), clock: stringFromMillis(timer.clock),
playstate: playback, playstate: playback,
}; };
@@ -14,10 +14,9 @@ export default function PresenterView(props) {
document.title = 'ontime - Speaker Screen'; document.title = 'ontime - Speaker Screen';
}, []); }, []);
const showOverlay = pres.text !== '' && pres.visible; const showOverlay = pres.text !== '' && pres.visible;
const isPlaying = time.playstate === 'start'; const isPlaying = time.playstate !== 'pause';
const normalisedTime = Math.max(time.running, 0);
// motion // motion
const titleVariants = { const titleVariants = {
@@ -61,7 +60,7 @@ export default function PresenterView(props) {
<div className={style.finished}>TIME UP</div> <div className={style.finished}>TIME UP</div>
) : ( ) : (
<div className={isPlaying ? style.countdown : style.countdownPaused}> <div className={isPlaying ? style.countdown : style.countdownPaused}>
<Countdown time={time.currentSeconds} hideZeroHours /> <Countdown time={normalisedTime} hideZeroHours />
</div> </div>
)} )}
</div> </div>
@@ -73,7 +72,7 @@ export default function PresenterView(props) {
} }
> >
<MyProgressBar <MyProgressBar
now={time.currentSeconds} now={normalisedTime}
complete={time.durationSeconds} complete={time.durationSeconds}
showElapsed showElapsed
/> />