mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 12:53:32 +00:00
breaking: convert offset > over-under
change offset direction and relabel to over-under
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { ViewSettings } from 'ontime-types';
|
||||
|
||||
export const viewsSettingsPlaceholder: ViewSettings = {
|
||||
dangerColor: '#ED3333',
|
||||
dangerColor: '#ff7300',
|
||||
normalColor: '#ffffffcc',
|
||||
overrideStyles: false,
|
||||
warningColor: '#FFAB33',
|
||||
warningColor: '#ffa528',
|
||||
};
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { MaybeNumber } from 'ontime-types';
|
||||
import { millisToString } from 'ontime-utils';
|
||||
|
||||
import { enDash } from './styleUtils';
|
||||
|
||||
/**
|
||||
* Formats offset text
|
||||
*/
|
||||
export function getOffsetText(offset: MaybeNumber): string {
|
||||
if (offset === null) {
|
||||
return enDash;
|
||||
}
|
||||
|
||||
let offsetText = '';
|
||||
if (offset < 0) offsetText += '-';
|
||||
if (offset > 0) offsetText += '+';
|
||||
offsetText += millisToString(Math.abs(offset));
|
||||
return offsetText;
|
||||
}
|
||||
|
||||
export function getOffsetState(offset: MaybeNumber): 'ahead' | 'behind' | 'muted' | null {
|
||||
if (offset === null) return null;
|
||||
if (offset === 0) return 'muted';
|
||||
return offset < 0 ? 'behind' : 'ahead';
|
||||
}
|
||||
Reference in New Issue
Block a user