From 6c3065f6f25943ce325fdd1cee45c5bfa6c3c9a6 Mon Sep 17 00:00:00 2001 From: Chris Parsons <438676+chrisparsons83@users.noreply.github.com> Date: Mon, 11 May 2026 23:57:04 -0700 Subject: [PATCH] Show commish-only leagues in a separate dashboard section, fixes #336 (#412) Leagues where the user is a commissioner but has no team are now shown in a "Leagues I Commish" subsection below their member leagues, rather than silently appearing with no stats. A live draft always takes priority over the commish-only row so commissioners still see the draft banner. Co-authored-by: Claude Sonnet 4.6 --- app/components/league/LeagueRow.tsx | 19 +++++++++++++++++++ app/components/league/MyLeaguesCard.tsx | 24 +++++++++++++++++++++--- app/routes/home.tsx | 5 +++++ 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/app/components/league/LeagueRow.tsx b/app/components/league/LeagueRow.tsx index 0784d69..34f986b 100644 --- a/app/components/league/LeagueRow.tsx +++ b/app/components/league/LeagueRow.tsx @@ -18,6 +18,7 @@ export interface LeagueRowProps { draftDateTime?: string | null; picksUntilMyTurn?: number; draftPosition?: number; + isCommishOnly?: boolean; } // ─── Helpers ────────────────────────────────────────────────────────────────── @@ -205,10 +206,28 @@ function CompletedRow({ ); } +// ─── Commish-only row ───────────────────────────────────────────────────────── + +function CommishOnlyRow({ leagueId, leagueName }: Pick) { + return ( + + +
+

{leagueName}

+

Commissioner

+
+ + ); +} + // ─── Public export ──────────────────────────────────────────────────────────── export function LeagueRow(props: LeagueRowProps) { if (props.status === "draft") return ; + if (props.isCommishOnly) return ; if (props.status === "active") return ; if (props.status === "pre_draft") return ; return ; diff --git a/app/components/league/MyLeaguesCard.tsx b/app/components/league/MyLeaguesCard.tsx index f51e33f..9d2b8a5 100644 --- a/app/components/league/MyLeaguesCard.tsx +++ b/app/components/league/MyLeaguesCard.tsx @@ -17,7 +17,12 @@ interface MyLeaguesCardProps { } export function MyLeaguesCard({ leagues, viewAllUrl }: MyLeaguesCardProps) { - const sorted = leagues.toSorted((a, b) => { + const memberLeagues = leagues.filter((l) => !l.isCommishOnly); + const commishOnlyLeagues = leagues + .filter((l) => l.isCommishOnly) + .toSorted((a, b) => a.leagueName.localeCompare(b.leagueName)); + + const sortedMember = memberLeagues.toSorted((a, b) => { const statusDiff = STATUS_ORDER[a.status] - STATUS_ORDER[b.status]; if (statusDiff !== 0) return statusDiff; if (a.status === "active") { @@ -35,11 +40,13 @@ export function MyLeaguesCard({ leagues, viewAllUrl }: MyLeaguesCardProps) { ) : undefined; + const isEmpty = sortedMember.length === 0 && commishOnlyLeagues.length === 0; + return ( - {sorted.length === 0 ? ( + {isEmpty ? (

You aren't a member of any leagues yet. @@ -53,9 +60,20 @@ export function MyLeaguesCard({ leagues, viewAllUrl }: MyLeaguesCardProps) {

) : (
- {sorted.map((league) => ( + {sortedMember.map((league) => ( ))} + {commishOnlyLeagues.length > 0 && ( + <> + {sortedMember.length > 0 &&
} +

+ Leagues I Commish +

+ {commishOnlyLeagues.map((league) => ( + + ))} + + )}
)} diff --git a/app/routes/home.tsx b/app/routes/home.tsx index 4bade20..858090f 100644 --- a/app/routes/home.tsx +++ b/app/routes/home.tsx @@ -63,9 +63,12 @@ export async function loader(args: Route.LoaderArgs) { let completionPercentage = 0; let picksUntilMyTurn: number | undefined; let draftPosition: number | undefined; + // False when there's no current season — a commish with no season has no team by definition. + let hasTeam = false; if (league.currentSeasonId && seasonWithSports?.seasonSports) { const myTeam = await findTeamByOwnerAndSeason(userId, league.currentSeasonId); + hasTeam = !!myTeam; if (myTeam) { // Fetch standing, completion %, and calendar events in parallel @@ -153,6 +156,7 @@ export async function loader(args: Route.LoaderArgs) { draftPosition, draftDateTime: season?.draftDateTime?.toISOString() ?? null, calendarEvents, + hasTeam, }; }) ); @@ -209,6 +213,7 @@ export default function Home({ loaderData }: Route.ComponentProps) { picksUntilMyTurn: league.picksUntilMyTurn, draftPosition: league.draftPosition, draftDateTime: league.draftDateTime, + isCommishOnly: !league.hasTeam, }; });