diff --git a/apps/nextjs/src/app/[locale]/manage/_components/hero-banner.module.css b/apps/nextjs/src/app/[locale]/manage/_components/hero-banner.module.css index f3b4141aa..2b949c990 100644 --- a/apps/nextjs/src/app/[locale]/manage/_components/hero-banner.module.css +++ b/apps/nextjs/src/app/[locale]/manage/_components/hero-banner.module.css @@ -1,5 +1,5 @@ .bannerContainer { - border-radius: 8px; + border-radius: 16px; overflow: hidden; @mixin dark { background: linear-gradient( diff --git a/apps/nextjs/src/app/[locale]/manage/apps/_form.tsx b/apps/nextjs/src/app/[locale]/manage/apps/_form.tsx index 75d75e472..ab1121f02 100644 --- a/apps/nextjs/src/app/[locale]/manage/apps/_form.tsx +++ b/apps/nextjs/src/app/[locale]/manage/apps/_form.tsx @@ -1,11 +1,11 @@ "use client"; +import { useRef } from "react"; import Link from "next/link"; import { Button, Group, Stack, Textarea, TextInput } from "@mantine/core"; import type { z } from "zod"; import { useZodForm } from "@homarr/form"; -import type { TranslationFunction } from "@homarr/translation"; import { useI18n } from "@homarr/translation/client"; import { validation } from "@homarr/validation"; @@ -14,14 +14,21 @@ import { IconPicker } from "~/components/icons/picker/icon-picker"; type FormType = z.infer; interface AppFormProps { - submitButtonTranslation: (t: TranslationFunction) => string; + buttonLabels: { + submit: string; + submitAndCreateAnother?: string; + }; initialValues?: FormType; - handleSubmit: (values: FormType) => void; + handleSubmit: (values: FormType, redirect: boolean, afterSuccess?: () => void) => void; isPending: boolean; } -export const AppForm = (props: AppFormProps) => { - const { submitButtonTranslation, handleSubmit, initialValues, isPending } = props; +export const AppForm = ({ + buttonLabels, + handleSubmit: originalHandleSubmit, + initialValues, + isPending, +}: AppFormProps) => { const t = useI18n(); const form = useZodForm(validation.app.manage, { @@ -33,11 +40,23 @@ export const AppForm = (props: AppFormProps) => { }, }); + const shouldCreateAnother = useRef(false); + const handleSubmit = (values: FormType) => { + const redirect = !shouldCreateAnother.current; + const afterSuccess = shouldCreateAnother.current + ? () => { + form.reset(); + shouldCreateAnother.current = false; + } + : undefined; + originalHandleSubmit(values, redirect, afterSuccess); + }; + return (
- +