2025-11-12 23:44:33 -08:00
|
|
|
import { Link } from "react-router";
|
|
|
|
|
import type { Route } from "./+types/$leagueId.sports-seasons.$sportsSeasonId";
|
2026-03-10 12:10:52 -07:00
|
|
|
|
2025-11-12 23:44:33 -08:00
|
|
|
import { loader } from "./$leagueId.sports-seasons.$sportsSeasonId.server";
|
|
|
|
|
import { SportSeasonDisplay } from "~/components/scoring/SportSeasonDisplay";
|
2026-03-07 21:59:29 -08:00
|
|
|
import { EventSchedule } from "~/components/sport-season/EventSchedule";
|
2025-11-12 23:44:33 -08:00
|
|
|
import { Button } from "~/components/ui/button";
|
2026-03-07 21:59:29 -08:00
|
|
|
import { Badge } from "~/components/ui/badge";
|
|
|
|
|
import { ArrowLeft, CheckCircle2, Clock, Zap } from "lucide-react";
|
2025-11-12 23:44:33 -08:00
|
|
|
|
2026-03-10 12:10:52 -07:00
|
|
|
export function meta({ data }: Route.MetaArgs): Route.MetaDescriptors {
|
|
|
|
|
return [{ title: `${data?.sportsSeason?.name ?? "Sport Season"} — ${data?.league?.name ?? "League"} - Brackt` }];
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-12 23:44:33 -08:00
|
|
|
export { loader };
|
|
|
|
|
|
2026-03-07 21:59:29 -08:00
|
|
|
function getStatusBadge(status: string) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case "active":
|
|
|
|
|
return (
|
|
|
|
|
<Badge variant="outline" className="bg-emerald-500/15 text-emerald-400 border-emerald-500/30">
|
|
|
|
|
<Zap className="mr-1 h-3 w-3" />
|
|
|
|
|
Active
|
|
|
|
|
</Badge>
|
|
|
|
|
);
|
|
|
|
|
case "upcoming":
|
|
|
|
|
return (
|
|
|
|
|
<Badge variant="outline" className="bg-electric/15 text-electric border-electric/30">
|
|
|
|
|
<Clock className="mr-1 h-3 w-3" />
|
|
|
|
|
Upcoming
|
|
|
|
|
</Badge>
|
|
|
|
|
);
|
|
|
|
|
case "completed":
|
|
|
|
|
return (
|
|
|
|
|
<Badge variant="outline" className="bg-muted text-muted-foreground border-border">
|
|
|
|
|
<CheckCircle2 className="mr-1 h-3 w-3" />
|
|
|
|
|
Completed
|
|
|
|
|
</Badge>
|
|
|
|
|
);
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-12 23:44:33 -08:00
|
|
|
export default function SportSeasonDetail({
|
|
|
|
|
loaderData,
|
|
|
|
|
}: Route.ComponentProps) {
|
|
|
|
|
const {
|
|
|
|
|
league,
|
|
|
|
|
season,
|
|
|
|
|
sportsSeason,
|
|
|
|
|
scoringPattern,
|
|
|
|
|
playoffMatches,
|
|
|
|
|
playoffRounds,
|
User/chris/bracket UI redesign (#95)
* feat: redesign playoff bracket UI with compact layout and owner display
- Replace per-match Card wrappers with compact left-vs-right rows (stacks on mobile)
- Add TeamOwnerBadge component (colored avatar + team name + username), matching the standings "Drafted By" style
- Show owner info below each participant name in bracket matches
- Add TBD forward-reference labels ("Winner of Quarterfinals M1") computed via buildFeederMap
- Add Final Rankings table below bracket showing all participants ranked by elimination round
- Fix round ordering in loader: sort by match count descending (more matches = earlier round)
- Add loser relation to playoff matches query for elimination tracking
- Extract getAvatarColor to app/lib/color-hash.ts (shared across GroupStageDisplay, SeasonStandings, TeamOwnerBadge)
- Extract groupMatchesByRound helper; share grouped map between feeder computation and render
- Remove dead getTeamAvatar from SeasonStandings after TeamOwnerBadge adoption
- Add tests for groupMatchesByRound and buildFeederMap (7 tests)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add draft order card to league home page
Show draft order on the league home page when order is set and season
is in pre_draft or draft status. Includes team name, owner name, and
a link to the draft room.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: enhance playoff bracket with eliminated teams, points, and ownership highlights
- Show eliminated teams (including group-stage losers) in Final Rankings card
- Display computed fantasy points per participant in rankings table
- Card title switches between "Eliminated Teams" and "Final Rankings" based on bracket completion
- Highlight owned participants with electric blue name, dot indicator, and card border in bracket matches
- Highlight owned rows with electric border/background in rankings table
- Suppress EventSchedule for playoff_bracket sports seasons
- Fix title redundancy: bracket section title no longer repeats sport name
- Two-column match grid on desktop (md:grid-cols-2)
- Code review fixes: parallel DB fetches, targeted query for pre-eliminated, single-pass parseFloat, remove IIFE
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 22:44:33 -07:00
|
|
|
preEliminatedParticipants,
|
|
|
|
|
participantPoints,
|
2026-03-10 10:27:58 -07:00
|
|
|
partialScoreParticipantIds,
|
2025-11-12 23:44:33 -08:00
|
|
|
seasonStandings,
|
|
|
|
|
qpStandings,
|
|
|
|
|
teamOwnerships,
|
2026-03-07 21:59:29 -08:00
|
|
|
userParticipantIds,
|
|
|
|
|
upcomingEvents,
|
|
|
|
|
recentEvents,
|
|
|
|
|
seasonIsFinalized,
|
2025-11-12 23:44:33 -08:00
|
|
|
} = loaderData;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="container mx-auto py-8 px-4">
|
|
|
|
|
<div className="mb-6">
|
|
|
|
|
<Button variant="ghost" size="sm" asChild className="mb-4">
|
|
|
|
|
<Link to={`/leagues/${league.id}`}>
|
|
|
|
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
|
|
|
|
Back to League
|
|
|
|
|
</Link>
|
|
|
|
|
</Button>
|
|
|
|
|
|
2026-03-07 21:59:29 -08:00
|
|
|
<div className="flex items-start justify-between gap-4 mb-4">
|
|
|
|
|
<div>
|
|
|
|
|
<h1 className="text-3xl font-bold mb-1">
|
|
|
|
|
{sportsSeason.sport.name}
|
|
|
|
|
</h1>
|
|
|
|
|
<p className="text-muted-foreground">
|
|
|
|
|
{sportsSeason.name} • {league.name} • {season.year} Season
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
{getStatusBadge(sportsSeason.status)}
|
2025-11-12 23:44:33 -08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
User/chris/bracket UI redesign (#95)
* feat: redesign playoff bracket UI with compact layout and owner display
- Replace per-match Card wrappers with compact left-vs-right rows (stacks on mobile)
- Add TeamOwnerBadge component (colored avatar + team name + username), matching the standings "Drafted By" style
- Show owner info below each participant name in bracket matches
- Add TBD forward-reference labels ("Winner of Quarterfinals M1") computed via buildFeederMap
- Add Final Rankings table below bracket showing all participants ranked by elimination round
- Fix round ordering in loader: sort by match count descending (more matches = earlier round)
- Add loser relation to playoff matches query for elimination tracking
- Extract getAvatarColor to app/lib/color-hash.ts (shared across GroupStageDisplay, SeasonStandings, TeamOwnerBadge)
- Extract groupMatchesByRound helper; share grouped map between feeder computation and render
- Remove dead getTeamAvatar from SeasonStandings after TeamOwnerBadge adoption
- Add tests for groupMatchesByRound and buildFeederMap (7 tests)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add draft order card to league home page
Show draft order on the league home page when order is set and season
is in pre_draft or draft status. Includes team name, owner name, and
a link to the draft room.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: enhance playoff bracket with eliminated teams, points, and ownership highlights
- Show eliminated teams (including group-stage losers) in Final Rankings card
- Display computed fantasy points per participant in rankings table
- Card title switches between "Eliminated Teams" and "Final Rankings" based on bracket completion
- Highlight owned participants with electric blue name, dot indicator, and card border in bracket matches
- Highlight owned rows with electric border/background in rankings table
- Suppress EventSchedule for playoff_bracket sports seasons
- Fix title redundancy: bracket section title no longer repeats sport name
- Two-column match grid on desktop (md:grid-cols-2)
- Code review fixes: parallel DB fetches, targeted query for pre-eliminated, single-pass parseFloat, remove IIFE
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 22:44:33 -07:00
|
|
|
{/* Event schedule - hidden for bracket sports (the bracket itself is the event) */}
|
|
|
|
|
{scoringPattern !== "playoff_bracket" &&
|
|
|
|
|
(upcomingEvents.length > 0 || recentEvents.length > 0) && (
|
|
|
|
|
<div className="mb-6">
|
|
|
|
|
<EventSchedule
|
|
|
|
|
upcomingEvents={upcomingEvents as any}
|
|
|
|
|
recentEvents={recentEvents as any}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-03-07 21:59:29 -08:00
|
|
|
|
2025-11-12 23:44:33 -08:00
|
|
|
<SportSeasonDisplay
|
|
|
|
|
scoringPattern={scoringPattern as any}
|
|
|
|
|
sportSeasonName={sportsSeason.name}
|
|
|
|
|
sportName={sportsSeason.sport.name}
|
|
|
|
|
playoffMatches={playoffMatches as any}
|
|
|
|
|
playoffRounds={playoffRounds}
|
User/chris/bracket UI redesign (#95)
* feat: redesign playoff bracket UI with compact layout and owner display
- Replace per-match Card wrappers with compact left-vs-right rows (stacks on mobile)
- Add TeamOwnerBadge component (colored avatar + team name + username), matching the standings "Drafted By" style
- Show owner info below each participant name in bracket matches
- Add TBD forward-reference labels ("Winner of Quarterfinals M1") computed via buildFeederMap
- Add Final Rankings table below bracket showing all participants ranked by elimination round
- Fix round ordering in loader: sort by match count descending (more matches = earlier round)
- Add loser relation to playoff matches query for elimination tracking
- Extract getAvatarColor to app/lib/color-hash.ts (shared across GroupStageDisplay, SeasonStandings, TeamOwnerBadge)
- Extract groupMatchesByRound helper; share grouped map between feeder computation and render
- Remove dead getTeamAvatar from SeasonStandings after TeamOwnerBadge adoption
- Add tests for groupMatchesByRound and buildFeederMap (7 tests)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add draft order card to league home page
Show draft order on the league home page when order is set and season
is in pre_draft or draft status. Includes team name, owner name, and
a link to the draft room.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: enhance playoff bracket with eliminated teams, points, and ownership highlights
- Show eliminated teams (including group-stage losers) in Final Rankings card
- Display computed fantasy points per participant in rankings table
- Card title switches between "Eliminated Teams" and "Final Rankings" based on bracket completion
- Highlight owned participants with electric blue name, dot indicator, and card border in bracket matches
- Highlight owned rows with electric border/background in rankings table
- Suppress EventSchedule for playoff_bracket sports seasons
- Fix title redundancy: bracket section title no longer repeats sport name
- Two-column match grid on desktop (md:grid-cols-2)
- Code review fixes: parallel DB fetches, targeted query for pre-eliminated, single-pass parseFloat, remove IIFE
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 22:44:33 -07:00
|
|
|
preEliminatedParticipants={preEliminatedParticipants}
|
|
|
|
|
participantPoints={participantPoints}
|
2026-03-10 10:27:58 -07:00
|
|
|
partialScoreParticipantIds={partialScoreParticipantIds}
|
2025-11-12 23:44:33 -08:00
|
|
|
seasonStandings={seasonStandings as any}
|
2026-03-07 21:59:29 -08:00
|
|
|
seasonIsFinalized={seasonIsFinalized}
|
2025-11-12 23:44:33 -08:00
|
|
|
qpStandings={qpStandings as any}
|
|
|
|
|
qpIsFinalized={sportsSeason.qualifyingPointsFinalized || false}
|
|
|
|
|
totalMajors={sportsSeason.totalMajors}
|
|
|
|
|
majorsCompleted={sportsSeason.majorsCompleted || 0}
|
|
|
|
|
canFinalize={
|
|
|
|
|
(sportsSeason.majorsCompleted || 0) >=
|
|
|
|
|
(sportsSeason.totalMajors || 0) &&
|
|
|
|
|
!sportsSeason.qualifyingPointsFinalized
|
|
|
|
|
}
|
|
|
|
|
teamOwnerships={teamOwnerships}
|
2026-03-07 21:59:29 -08:00
|
|
|
userParticipantIds={userParticipantIds}
|
|
|
|
|
scoringRules={season}
|
2025-11-12 23:44:33 -08:00
|
|
|
showOwnership={true}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|