mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-19 06:04:05 +00:00
refactor: extract time-to-end
This commit is contained in:
committed by
Carlos Valente
parent
41fe213ebb
commit
0f3feca7ab
@@ -9,6 +9,7 @@ import {
|
||||
Settings,
|
||||
SimpleTimerState,
|
||||
SupportedEvent,
|
||||
TimerType,
|
||||
ViewSettings,
|
||||
} from 'ontime-types';
|
||||
import { useStore } from 'zustand';
|
||||
@@ -74,16 +75,14 @@ const withData = <P extends WithDataProps>(Component: ComponentType<P>) => {
|
||||
const selectedId = eventNow?.id ?? null;
|
||||
const nextId = eventNext?.id ?? null;
|
||||
|
||||
/******************************************/
|
||||
/*** + TimeManagerType ***/
|
||||
/*** WRAP INFORMATION RELATED TO TIME ***/
|
||||
/*** -------------------------------- ***/
|
||||
/******************************************/
|
||||
|
||||
const TimeManagerType = {
|
||||
/**
|
||||
* Contains an extended timer object with properties from the current event
|
||||
*/
|
||||
const timeManagerType: ViewExtendedTimer = {
|
||||
...timer,
|
||||
clock,
|
||||
timerType: eventNow?.timerType ?? null,
|
||||
timerType: eventNow?.timerType ?? TimerType.CountDown,
|
||||
isTimeToEnd: eventNow?.isTimeToEnd ?? false,
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -108,7 +107,7 @@ const withData = <P extends WithDataProps>(Component: ComponentType<P>) => {
|
||||
runtime={runtime}
|
||||
selectedId={selectedId}
|
||||
settings={settings}
|
||||
time={TimeManagerType}
|
||||
time={timeManagerType}
|
||||
viewSettings={viewSettings}
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user