mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
Fix Zone types
This commit is contained in:
@@ -10,12 +10,13 @@ import { Label } from "@/components/form/Label";
|
|||||||
import { TextField } from "@/components/form/TextField";
|
import { TextField } from "@/components/form/TextField";
|
||||||
import { ZoneEditorField } from "@/components/form/ZoneEditorField";
|
import { ZoneEditorField } from "@/components/form/ZoneEditorField";
|
||||||
import { zoneSchema } from "@/schemas";
|
import { zoneSchema } from "@/schemas";
|
||||||
|
import { Zone } from "@/server/myZones";
|
||||||
import { TimeControl } from "@/types";
|
import { TimeControl } from "@/types";
|
||||||
|
|
||||||
export type ZoneFormValues = z.infer<typeof zoneSchema>;
|
export type ZoneFormValues = z.infer<typeof zoneSchema>;
|
||||||
|
|
||||||
type ZoneFormProps = {
|
type ZoneFormProps = {
|
||||||
zone?: ZoneFormValues;
|
zone?: Zone;
|
||||||
onSubmit: (data: ZoneFormValues) => Promise<void>;
|
onSubmit: (data: ZoneFormValues) => Promise<void>;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
submitTitle?: string;
|
submitTitle?: string;
|
||||||
@@ -35,15 +36,23 @@ export const ZoneForm = ({
|
|||||||
// @ts-ignore - Type instantiation is excessively deep and possibly infinite
|
// @ts-ignore - Type instantiation is excessively deep and possibly infinite
|
||||||
const form = useForm<ZoneFormValues>({
|
const form = useForm<ZoneFormValues>({
|
||||||
resolver: zodResolver(zoneSchema),
|
resolver: zodResolver(zoneSchema),
|
||||||
defaultValues: zone ?? {
|
defaultValues: zone
|
||||||
classicNotifications: false,
|
? {
|
||||||
rapidNotifications: false,
|
name: zone.name,
|
||||||
blitzNotifications: false,
|
classicNotifications: zone.classicNotifications,
|
||||||
features: {
|
rapidNotifications: zone.rapidNotifications,
|
||||||
type: "FeatureCollection",
|
blitzNotifications: zone.blitzNotifications,
|
||||||
features: [],
|
features: zone.features as ZoneFormValues["features"],
|
||||||
},
|
}
|
||||||
},
|
: {
|
||||||
|
classicNotifications: false,
|
||||||
|
rapidNotifications: false,
|
||||||
|
blitzNotifications: false,
|
||||||
|
features: {
|
||||||
|
type: "FeatureCollection",
|
||||||
|
features: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -4,16 +4,16 @@ import L, { LatLngLiteral } from "leaflet";
|
|||||||
import "leaflet-defaulticon-compatibility";
|
import "leaflet-defaulticon-compatibility";
|
||||||
import "leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css";
|
import "leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css";
|
||||||
import "leaflet/dist/leaflet.css";
|
import "leaflet/dist/leaflet.css";
|
||||||
import { FeatureGroup, GeoJSON, MapContainer, TileLayer } from "react-leaflet";
|
import { GeoJSON, MapContainer, TileLayer } from "react-leaflet";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import { MapEvents } from "@/components/MapEvents";
|
import { MapEvents } from "@/components/MapEvents";
|
||||||
import type { ZoneModel } from "@/server/models/zoneModel";
|
import { Zone } from "@/server/myZones";
|
||||||
|
|
||||||
const center: LatLngLiteral = { lat: 47.0844, lng: 2.3964 };
|
const center: LatLngLiteral = { lat: 47.0844, lng: 2.3964 };
|
||||||
|
|
||||||
export type ZoneThumbnailProps = {
|
export type ZoneThumbnailProps = {
|
||||||
features: ZoneModel["features"];
|
features: Zone["features"];
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user