"use client"; import { Button, CloseButton, ColorInput, Group, Stack, TextInput, useMantineTheme } from "@mantine/core"; import type { z } from "zod"; import { useZodForm } from "@homarr/form"; import { createModal } from "@homarr/modals"; import { useI18n } from "@homarr/translation/client"; import { dynamicSectionOptionsSchema } from "@homarr/validation/shared"; interface ModalProps { value: z.infer; onSuccessfulEdit: (value: z.infer) => void; } export const DynamicSectionEditModal = createModal(({ actions, innerProps }) => { const t = useI18n(); const theme = useMantineTheme(); const form = useZodForm(dynamicSectionOptionsSchema, { mode: "controlled", initialValues: { ...innerProps.value }, }); return (
{ innerProps.onSuccessfulEdit(values); actions.closeModal(); })} > color[6])} rightSection={ form.setFieldValue("borderColor", "")} style={{ display: form.getInputProps("borderColor").value ? undefined : "none" }} /> } {...form.getInputProps("borderColor")} />
); }).withOptions({ defaultTitle(t) { return t("item.edit.title"); }, size: "lg", });