From 3895b86515d601a7bbcfad0eb20abac4d832455c Mon Sep 17 00:00:00 2001 From: valentinkolb Date: Thu, 24 Oct 2024 16:59:17 +0200 Subject: [PATCH] feat(FormInput): submit button text customisable the text of the submit button of the FormInput is now adjustable --- config.ts | 2 +- src/components/formUtil/FromInput/index.tsx | 8 +++++--- src/models/EventTypes.ts | 2 +- src/pages/events/s/EventListSlotView.tsx | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config.ts b/config.ts index 09824d2..4d2bf4e 100644 --- a/config.ts +++ b/config.ts @@ -9,5 +9,5 @@ export const PB_STORAGE_KEY = "stuve-it-login-record" // general export const APP_NAME = "StuVe IT" -export const APP_VERSION = "0.9.6 (beta)" +export const APP_VERSION = "0.9.7 (beta)" export const APP_URL = "https://it.stuve.uni-ulm.de" \ No newline at end of file diff --git a/src/components/formUtil/FromInput/index.tsx b/src/components/formUtil/FromInput/index.tsx index 5039493..ca0e0bd 100644 --- a/src/components/formUtil/FromInput/index.tsx +++ b/src/components/formUtil/FromInput/index.tsx @@ -92,13 +92,15 @@ const createDefaultValuesFromSchema = (schema: FormSchema, initialEntries?: Fiel * @param onSubmit The function to call when the form is submitted * @param disabled Whether the form is disabled * @param initialData The initial data to populate the form with + * @param submitText The text to display on the submit button */ -export default function FormInput({schema, onAbort, onSubmit, disabled, initialData}: { +export default function FormInput({schema, onAbort, onSubmit, disabled, initialData, submitText}: { schema: FormSchema, onAbort?: () => void, onSubmit?: (values: FieldEntries) => Promise, disabled?: boolean, - initialData?: FieldEntries + initialData?: FieldEntries, + submitText?: string }) { const validationSchema = createValidationFromSchema(schema) @@ -166,7 +168,7 @@ export default function FormInput({schema, onAbort, onSubmit, disabled, initialD } - + diff --git a/src/models/EventTypes.ts b/src/models/EventTypes.ts index d5ee09b..186d460 100644 --- a/src/models/EventTypes.ts +++ b/src/models/EventTypes.ts @@ -65,7 +65,7 @@ export type EventListSlotsWithEntriesCountModel = EventListSlotModel & Pick export type EventListSlotEntryModel = { - entryQuestionData: FieldEntries; + entryQuestionData: FieldEntries | null; entryStatusData: FieldEntries | null; eventListsSlot: string; user: string | null diff --git a/src/pages/events/s/EventListSlotView.tsx b/src/pages/events/s/EventListSlotView.tsx index 98eed53..798faa0 100644 --- a/src/pages/events/s/EventListSlotView.tsx +++ b/src/pages/events/s/EventListSlotView.tsx @@ -139,6 +139,7 @@ export default function EventListSlotView({slot, list, refetch}: { disabled={!user || slotIsFull} schema={questionSchema} onSubmit={createEntryMutation.mutateAsync} + submitText={"Eintragen"} /> }