brackt/app/components/league/SportsSeasonsSummary.stories.tsx

231 lines
6.6 KiB
TypeScript
Raw Normal View History

2026-04-14 09:39:13 -07:00
import type { Meta, StoryObj } from "@storybook/react-vite";
import { SportsSeasonsSummary } from "./SportsSeasonsSummary";
import type { SportSeasonSummaryItem } from "./SportsSeasonsSummary";
const meta: Meta<typeof SportsSeasonsSummary> = {
title: "League/SportsSeasonsSummary",
component: SportsSeasonsSummary,
parameters: {
layout: "padded",
},
args: {
leagueId: "league-abc-123",
},
};
export default meta;
type Story = StoryObj<typeof SportsSeasonsSummary>;
// ─── Fixtures ─────────────────────────────────────────────────────────────────
const nba: SportSeasonSummaryItem = {
id: "ss-nba",
sportName: "NBA",
seasonName: "2025 NBA Season",
status: "active",
scoringPattern: "playoff_bracket",
draftedParticipants: [
{ id: "p1", name: "LeBron James", earnedPoints: null, currentQP: null },
{ id: "p2", name: "Jayson Tatum", earnedPoints: 62.5, currentQP: null },
],
upcomingParticipantEvents: [
{
id: "ev-nba-1",
name: "Conference Semifinals",
matchLabel: "Game 2",
eventDate: null,
earliestGameTime: "2026-04-20T19:30:00.000Z",
eventType: "playoff_game",
sportsSeasonId: "ss-nba",
relevantParticipants: [{ id: "p1", name: "LeBron James" }],
},
],
};
const f1: SportSeasonSummaryItem = {
id: "ss-f1",
sportName: "F1",
seasonName: "2025 Formula 1 World Championship",
status: "active",
scoringPattern: "season_standings",
draftedParticipants: [
{ id: "p3", name: "Max Verstappen", earnedPoints: 250, currentQP: null },
{ id: "p4", name: "Charles Leclerc", earnedPoints: 125, currentQP: null },
{ id: "p5", name: "Fernando Alonso", earnedPoints: 62.5, currentQP: null },
{ id: "p6", name: "Lewis Hamilton", earnedPoints: 62.5, currentQP: null },
],
upcomingParticipantEvents: [
{
id: "ev-f1-1",
name: "Monaco Grand Prix",
matchLabel: null,
eventDate: "2026-05-25",
earliestGameTime: null,
eventType: "race",
sportsSeasonId: "ss-f1",
relevantParticipants: [
{ id: "p3", name: "Max Verstappen" },
{ id: "p4", name: "Charles Leclerc" },
{ id: "p5", name: "Fernando Alonso" },
{ id: "p6", name: "Lewis Hamilton" },
],
},
],
};
const golf: SportSeasonSummaryItem = {
id: "ss-golf",
sportName: "Golf",
seasonName: "2025 Major Season",
status: "active",
scoringPattern: "qualifying_points",
draftedParticipants: [
{ id: "p7", name: "Scottie Scheffler", earnedPoints: null, currentQP: 550 },
{ id: "p8", name: "Rory McIlroy", earnedPoints: null, currentQP: 325 },
],
upcomingParticipantEvents: [
{
id: "ev-golf-1",
name: "US Open",
matchLabel: null,
eventDate: "2026-06-15",
earliestGameTime: null,
eventType: "tournament",
sportsSeasonId: "ss-golf",
relevantParticipants: [
{ id: "p7", name: "Scottie Scheffler" },
{ id: "p8", name: "Rory McIlroy" },
],
},
],
};
const darts: SportSeasonSummaryItem = {
id: "ss-darts",
sportName: "Darts",
seasonName: "PDC World Darts Championship 2025",
status: "completed",
scoringPattern: "playoff_bracket",
draftedParticipants: [
{ id: "p9", name: "Michael van Gerwen", earnedPoints: 250, currentQP: null },
],
upcomingParticipantEvents: [],
};
const snooker: SportSeasonSummaryItem = {
id: "ss-snooker",
sportName: "Snooker",
seasonName: "2025 World Snooker Championship",
status: "upcoming",
scoringPattern: "playoff_bracket",
draftedParticipants: [
{ id: "p10", name: "Ronnie O'Sullivan", earnedPoints: null, currentQP: null },
{ id: "p11", name: "Judd Trump", earnedPoints: null, currentQP: null },
],
upcomingParticipantEvents: [],
};
const nhl: SportSeasonSummaryItem = {
id: "ss-nhl",
sportName: "NHL",
seasonName: "2024-25 NHL Season",
status: "active",
scoringPattern: "season_standings",
draftedParticipants: [
{ id: "p12", name: "Connor McDavid", earnedPoints: null, currentQP: null },
{ id: "p13", name: "Nathan MacKinnon", earnedPoints: 125, currentQP: null },
{ id: "p14", name: "David Pastrnak", earnedPoints: 62.5, currentQP: null },
],
upcomingParticipantEvents: [
{
id: "ev-nhl-1",
name: "Playoffs Round 1",
matchLabel: "Game 4",
eventDate: null,
earliestGameTime: "2026-04-21T23:00:00.000Z",
eventType: "playoff_game",
sportsSeasonId: "ss-nhl",
relevantParticipants: [{ id: "p12", name: "Connor McDavid" }],
},
],
};
// ─── Stories ──────────────────────────────────────────────────────────────────
export const AllStatuses: Story = {
args: {
sportsSeasons: [nba, golf, snooker, darts],
},
};
export const ActiveWithPoints: Story = {
name: "Active Sports — Mix of earned + pending points",
args: {
sportsSeasons: [nba, f1, nhl],
},
};
export const QualifyingPoints: Story = {
name: "Qualifying Points Sport (Golf)",
args: {
sportsSeasons: [golf],
},
};
export const WithViewAllLink: Story = {
args: {
sportsSeasons: [nba, f1, golf, snooker, darts],
allSeasonsHref: "/leagues/league-abc-123/sports-seasons",
},
};
export const ManyParticipants: Story = {
name: "Many Participants (overflow chip)",
args: {
sportsSeasons: [f1],
},
};
export const NoParticipants: Story = {
name: "No Drafted Participants (viewer not in league)",
args: {
sportsSeasons: [nba, snooker, darts].map((ss) => ({ ...ss, draftedParticipants: [] })),
},
};
export const CompletedWithPoints: Story = {
name: "Completed — Points Earned",
args: {
sportsSeasons: [
darts,
{ ...snooker, status: "completed" as const, draftedParticipants: [
{ id: "p10", name: "Ronnie O'Sullivan", earnedPoints: 125, currentQP: null },
]},
],
},
};
export const LargeLeague: Story = {
name: "Large League (6 sports)",
args: {
sportsSeasons: [nba, f1, nhl, golf, snooker, darts],
allSeasonsHref: "/leagues/league-abc-123/sports-seasons",
},
};
export const LongNames: Story = {
args: {
sportsSeasons: [
{
...f1,
sportName: "UEFA Champions League European Football",
seasonName: "2024/25 Group Stage through Final — Extended Edition",
draftedParticipants: [
{ id: "p3", name: "Erling Braut Haaland", earnedPoints: 250, currentQP: null },
{ id: "p4", name: "Vinicius José de Oliveira Junior", earnedPoints: 125, currentQP: null },
],
},
],
},
};