'use client'; import { useEffect, useState, useTransition } from 'react'; import { Loader2, NotebookPen } from 'lucide-react'; import { saveHelpRequest } from '../actions'; import { cn } from '@/lib/utils'; interface HelpRequestCardProps { patientId: string; screeningId: string; initialValue?: string | null; } export function HelpRequestCard({ patientId, screeningId, initialValue }: HelpRequestCardProps) { const [value, setValue] = useState(initialValue || ''); const [error, setError] = useState(null); const [success, setSuccess] = useState(false); const [isPending, startTransition] = useTransition(); useEffect(() => { setValue(initialValue || ''); }, [initialValue]); const handleSave = () => { setError(null); setSuccess(false); startTransition(async () => { try { await saveHelpRequest({ patientId, screeningId, request: value, }); setSuccess(true); } catch (err) { console.error(err); setError(err instanceof Error ? err.message : 'Opslaan mislukt'); } }); }; return (

Hulpvraag

Beschrijf de zorgvraag van de cliënt