"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; const EMOJIS = ["👍", "👎", "💙", "🔥", "😆", "😢", "🤔", "😴", "🎉", "🤩", "😭", "🥳", "😤", "💀", "✨", "👀", "🙏", "📚", "💻", "🍕", "🌴"]; interface StatusPickerProps { currentStatus?: string | null; } export function StatusPicker({ currentStatus }: StatusPickerProps) { const router = useRouter(); const [selected, setSelected] = useState(currentStatus ?? null); const [loading, setLoading] = useState(false); async function handleSelect(emoji: string) { setLoading(true); setSelected(emoji); try { const res = await fetch("/api/status", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ status: emoji }), }); if (!res.ok) { throw new Error("Failed to update status"); } router.refresh(); } catch (err) { console.error("Failed to update status:", err); setSelected(currentStatus ?? null); } finally { setLoading(false); } } return (

Set your status

{EMOJIS.map((emoji) => ( ))}
); }