refactor: timer design review

This commit is contained in:
Carlos Valente
2025-07-12 11:55:49 +02:00
parent 2aac4cb06d
commit 05d01e0863
9 changed files with 131 additions and 33 deletions
@@ -9,7 +9,6 @@ import Input from '../../../common/components/input/input/Input';
import TimeInput from '../../../common/components/input/time-input/TimeInput';
import Modal from '../../../common/components/modal/Modal';
import Select from '../../../common/components/select/Select';
import Switch from '../../../common/components/switch/Switch';
import { editorSettingsDefaults, useEditorSettings } from '../../../common/stores/editorSettings';
import * as Panel from '../panel-utils/PanelUtils';
@@ -55,6 +55,18 @@ export function isStringBoolean(text: string | null) {
return text?.toLowerCase() === 'true' || text === '1';
}
/**
* Prepares a colour string for use in views
* Colours in params do not have the #prefix
*/
export function makeColourString(hex: string | null): string | undefined {
if (!hex) {
return undefined;
}
// ensure the hex starts with a #
return hex.startsWith('#') ? hex : `#${hex}`;
}
/**
* Retrieves a dynamic property from an event
* Considers custom fields