feat(client): split uptime monitor creation into a 3-step wizard

This commit is contained in:
Br0wnHammer committed 2026-05-27 12:07:07 +05:30
1 parent 967e415b0a
commit 37dfc67e33
2 files changed
+38 -27

No files matched your search

+11 -1
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
import { GeoContinents } from "@/Types/GeoCheck";
import { DnsRecordTypes, PageSpeedStrategies } from "@/Types/Monitor";
import { DnsRecordTypes, PageSpeedStrategies, type MonitorType } from "@/Types/Monitor";
// URL schema with custom error message
const urlSchema = z.url({ message: "Please enter a valid URL" });
@@ -164,6 +164,16 @@ export const monitorSchema = z.discriminatedUnion("type", [
export type MonitorFormData = z.infer<typeof monitorSchema>;
// Field names present in each monitor type's schema, derived from the schema
// itself. Consumers (e.g. the create wizard's per-step validation) should read
// this rather than hardcoding field lists, so renames/additions stay in sync.
export const monitorFieldsByType = Object.fromEntries(
monitorSchema.options.map((option) => [
option.shape.type.value,
Object.keys(option.shape),
])
) as Record<MonitorType, string[]>;
// Type-specific schemas exported for individual use
export {
httpSchema,