TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1/** Shared shape for server-action results consumed by useActionState forms. */2export interface ActionState {3 ok?: boolean;4 error?: string | null;5 message?: string | null;6 fieldErrors?: Record<string, string>;7 /** arbitrary data returned to the form (e.g. cooldown seconds, QR data URL) */8 data?: Record<string, unknown>;9}1011export const idle: ActionState = { ok: false, error: null };1213export function fieldErrorsFrom(issues: Array<{ path: PropertyKey[]; message: string }>): Record<string, string> {14 const out: Record<string, string> = {};15 for (const i of issues) {16 const k = String(i.path[0] ?? '_');17 if (!out[k]) out[k] = i.message;18 }19 return out;20}21