'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 } import { showSwal } from '@/lib/swal' export function EditPenggunaForm({ pengguna }: Props) { const [state, formAction, isPending] = useActionState(updateAkunBalita, null) useEffect(() => { if (state) { if (state.success) { showSwal.success('Berhasil!', state.message) } else { showSwal.error('Gagal!', state.message) } } }, [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 ( <>
> ) }