"use client"; import { useActionState, useState } from "react"; import { useFormStatus } from "react-dom"; import type { ActionResult } from "@/lib/action-result"; import { cancelByAdvisor, respond, saveNote } from "@/app/admin/(panel)/beratung/actions"; import { Icon } from "../Icon"; function Submit({ label, className = "sm-btn sm-btn--primary sm-btn--sm" }: { label: string; className?: string }) { const { pending } = useFormStatus(); return ; } function Result({ state }: { state: ActionResult }) { if (!state?.message) return null; return {state.message}; } type SlotGroup = { label: string; options: { value: string; label: string }[] }; /** Antwort auf eine Anfrage: bestätigen, andere Zeiten vorschlagen oder ablehnen. */ export function RespondForm({ id, slots }: { id: string; slots: SlotGroup[] }) { const [state, action] = useActionState(respond, null); const [mode, setMode] = useState<"" | "propose" | "decline">(""); if (state?.ok) return ; return (
{mode === "propose" && (
{slots.length === 0 ? (

In den nächsten Wochen sind keine passenden freien Zeiten eingetragen. Trag unter „Zeiten“ welche ein.

) : (
{["p1", "p2", "p3"].map((k, i) => ( ))}
)}