import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger, } from "~/components/ui/context-menu"; interface DraftGridSectionProps { draftSlots: Array<{ id: string; draftOrder: number; team: { id: string; name: string; }; }>; draftGrid: Array< Array<{ pickNumber: number; round: number; pickInRound: number; teamId: string; pick?: { participant: { name: string; }; sport: { name: string; }; }; }> >; currentPick: number; teamTimers: Record; autodraftStatus: Record; connectedTeams: Set; isCommissioner: boolean; onForceAutopick: (pickNumber: number, teamId: string) => void; onForceManualPickOpen: (pickNumber: number, teamId: string) => void; } export function DraftGridSection({ draftSlots, draftGrid, currentPick, teamTimers, autodraftStatus, connectedTeams, isCommissioner, onForceAutopick, onForceManualPickOpen, }: DraftGridSectionProps) { const formatTime = (seconds: number | null) => { if (seconds === null) return "--:--"; const hours = Math.floor(seconds / 3600); const minutes = Math.floor((seconds % 3600) / 60); const secs = seconds % 60; if (hours > 0) { return `${hours}:${String(minutes).padStart(2, "0")}:${String(secs).padStart(2, "0")}`; } return `${minutes}:${String(secs).padStart(2, "0")}`; }; const getTimerColor = (seconds: number | null) => { if (seconds === null) return "text-muted-foreground"; if (seconds > 60) return "text-emerald-400"; if (seconds > 30) return "text-amber-accent"; if (seconds > 10) return "text-coral-accent"; return "text-coral-accent animate-pulse"; }; return (

Draft Grid

{/* Team Headers */}
{draftSlots.map((slot) => { const teamTime = teamTimers[slot.team.id]; const isAutodraft = autodraftStatus[slot.team.id] || false; const isConnected = connectedTeams.has(slot.team.id); return (
{slot.team.name}
{formatTime(teamTime)} {isAutodraft && ( (auto) )}
); })}
{/* Draft Grid Rows */}
{draftGrid.map((roundPicks, roundIndex) => { const round = roundIndex + 1; const isEvenRound = round % 2 === 0; const displayPicks = isEvenRound ? [...roundPicks].reverse() : roundPicks; return (
{displayPicks.map((cell) => { const isCurrent = cell.pickNumber === currentPick; const isPicked = !!cell.pick; return isCommissioner && !isPicked && isCurrent ? (
{cell.round}. {String(cell.pickInRound).padStart(2, "0")}
{isPicked ? (
{cell.pick?.participant.name}
{cell.pick?.sport.name}
) : isCurrent ? (
On Clock
) : null}
onForceAutopick(cell.pickNumber, cell.teamId) } > Force Auto Pick onForceManualPickOpen( cell.pickNumber, cell.teamId ) } > Force Manual Pick
) : (
{cell.round}. {String(cell.pickInRound).padStart(2, "0")}
{isPicked ? (
{cell.pick?.participant.name}
{cell.pick?.sport.name}
) : isCurrent ? (
On Clock
) : null}
); })}
); })}
); }