'use client' import { useActionState, useEffect, useState } from 'react' import { updateAkunBalita } from '@/app/actions' import { User, MapPin, Phone, Baby, Calendar, Lock, AtSign, CheckCircle, XCircle, X } from 'lucide-react' interface AkunBalita { id: string nama_orang_tua: string alamat: string | null no_whatsapp: string | null nama_anak: string tanggal_lahir: string | null username: string password: string } interface Props { pengguna: AkunBalita } interface ToastProps { message: string type: 'success' | 'error' onClose: () => void } function Toast({ message, type, onClose }: ToastProps) { useEffect(() => { const timer = setTimeout(onClose, 4000) return () => clearTimeout(timer) }, [onClose]) return (
{type === 'success' ? : } {message}
) } export function EditPenggunaForm({ pengguna }: Props) { const [state, formAction, isPending] = useActionState(updateAkunBalita, null) const [toast, setToast] = useState<{ message: string; type: 'success' | 'error' } | null>(null) useEffect(() => { if (state) { setToast({ message: state.message, type: state.success ? 'success' : 'error' }) } }, [state]) const inputClass = "border-2 border-gray-200 rounded-lg p-3 focus:outline-none focus:border-black transition-colors w-full text-sm" const labelClass = "text-sm font-bold flex items-center gap-2 mb-1" return ( <> {toast && setToast(null)} />}
{/* Section: Data Orang Tua */}

Data Orang Tua

{/* Nama Orang Tua */}
{/* No WhatsApp */}
{/* Alamat */}