import type { IssueStatus } from "@multica/types"; import { STATUS_CONFIG } from "@/features/issues/config"; // --------------------------------------------------------------------------- // Geometry constants (viewBox 0 0 14 14, center 7,7) // --------------------------------------------------------------------------- const CX = 7; const CY = 7; const OUTER_R = 6; const FILL_R = 3.5; // --------------------------------------------------------------------------- // Helpers // --------------------------------------------------------------------------- /** Build a pie-wedge SVG path from 12 o'clock, clockwise */ function piePath(cx: number, cy: number, r: number, progress: number): string { const angle = 2 * Math.PI * progress; const endX = cx + r * Math.sin(angle); const endY = cy - r * Math.cos(angle); const largeArc = progress > 0.5 ? 1 : 0; return `M${cx},${cy} L${cx},${cy - r} A${r},${r} 0 ${largeArc},1 ${endX},${endY} Z`; } // --------------------------------------------------------------------------- // Base component — dashed outer ring + pie fill + optional center icon // --------------------------------------------------------------------------- function ProgressCircle({ progress, children, }: { progress: number; children?: React.ReactNode; }) { return ( <> {/* Outer dashed ring */} {/* Progress fill */} {progress === 1 ? ( ) : progress > 0 ? ( ) : null} {children} ); } // --------------------------------------------------------------------------- // Per-status renderers // --------------------------------------------------------------------------- /** 16 small dots arranged in a ring */ function BacklogIcon() { const count = 16; const dotR = 0.55; return ( {Array.from({ length: count }, (_, i) => { const angle = (i / count) * Math.PI * 2 - Math.PI / 2; return ( ); })} ); } function TodoIcon() { return ; } function InProgressIcon() { return ; } function InReviewIcon() { return ; } function DoneIcon() { return ( ); } /** Outer ring + prohibition slash (🚫 style) */ function BlockedIcon() { return ( ); } function CancelledIcon() { return ( ); } // --------------------------------------------------------------------------- // Renderer map // --------------------------------------------------------------------------- const STATUS_RENDERERS: Record React.ReactNode> = { backlog: BacklogIcon, todo: TodoIcon, in_progress: InProgressIcon, in_review: InReviewIcon, done: DoneIcon, blocked: BlockedIcon, cancelled: CancelledIcon, }; // --------------------------------------------------------------------------- // Public component // --------------------------------------------------------------------------- export function StatusIcon({ status, className = "h-4 w-4", }: { status: IssueStatus; className?: string; }) { const cfg = STATUS_CONFIG[status]; const Renderer = STATUS_RENDERERS[status]; return ( ); }