mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 07:29:08 +00:00
refactor: extract common utility
This commit is contained in:
committed by
Carlos Valente
parent
56775f621e
commit
0aeec12ccd
@@ -20,6 +20,7 @@ import { formatTime, getDefaultFormat } from '../../common/utils/time';
|
|||||||
import SuperscriptTime from '../../features/viewers/common/superscript-time/SuperscriptTime';
|
import SuperscriptTime from '../../features/viewers/common/superscript-time/SuperscriptTime';
|
||||||
import { getFormattedTimer, getTimerByType } from '../../features/viewers/common/viewUtils';
|
import { getFormattedTimer, getTimerByType } from '../../features/viewers/common/viewUtils';
|
||||||
import { useTranslation } from '../../translation/TranslationProvider';
|
import { useTranslation } from '../../translation/TranslationProvider';
|
||||||
|
import { getTimerColour } from '../utils/presentation.utils';
|
||||||
|
|
||||||
import { getTimerOptions, useTimerOptions } from './timer.options';
|
import { getTimerOptions, useTimerOptions } from './timer.options';
|
||||||
import {
|
import {
|
||||||
@@ -31,7 +32,6 @@ import {
|
|||||||
getShowMessage,
|
getShowMessage,
|
||||||
getShowModifiers,
|
getShowModifiers,
|
||||||
getShowProgressBar,
|
getShowProgressBar,
|
||||||
getTimerColour,
|
|
||||||
getTotalTime,
|
getTotalTime,
|
||||||
} from './timer.utils';
|
} from './timer.utils';
|
||||||
|
|
||||||
|
|||||||
@@ -102,15 +102,6 @@ export function getShowModifiers(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Which colour should the timer have at a given moment
|
|
||||||
*/
|
|
||||||
export function getTimerColour(viewSettings: ViewSettings, showWarning: boolean, showDanger: boolean) {
|
|
||||||
if (showWarning) return viewSettings.warningColor;
|
|
||||||
if (showDanger) return viewSettings.dangerColor;
|
|
||||||
return viewSettings.normalColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What, if anything, should be displayed in the secondary field
|
* What, if anything, should be displayed in the secondary field
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { ViewSettings } from 'ontime-types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which colour should the timer have at a given moment
|
||||||
|
*/
|
||||||
|
export function getTimerColour(viewSettings: ViewSettings, showWarning: boolean, showDanger: boolean) {
|
||||||
|
if (showWarning) return viewSettings.warningColor;
|
||||||
|
if (showDanger) return viewSettings.dangerColor;
|
||||||
|
return viewSettings.normalColor;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user