show time in block (#1158)

This commit is contained in:
Alex Christoffer Rasmussen
2024-07-31 14:00:40 +02:00
committed by GitHub
parent dffccd258f
commit a103f8b347
2 changed files with 11 additions and 0 deletions
@@ -180,6 +180,8 @@ export const useRuntimePlaybackOverview = () => {
numEvents: state.runtime.numEvents, numEvents: state.runtime.numEvents,
selectedEventIndex: state.runtime.selectedEventIndex, selectedEventIndex: state.runtime.selectedEventIndex,
offset: state.runtime.offset, offset: state.runtime.offset,
currentBlock: state.currentBlock,
}); });
return useRuntimeStore(featureSelector); return useRuntimeStore(featureSelector);
@@ -33,6 +33,7 @@ function _EditorOverview({ children }: { children: React.ReactNode }) {
<TimeRow label='Actual start' value={formatedTime(actualStart)} className={style.start} /> <TimeRow label='Actual start' value={formatedTime(actualStart)} className={style.start} />
</div> </div>
<ProgressOverview /> <ProgressOverview />
<CurrentBlockOverview />
<RuntimeOverview /> <RuntimeOverview />
<div> <div>
<TimeRow label='Planned end' value={plannedEndText} className={style.end} daySpan={maybePlannedDaySpan} /> <TimeRow label='Planned end' value={plannedEndText} className={style.end} daySpan={maybePlannedDaySpan} />
@@ -94,6 +95,14 @@ function TitlesOverview() {
); );
} }
function CurrentBlockOverview() {
const { currentBlock, clock } = useRuntimePlaybackOverview();
const timeInBlock = formatedTime(currentBlock.startedAt === null ? null : clock - currentBlock.startedAt);
return <TimeColumn label='Time in block' value={timeInBlock} className={style.clock} />;
}
function TimerOverview() { function TimerOverview() {
const { current } = useTimer(); const { current } = useTimer();