V3 feedback (#866)

* refactor: rename settings panel

* style: typo

* style: fix blackout position

* fix: offset time in time-to-end

* refactor: operator is protected

* style: tweaks to pincode

* refactor: close params editor on submit

* refactor: same navigation in all pages

* refactor: use cached response
This commit is contained in:
Carlos Valente
2024-04-02 22:45:03 +02:00
committed by GitHub
parent 10852eecdd
commit 01c2ef4c4d
27 changed files with 184 additions and 212 deletions
@@ -1664,7 +1664,7 @@ describe('getRuntimeOffset()', () => {
expectedEnd: 81600000, // 22:40:00
},
timer: {
addedTime: 0,
addedTime: -200000,
current: -400000,
duration: 3600000,
elapsed: 4000000,
@@ -1678,7 +1678,7 @@ describe('getRuntimeOffset()', () => {
} as RuntimeState;
const offset = getRuntimeOffset(state);
expect(offset).toBe(-400000);
expect(offset).toBe(400000); // <--- offset is always the overtime
});
it('handles time-to-end started after the end time', () => {
@@ -1732,7 +1732,8 @@ describe('getRuntimeOffset()', () => {
const updateCurrent = getCurrent(state);
state.timer.current = updateCurrent;
const offset = getRuntimeOffset(state);
expect(offset).toBe(81000000 - 82000000); // <-- planned end - now
expect(millisToString(offset)).toBe('00:16:40');
expect(offset).toBe(82000000 - 81000000); // <-- now - planned end
});
});
+2 -2
View File
@@ -313,7 +313,7 @@ export function getRuntimeOffset(state: RuntimeState): MaybeNumber {
return clock - timeStart;
}
const overtime = Math.min(current, 0);
const overtime = Math.abs(Math.min(current, 0));
// in time-to-end, offset is overtime
if (timerType === TimerType.TimeToEnd) {
return overtime;
@@ -322,7 +322,7 @@ export function getRuntimeOffset(state: RuntimeState): MaybeNumber {
const startOffset = startedAt - timeStart;
const pausedTime = state._timer.pausedAt === null ? 0 : clock - state._timer.pausedAt;
return startOffset + addedTime + pausedTime + Math.abs(overtime);
return startOffset + addedTime + pausedTime + overtime;
}
/**