feat(FormInput): submit button text customisable
Build and Push Docker image / build-and-push (push) Successful in 6m34s Details

the text of the submit button of the FormInput is now adjustable
This commit is contained in:
Valentin Kolb 2024-10-24 16:59:17 +02:00
parent 14548b0f92
commit 3895b86515
4 changed files with 8 additions and 5 deletions

View File

@ -9,5 +9,5 @@ export const PB_STORAGE_KEY = "stuve-it-login-record"
// general // general
export const APP_NAME = "StuVe IT" 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" export const APP_URL = "https://it.stuve.uni-ulm.de"

View File

@ -92,13 +92,15 @@ const createDefaultValuesFromSchema = (schema: FormSchema, initialEntries?: Fiel
* @param onSubmit The function to call when the form is submitted * @param onSubmit The function to call when the form is submitted
* @param disabled Whether the form is disabled * @param disabled Whether the form is disabled
* @param initialData The initial data to populate the form with * @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, schema: FormSchema,
onAbort?: () => void, onAbort?: () => void,
onSubmit?: (values: FieldEntries) => Promise<unknown>, onSubmit?: (values: FieldEntries) => Promise<unknown>,
disabled?: boolean, disabled?: boolean,
initialData?: FieldEntries initialData?: FieldEntries,
submitText?: string
}) { }) {
const validationSchema = createValidationFromSchema(schema) const validationSchema = createValidationFromSchema(schema)
@ -166,7 +168,7 @@ export default function FormInput({schema, onAbort, onSubmit, disabled, initialD
</Button> </Button>
} }
<Button disabled={disabled} type={"submit"}>Speichern</Button> <Button disabled={disabled} type={"submit"}>{submitText ?? "Speichern"}</Button>
</Group> </Group>
<ShowDebug> <ShowDebug>

View File

@ -65,7 +65,7 @@ export type EventListSlotsWithEntriesCountModel = EventListSlotModel
& Pick<EventListModel, "entryQuestionSchema" | "entryStatusSchema" | "ignoreDefaultEntryStatusSchema" | "ignoreDefaultEntryQuestionScheme"> & Pick<EventListModel, "entryQuestionSchema" | "entryStatusSchema" | "ignoreDefaultEntryStatusSchema" | "ignoreDefaultEntryQuestionScheme">
export type EventListSlotEntryModel = { export type EventListSlotEntryModel = {
entryQuestionData: FieldEntries; entryQuestionData: FieldEntries | null;
entryStatusData: FieldEntries | null; entryStatusData: FieldEntries | null;
eventListsSlot: string; eventListsSlot: string;
user: string | null user: string | null

View File

@ -139,6 +139,7 @@ export default function EventListSlotView({slot, list, refetch}: {
disabled={!user || slotIsFull} disabled={!user || slotIsFull}
schema={questionSchema} schema={questionSchema}
onSubmit={createEntryMutation.mutateAsync} onSubmit={createEntryMutation.mutateAsync}
submitText={"Eintragen"}
/> />
} }
</Collapse> </Collapse>