From 44ad954dfe751ac766c790ecd959db5bdd4432bc Mon Sep 17 00:00:00 2001 From: Chris Parsons Date: Fri, 17 Apr 2026 23:06:45 -0700 Subject: [PATCH] Update draft room UI. --- app/components/AutodraftSettings.tsx | 1 - app/components/DraftGrid.tsx | 29 +++++++----- app/components/__tests__/DraftGrid.test.tsx | 41 ++++++++++++++--- app/components/draft/DraftGridSection.tsx | 45 ++++++++++--------- app/components/draft/DraftPickCell.tsx | 44 +++++++++++------- app/components/draft/MiniDraftGrid.tsx | 11 +++++ app/components/draft/QueueSection.tsx | 2 - .../$leagueId.draft-board.$seasonId.tsx | 2 + .../leagues/$leagueId.draft.$seasonId.tsx | 9 ++-- 9 files changed, 125 insertions(+), 59 deletions(-) diff --git a/app/components/AutodraftSettings.tsx b/app/components/AutodraftSettings.tsx index 2ab04c8..49c7182 100644 --- a/app/components/AutodraftSettings.tsx +++ b/app/components/AutodraftSettings.tsx @@ -3,7 +3,6 @@ import { Check, Info, ChevronDown } from "lucide-react"; import { toast } from "sonner"; import { Label } from "~/components/ui/label"; import { Popover, PopoverContent, PopoverTrigger } from "~/components/ui/popover"; -import { Button } from "~/components/ui/button"; type AutodraftMode = "next_pick" | "while_on"; diff --git a/app/components/DraftGrid.tsx b/app/components/DraftGrid.tsx index 0573383..8eca4c9 100644 --- a/app/components/DraftGrid.tsx +++ b/app/components/DraftGrid.tsx @@ -6,6 +6,7 @@ import { } from "~/components/ui/context-menu"; import { DraftPickCell, type CoronaState } from "~/components/draft/DraftPickCell"; import { TeamAvatar } from "~/components/TeamAvatar"; +import type { SeasonStatus } from "~/models/season"; interface DraftCell { pickNumber: number; @@ -36,6 +37,8 @@ interface DraftGridProps { connectedTeams?: Set; ownerMap?: Record; coronaStates?: Record; + seasonStatus?: SeasonStatus; + draftPaused?: boolean; } export function DraftGrid({ @@ -52,6 +55,8 @@ export function DraftGrid({ connectedTeams = new Set(), ownerMap = {}, coronaStates = {}, + seasonStatus, + draftPaused, }: DraftGridProps) { const totalTeams = draftSlots.length; @@ -61,30 +66,33 @@ export function DraftGrid({
{/* 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 ( -
+
- {ownerMap[slot.team.id] || slot.team.name} + {isAutodraft && ( + A + )} + {ownerMap[slot.team.id] || slot.team.name}
{teamTimers && formatTime && (
60 @@ -95,9 +103,6 @@ export function DraftGrid({ }`} > {formatTime(teamTime)} - {isAutodraft && ( - (auto) - )}
)}
@@ -106,7 +111,7 @@ export function DraftGrid({
{/* Draft Grid Rows */} -
+
{draftGrid.map((roundPicks, roundIndex) => { const round = roundIndex + 1; const isEvenRound = round % 2 === 0; @@ -115,7 +120,7 @@ export function DraftGrid({ : roundPicks; return ( -
+
{displayPicks.map((cell, index) => { const actualIndex = isEvenRound ? roundPicks.length - 1 - index @@ -144,6 +149,8 @@ export function DraftGrid({ coronaState={ cell ? coronaStates[cell.participant.id] : undefined } + seasonStatus={seasonStatus} + draftPaused={draftPaused} /> ); diff --git a/app/components/__tests__/DraftGrid.test.tsx b/app/components/__tests__/DraftGrid.test.tsx index 1095462..c5c46d3 100644 --- a/app/components/__tests__/DraftGrid.test.tsx +++ b/app/components/__tests__/DraftGrid.test.tsx @@ -67,16 +67,45 @@ describe('DraftGrid Component', () => { }); describe('Current Pick Highlighting', () => { - it('should highlight current pick with "On Clock" text', () => { + it('should show "Up Next" when draft is pre_draft', () => { render( ); - expect(screen.getByText('On Clock')).toBeInTheDocument(); + expect(screen.getByText('Up Next')).toBeInTheDocument(); + }); + + it('should show "Paused Draft" when draft is paused', () => { + render( + + ); + + expect(screen.getByText('Paused Draft')).toBeInTheDocument(); + }); + + it('should show "On The Clock" when draft is active', () => { + render( + + ); + + expect(screen.getByText('On The Clock')).toBeInTheDocument(); }); it('should apply correct styling to current pick', () => { @@ -85,12 +114,14 @@ describe('DraftGrid Component', () => { draftSlots={mockDraftSlots} draftGrid={mockGrid} currentPick={2} + seasonStatus="draft" + draftPaused={false} /> ); - const currentPickCell = screen.getByText('On Clock').closest('[class*="border-electric"]'); - expect(currentPickCell).toHaveClass('border-electric'); - expect(currentPickCell).toHaveClass('bg-electric/20'); + const currentPickCell = screen.getByText('On The Clock').closest('.border-transparent'); + expect(currentPickCell).toHaveClass('bg-muted/80'); + expect(currentPickCell).toHaveClass('border-transparent'); }); }); diff --git a/app/components/draft/DraftGridSection.tsx b/app/components/draft/DraftGridSection.tsx index 57cee4a..544bf7e 100644 --- a/app/components/draft/DraftGridSection.tsx +++ b/app/components/draft/DraftGridSection.tsx @@ -16,6 +16,7 @@ import { Button } from "~/components/ui/button"; import { MoreVertical } from "lucide-react"; import { formatClockTime, getTimerColorClass } from "~/lib/draft-timer"; import { DraftPickCell } from "~/components/draft/DraftPickCell"; +import type { SeasonStatus } from "~/models/season"; type MobileSheetData = | { type: "team"; teamId: string } @@ -53,6 +54,8 @@ interface DraftGridSectionProps { autodraftStatus: Record; connectedTeams: Set; isCommissioner: boolean; + seasonStatus?: SeasonStatus; + draftPaused?: boolean; onAdjustTimeBankOpen?: (teamId: string) => void; onSetAutodraftOpen?: (teamId: string) => void; onForceAutopick: (pickNumber: number, teamId: string) => void; @@ -70,6 +73,8 @@ export const DraftGridSection = memo(function DraftGridSection({ autodraftStatus, connectedTeams, isCommissioner, + seasonStatus, + draftPaused, onAdjustTimeBankOpen, onSetAutodraftOpen, onForceAutopick, @@ -91,9 +96,7 @@ export const DraftGridSection = memo(function DraftGridSection({
{/* Team Headers */} -
- {/* Spacer for round column — sticky so it covers the corner when scrolling both axes */} -
+
{draftSlots.map((slot) => { const teamTime = teamTimers[slot.team.id]; const isAutodraft = autodraftStatus[slot.team.id]?.isEnabled || false; @@ -106,29 +109,27 @@ export const DraftGridSection = memo(function DraftGridSection({ teamId={slot.team.id} teamName={ownerMap[slot.team.id] || slot.team.name} logoUrl={slot.team.logoUrl} - size="sm" + size="md" />
- {ownerMap[slot.team.id] || slot.team.name} + > + {isAutodraft && ( + A + )} + {ownerMap[slot.team.id] || slot.team.name}
{formatClockTime(teamTime)} - {isAutodraft && ( - - (auto) - - )}
{isCommissioner && (onAdjustTimeBankOpen || onSetAutodraftOpen) && (