mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-17 13:23:35 +00:00
refactor: fixes to custom field
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ interface CustomFieldEntryProps {
|
||||
colour: string;
|
||||
label: string;
|
||||
fieldKey: string;
|
||||
type: 'string' | 'image';
|
||||
type: CustomField['type'];
|
||||
onEdit: (key: CustomFieldKey, patch: CustomField) => Promise<void>;
|
||||
onDelete: (key: CustomFieldKey) => Promise<void>;
|
||||
}
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ export default function CustomFieldForm(props: CustomFieldsFormProps) {
|
||||
watch,
|
||||
formState: { errors, isSubmitting, isValid, isDirty },
|
||||
} = useForm<CustomFieldFormData>({
|
||||
defaultValues: { type: 'string', label: initialLabel || '', colour: initialColour || '' },
|
||||
defaultValues: { type: 'text', label: initialLabel || '', colour: initialColour || '' },
|
||||
resetOptions: {
|
||||
keepDirtyValues: true,
|
||||
},
|
||||
@@ -96,7 +96,7 @@ export default function CustomFieldForm(props: CustomFieldsFormProps) {
|
||||
onValueChange={(value) => setValue('type', value, { shouldDirty: true })}
|
||||
value={watch('type')}
|
||||
items={[
|
||||
{ value: 'string', label: 'Text' },
|
||||
{ value: 'text', label: 'Text' },
|
||||
{ value: 'image', label: 'Image' },
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function EntryEditorCustomFields({
|
||||
const { backgroundColor, color } = getAccessibleColour(customFields[fieldKey].colour);
|
||||
const labelText = customFields[fieldKey].label;
|
||||
|
||||
if (customFields[fieldKey].type === 'string') {
|
||||
if (customFields[fieldKey].type === 'text') {
|
||||
return (
|
||||
<EventTextArea
|
||||
key={key}
|
||||
|
||||
Reference in New Issue
Block a user