Zone editing

This commit is contained in:
Timothy Armes
2024-04-11 11:21:08 +02:00
parent 9f12a00030
commit 9e9f5fd975
11 changed files with 225 additions and 28 deletions
@@ -15,6 +15,7 @@ import { TimeControl } from "@/types";
export type ZoneFormValues = z.infer<typeof zoneSchema>;
type ZoneFormProps = {
zone?: ZoneFormValues;
onSubmit: (data: ZoneFormValues) => Promise<void>;
onCancel: () => void;
submitTitle?: string;
@@ -22,6 +23,7 @@ type ZoneFormProps = {
};
export const ZoneForm = ({
zone,
onSubmit,
onCancel,
submitTitle,
@@ -29,9 +31,11 @@ export const ZoneForm = ({
}: ZoneFormProps) => {
const t = useTranslations("Zones");
const at = useTranslations("App");
// @ts-ignore - Type instantiation is excessively deep and possibly infinite
const form = useForm<ZoneFormValues>({
resolver: zodResolver(zoneSchema),
defaultValues: {
defaultValues: zone ?? {
classicNotifications: false,
rapidNotifications: false,
blitzNotifications: false,