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
@@ -26,10 +26,10 @@ describe('makeOptionsFromCustomFields()', () => {
];
const result = makeOptionsFromCustomFields(testCustomFields, additionalData);
expect(result).toStrictEqual([
{ value: 'custom-field1', label: 'Custom: Field 1' },
{ value: 'custom-field2', label: 'Custom: Field 2' },
{ value: 'test1', label: 'Test 1' },
{ value: 'test2', label: 'Test 2' },
{ value: 'custom-field1', label: 'Custom: Field 1' },
{ value: 'custom-field2', label: 'Custom: Field 2' },
]);
});
@@ -4,8 +4,8 @@ export const getTimeOption = (timeFormat: string): ParamField => {
const placeholder = `${timeFormat} (default)`;
return {
id: 'timeformat',
title: 'Time format string, taken from the Application Settings',
description: 'Format for auxiliar time fields (not the running), eg. HH:mm:ss or hh:mm:ss a, see docs for help',
title: 'Clock time format, defaults to value from the Settings',
description: 'Format for the Time Now field, eg. HH:mm:ss or hh:mm:ss a, see docs for help',
type: 'string',
placeholder,
};
@@ -13,7 +13,7 @@ export function makeOptionsFromCustomFields(
additionalOptions: SelectOption[] = [],
filterImageType = true,
): SelectOption[] {
const options: SelectOption[] = [];
const options: SelectOption[] = [...additionalOptions];
// Add custom fields first
for (const [key, value] of Object.entries(customFields)) {
@@ -27,7 +27,7 @@ export function makeOptionsFromCustomFields(
});
}
return options.concat(additionalOptions);
return options;
}
/**