From 172302cad6afd1946774b6570d56356396043a89 Mon Sep 17 00:00:00 2001 From: Chris Parsons Date: Thu, 21 May 2026 21:01:05 -0700 Subject: [PATCH] Fix snake draft Discord pick numbering and small UX tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Discord pick notifications now show the sequential pick-in-round (e.g. "Round 2, Pick 9") rather than the snake-adjusted slot position ("Round 2, Pick 5") — fixes confusing numbers on even rounds - Remove unused pickInRound param from notifyPickMadeOnDiscord; add regression test for the 13-team snake draft case - League name in draft-in-progress card is now a link to the league homepage alongside the existing Enter Draft button - Overnight pause cell label shortened to "🌙 Pause" (resumesAt line below it already provides the time context) - Queue and recent picks items use bg-card instead of bg-muted for better visual separation from the panel background Co-Authored-By: Claude Sonnet 4.6 --- app/components/draft/DraftPickCell.tsx | 2 +- app/components/draft/QueueSection.tsx | 2 +- app/components/draft/SidebarRecentPicks.tsx | 2 +- app/components/league/LeagueRow.tsx | 2 +- app/models/draft-utils.ts | 6 ++--- app/routes/api/draft.make-pick.ts | 4 ++-- .../__tests__/draft-discord.server.test.ts | 22 ++++++++++++++++++- app/services/draft-discord.server.ts | 6 ++--- 8 files changed, 33 insertions(+), 13 deletions(-) diff --git a/app/components/draft/DraftPickCell.tsx b/app/components/draft/DraftPickCell.tsx index 48160fb..6cc5242 100644 --- a/app/components/draft/DraftPickCell.tsx +++ b/app/components/draft/DraftPickCell.tsx @@ -75,7 +75,7 @@ function DraftPickCell({ if (seasonStatus === "pre_draft") { currentLabel = "Up Next"; } else if (seasonStatus === "draft" && isOvernightPause) { - currentLabel = "🌙 Overnight Pause"; + currentLabel = "🌙 Pause"; } else if (seasonStatus === "draft" && draftPaused) { currentLabel = "Paused Draft"; } diff --git a/app/components/draft/QueueSection.tsx b/app/components/draft/QueueSection.tsx index 314da4b..9c7ce56 100644 --- a/app/components/draft/QueueSection.tsx +++ b/app/components/draft/QueueSection.tsx @@ -77,7 +77,7 @@ const SortableQueueItem = memo(function SortableQueueItem({ style={style} {...attributes} className={`p-2 rounded-lg ${ - canPick ? "bg-electric/10 border border-electric/40" : "bg-muted" + canPick ? "bg-electric/10 border border-electric/40" : "bg-card" }`} >
diff --git a/app/components/draft/SidebarRecentPicks.tsx b/app/components/draft/SidebarRecentPicks.tsx index afb0fa1..60fa8c8 100644 --- a/app/components/draft/SidebarRecentPicks.tsx +++ b/app/components/draft/SidebarRecentPicks.tsx @@ -33,7 +33,7 @@ export const SidebarRecentPicks = memo(function SidebarRecentPicks({ picks }: Si .map((pick) => (
diff --git a/app/components/league/LeagueRow.tsx b/app/components/league/LeagueRow.tsx index 34f986b..94b2877 100644 --- a/app/components/league/LeagueRow.tsx +++ b/app/components/league/LeagueRow.tsx @@ -65,7 +65,7 @@ function DraftRow({ leagueId, leagueName, seasonId, picksUntilMyTurn }: LeagueRo
-

{leagueName}

+ {leagueName}
diff --git a/app/models/draft-utils.ts b/app/models/draft-utils.ts index 0dfb4fc..d4ed90b 100644 --- a/app/models/draft-utils.ts +++ b/app/models/draft-utils.ts @@ -339,7 +339,7 @@ export function calculatePickInfo( const teamIndex = isOddRound ? rawPickInRound - 1 : teamCount - rawPickInRound; const pickInRound = teamIndex + 1; // snake-adjusted, 1-based, matches draftOrder - return { round, pickInRound, teamIndex }; + return { round, pickInRound, teamIndex, rawPickInRound }; } /** @@ -602,7 +602,7 @@ export async function executeAutoPick(params: { }; } - const { round: currentRound, pickInRound } = calculatePickInfo(pickNumber, totalTeams); + const { round: currentRound, pickInRound, rawPickInRound } = calculatePickInfo(pickNumber, totalTeams); // Determine pickedByUserId based on trigger const pickedByUserId = triggeredBy === "commissioner" @@ -854,7 +854,7 @@ export async function executeAutoPick(params: { sportName: participantToPick.sportsSeason.sport.name, pickNumber, round: currentRound, - pickInRound, + rawPickInRound, isDraftComplete, totalTeams, draftSlots: draftSlots.map((s) => ({ teamId: s.teamId, draftOrder: s.draftOrder })), diff --git a/app/routes/api/draft.make-pick.ts b/app/routes/api/draft.make-pick.ts index f1eb752..d7446ec 100644 --- a/app/routes/api/draft.make-pick.ts +++ b/app/routes/api/draft.make-pick.ts @@ -62,7 +62,7 @@ export async function action(args: ActionFunctionArgs) { }); const totalTeams = draftSlots.length; - const { round: currentRound, pickInRound } = calculatePickInfo(currentPickNumber, totalTeams); + const { round: currentRound, pickInRound, rawPickInRound } = calculatePickInfo(currentPickNumber, totalTeams); const currentDraftSlot = draftSlots.find((slot) => slot.draftOrder === pickInRound); if (!currentDraftSlot) { @@ -339,7 +339,7 @@ export async function action(args: ActionFunctionArgs) { sportName: participant.sportsSeason.sport.name, pickNumber: currentPickNumber, round: currentRound, - pickInRound, + rawPickInRound, isDraftComplete, totalTeams, draftSlots: draftSlots.map((s) => ({ teamId: s.teamId, draftOrder: s.draftOrder })), diff --git a/app/services/__tests__/draft-discord.server.test.ts b/app/services/__tests__/draft-discord.server.test.ts index 0dd1280..b0e3a90 100644 --- a/app/services/__tests__/draft-discord.server.test.ts +++ b/app/services/__tests__/draft-discord.server.test.ts @@ -41,7 +41,7 @@ const BASE_PARAMS = { sportName: "Soccer", pickNumber: 1, round: 1, - pickInRound: 1, + rawPickInRound: 1, isDraftComplete: false, totalTeams: 2, draftSlots: DRAFT_SLOTS, @@ -95,6 +95,7 @@ function makeMockDb(overrides: { beforeEach(() => { vi.clearAllMocks(); + vi.mocked(sendPickAnnouncementNotification).mockResolvedValue(undefined); process.env.APP_URL = "https://test.brackt.com"; }); @@ -230,4 +231,23 @@ describe("notifyPickMadeOnDiscord", () => { notifyPickMadeOnDiscord({ ...BASE_PARAMS, db: db as never }) ).rejects.toThrow("webhook down"); }); + + it("uses sequential (not snake-adjusted) pick number in Discord title for even rounds", async () => { + // 13-team draft, pick #22: round 2 (even/reversed), rawPickInRound=9, snake-adjusted slot=5 + // Discord should say "Round 2, Pick 9" not "Round 2, Pick 5" + const db = makeMockDb({ season: makeSeason(23) }); + + await notifyPickMadeOnDiscord({ + ...BASE_PARAMS, + pickNumber: 22, + round: 2, + rawPickInRound: 9, + totalTeams: 13, + db: db as never, + }); + + expect(sendPickAnnouncementNotification).toHaveBeenCalledWith( + expect.objectContaining({ pickNumber: 22, round: 2, pickInRound: 9 }) + ); + }); }); diff --git a/app/services/draft-discord.server.ts b/app/services/draft-discord.server.ts index 80604f5..e46fe1b 100644 --- a/app/services/draft-discord.server.ts +++ b/app/services/draft-discord.server.ts @@ -24,7 +24,7 @@ export async function notifyPickMadeOnDiscord(params: { sportName: string; pickNumber: number; round: number; - pickInRound: number; + rawPickInRound: number; isDraftComplete: boolean; totalTeams: number; draftSlots: DraftSlot[]; @@ -38,7 +38,7 @@ export async function notifyPickMadeOnDiscord(params: { sportName, pickNumber, round, - pickInRound, + rawPickInRound, isDraftComplete, totalTeams, draftSlots, @@ -90,7 +90,7 @@ export async function notifyPickMadeOnDiscord(params: { draftUrl, pickNumber, round, - pickInRound, + pickInRound: rawPickInRound, pickedTeamName, participantName, sportName,