import { useState } from "react"; import { cn } from "../lib/utils"; import { issueStatusIcon, issueStatusIconDefault } from "../lib/status-colors"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Button } from "@/components/ui/button"; const allStatuses = ["backlog", "todo", "in_progress", "in_review", "done", "cancelled", "blocked"]; function statusLabel(status: string): string { return status.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()); } interface StatusIconProps { status: string; onChange?: (status: string) => void; className?: string; showLabel?: boolean; } export function StatusIcon({ status, onChange, className, showLabel }: StatusIconProps) { const [open, setOpen] = useState(false); const colorClass = issueStatusIcon[status] ?? issueStatusIconDefault; const isDone = status === "done"; const circle = ( {isDone && ( )} ); if (!onChange) return showLabel ? {circle}{statusLabel(status)} : circle; const trigger = showLabel ? ( ) : circle; return ( {trigger} {allStatuses.map((s) => ( ))} ); }