"use client"; import { useEffect, useRef } from "react"; import { STATUS_OPTIONS, STATUS_MAP } from "./StatusBadge"; interface StatusPopoverProps { currentStatus: string; onSelect: (status: string) => void; onClose: () => void; } export function StatusPopover({ currentStatus, onSelect, onClose }: StatusPopoverProps) { const ref = useRef(null); useEffect(() => { function handleClick(e: MouseEvent) { if (ref.current && !ref.current.contains(e.target as Node)) { onClose(); } } document.addEventListener("mousedown", handleClick); return () => document.removeEventListener("mousedown", handleClick); }, [onClose]); return (
{STATUS_OPTIONS.map((opt) => { const cfg = STATUS_MAP[opt.value]; const isActive = opt.value === currentStatus; return ( ); })}
); }