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

231 lines
6.6 KiB
TypeScript
Raw Normal View History

New design (#309) * Redesign home page with new layout and component system - Two-column layout (My Leagues 2/3, Upcoming Events 1/3) with mobile stack - LeagueRow: square avatar, gradient draft highlight, rank/points display, progress bar - MyLeaguesCard, CreateLeagueCard with shared SectionCardHeader - UpcomingEventsCard: vertical timeline with grouped multi-league events - Shared gradient system: BracktGradients SVG defs, GradientIcon wrapper, brand.ts constants - Button default variant updated to green→cyan gradient - Navbar: plain nav links with gradient hover, support/admin icon buttons - Accessibility fixes: semantic h2 headings, aria-label on LeagueAvatar and nav elements - Storybook stories for all new components Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Responsive league row layout and mobile polish - League rows stack avatar+name on top, stats full-width below on mobile - Stats spread to right side on sm+ screens with border separator on mobile - Tighter padding on mobile (px-3/py-3), full padding on sm+ - Card headers and content use px-3 sm:px-6 to reduce mobile gutters - Two-column home layout deferred to lg breakpoint (tablet gets stacked) - Active leagues sorted by completion percentage descending - Default rank 1 / 0 points for active leagues with no scoring events yet - Fix ordinal bug for 11th/12th/13th; add aria-labels to rank change indicators - Remove dead StatDivider className prop Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Improve claude file. * Add StandingsPreview card component with podium row styling - New StandingsPreview component with gold/silver/bronze row tints for top 3, team avatar, and LeagueRow-style stat columns (Ranking + Points) with rank and 7-day point change indicators - Fix GradientIcon in Storybook by adding BracktGradients decorator to preview.tsx (renamed from .ts to support JSX) - Fix degenerate SVG gradient on horizontal strokes by switching BracktGradients to gradientUnits="userSpaceOnUse" with Lucide-space coordinates (0→24) - Revert erroneous fill: url(#gradient) from GradientIcon; stroke-only fix was sufficient once gradientUnits was corrected Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update components on league homepage. * Finish up league page styling. * Work on standings page. * Add story for RecentScoresCard * Update Point Progression Chart. * Sort point progression legend by ranking and add team links to standings rows * Fix standings discrepancy on change. * Create draft cell component. * Update draft board page * Draft room improvements. * Update some draft room styling. * Fix context menu missing. * Move tab navigation and autodraft to header row, narrow sidebar * Virtualize available participants list, memoize draft room props Adds @tanstack/react-virtual to replace separate mobile/desktop lists with a single unified virtual scroll loop. Also memoizes miniDraftGrid and availableParticipantsSectionProps, and switches pick lookup from Array.find to a Map for O(1) access. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update draft room UI. * More draft room fixes. * Draft room tweaks. * Fix Rosters page. * Queue Section fixes. * Mobile Draft fixes. * Fix draft board page. * Create bracket look. * Bracket work. * Finish bracket page. * Homepage initial styling * homepage copy * Add privacy policy. Fixes #88. * how to play copy * rules copy * Fix brackets on homepage. * Add footer to website. * Glow on dots. * Landing page copy. * Fix sidebar. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:14:55 -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 },
],
},
],
},
};