"use client"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { updateProfile } from "@/actions/settings"; import { Loader2 } from "lucide-react"; interface ProfileFormProps { user: { name: string; username: string; bio?: string | null; location?: string | null; website?: string | null; pronouns?: string | null; }; } export function ProfileForm({ user }: ProfileFormProps) { const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [success, setSuccess] = useState(false); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setLoading(true); setError(null); setSuccess(false); const formData = new FormData(e.currentTarget); try { await updateProfile({ name: formData.get("name") as string, username: formData.get("username") as string, bio: formData.get("bio") as string, location: formData.get("location") as string, website: formData.get("website") as string, pronouns: formData.get("pronouns") as string, }); setSuccess(true); setTimeout(() => setSuccess(false), 3000); } catch (err) { setError(err instanceof Error ? err.message : "Failed to update profile"); } finally { setLoading(false); } } return (

Your name as it appears on your profile

Your unique handle. Letters, numbers, underscores, and hyphens only.