refactor(roll breaking): make starting with roll backtrace planned times

This commit is contained in:
Carlos Valente
2025-09-20 17:24:27 +02:00
committed by Carlos Valente
parent d04f958c11
commit 00aa8a09fa
4 changed files with 28 additions and 20 deletions
@@ -230,7 +230,6 @@ export const useOffsetOverview = createSelector((state: RuntimeStore) => ({
export const useGroupTimerOverView = createSelector((state: RuntimeStore) => ({
clock: state.clock,
offset: state.offset.mode === OffsetMode.Absolute ? state.offset.absolute : state.offset.relative,
mode: state.offset.mode,
groupExpectedEnd: state.offset.expectedGroupEnd,
// we can force these numbers to 0 fo this use case to avoid null checks
@@ -100,7 +100,7 @@ export function MetadataTimes() {
}
function GroupTimes() {
const { clock, groupExpectedEnd, actualGroupStart, mode, playback, currentDay } = useGroupTimerOverView();
const { clock, mode, groupExpectedEnd, actualGroupStart, currentDay, playback } = useGroupTimerOverView();
const { currentGroupId } = useCurrentGroupId();
const group = useEntry(currentGroupId) as OntimeGroup | null;
@@ -111,6 +111,7 @@ function GroupTimes() {
if (!active) return null;
if (!group || group.timeStart === null) return null;
const normalizedClock = clock + currentDay * dayInMs;
return mode === OffsetMode.Absolute
? group.timeStart + group.duration - normalizedClock
: actualGroupStart + group.duration - normalizedClock;
@@ -121,11 +122,9 @@ function GroupTimes() {
const expectedGroupEnd = groupExpectedEnd !== null ? groupExpectedEnd - clock : null;
const expectedTimeUntilGroupEnd = formatDueTime(expectedGroupEnd, 3, TimerType.CountDown);
const groupTitle = group?.title ?? null;
return (
<div className={style.metadataRow}>
<span className={groupTitle ? style.labelTitle : style.label}>{`${groupTitle || 'Group'} `}</span>
<span className={group?.title ? style.labelTitle : style.label}>{`${group?.title || 'Group'} `}</span>
<div className={style.labelledElement}>
<Tooltip text='Time to planned group end' render={<TbFolderPin className={style.icon} />} />
<span