From 5af507f234cc1d310e4e6cfc1674abf773a1f699 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 12 May 2026 14:57:16 +0000 Subject: [PATCH] Address code review: cleanup mlb streak type, fix soccer GP on mobile, hoist showSubRow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - mlb.ts: drop redundant `?? undefined` after optional chain; document that streakCode is the full string (e.g. "W3") and streakNumber is unused - RegularSeasonStandings: hoist hasSecondaryStats → showSubRow to component level (it only depends on a prop, not on individual row data) - Remove non-functional `truncate`/`min-w-0` from team name cell — truncation requires table-layout:fixed which we don't use; team names size naturally - Soccer GP was hidden on mobile with no sub-row to surface it; GP now shows inline for soccer on all viewports, hidden only for non-soccer (which has the secondary sub-row) - Add comment explaining totalCols counts hidden-on-mobile columns for colSpan - Add missing test for GB column hiding when no rows have gamesBack data https://claude.ai/code/session_01RADi3LhYMPbRDm5no1ZpdF --- .../sport-season/RegularSeasonStandings.tsx | 22 ++++++++++--------- .../__tests__/RegularSeasonStandings.test.tsx | 11 ++++++++++ app/services/standings-sync/mlb.ts | 9 +++++--- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/app/components/sport-season/RegularSeasonStandings.tsx b/app/components/sport-season/RegularSeasonStandings.tsx index 2036748..8974f04 100644 --- a/app/components/sport-season/RegularSeasonStandings.tsx +++ b/app/components/sport-season/RegularSeasonStandings.tsx @@ -243,10 +243,16 @@ function StandingsTable({ // # Team GP W [D] L [GF GA GD PTS] [OTL PTS] [PCT] [GB] [L10] [STK] Mgr // Soccer: 11 fixed columns. Non-soccer: 5 base + GP + optional cols. + // GP and PCT are always counted even when hidden on mobile; colSpan must + // reflect all rendered columns regardless of CSS visibility. const totalCols = showSoccerTable ? 11 : 5 + 1 /* GP */ + (showOtLosses ? 2 : 0) + 1 /* PCT */ + (hasGB ? 1 : 0) + (hasLastTen ? 1 : 0) + (hasStreak ? 1 : 0); + // Non-soccer rows get a secondary sub-row on mobile showing GP/PCT/GB/L10. + // Soccer tables show GP inline (no sub-row) since they already show many columns. + const showSubRow = !showSoccerTable; + return (
@@ -254,7 +260,7 @@ function StandingsTable({ - + {showSoccerTable && } @@ -314,19 +320,16 @@ function StandingsTable({ const isUserTeam = userParticipantIds.includes(row.participantId); const ownership = teamOwnerships[row.participantId]; - // Non-soccer rows get a secondary sub-row on mobile showing GP/PCT/GB/L10 - const hasSecondaryStats = !showSoccerTable; - sectionRows.push( - - @@ -411,8 +414,7 @@ function StandingsTable({ ); - // Secondary stats sub-row for mobile (hidden on sm+) - if (hasSecondaryStats) { + if (showSubRow) { sectionRows.push( { expect(screen.queryByText("L10")).not.toBeInTheDocument(); }); + it("hides GB column when no rows have gamesBack data", () => { + render( + + ); + expect(screen.queryByText("GB")).not.toBeInTheDocument(); + }); + it("shows soccer table columns when showSoccerTable=true", () => { render(
# TeamGPGP WDL
{rank} - + + {row.participant.shortName ?? row.participant.name} {section.showDivisionLabel && row.division && ( @@ -335,7 +338,7 @@ function StandingsTable({ )} + {row.gamesPlayed} {row.wins}