brackt/app/components/league/StandingsPreview.stories.tsx
Chris Parsons b960d39be3
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 3m23s
🚀 Deploy / 🧪 Test (push) Successful in 3m9s
🚀 Deploy / ʦ🔍 Typecheck & Lint (push) Successful in 1m20s
🚀 Deploy / 🐳 Build (push) Successful in 1m9s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m23s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (push) Successful in 12s
Add projections to full standings; clean up change indicators
Surface projected final points on the full standings page and restructure
the rank/point change indicators so columns align cleanly on desktop and
mobile.

- StatHelpers: stacked label/value/delta columns with a per-row reservable
  delta line; merge rank/point indicators into a single DeltaBadge;
  parameterize StatDivider height.
- StandingsPreview: opt-in `showProjected` column (projected points only),
  gated on participants remaining; reserve the delta line only when a row
  actually moved (no stray em-dashes).
- Full standings page: pass projected data + showProjected (hidden when the
  season is complete).
- League home: fetch via getSevenDayStandingsChange so the preview shows the
  same 7-day rank/point changes as the full standings page.
- LeagueRow: top-align stats and restore h-8 dividers so the shared-component
  changes don't alter the league list rows.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 11:56:15 -07:00

311 lines
7 KiB
TypeScript

import type { Meta, StoryObj } from "@storybook/react-vite";
import { StandingsPreview } from "./StandingsPreview";
const meta: Meta<typeof StandingsPreview> = {
title: "League/StandingsPreview",
component: StandingsPreview,
parameters: {
layout: "padded",
},
};
export default meta;
type Story = StoryObj<typeof StandingsPreview>;
export const TopThreePodium: Story = {
args: {
entries: [
{
teamId: "t1",
teamName: "Lightning Wolves",
ownerName: "alice",
displayRank: 1,
currentRank: 1,
points: 2810,
href: "/leagues/1/standings/1/teams/t1",
},
{
teamId: "t2",
teamName: "Shadow Hawks",
ownerName: "bob",
displayRank: 2,
currentRank: 2,
points: 2654.5,
href: "/leagues/1/standings/1/teams/t2",
},
{
teamId: "t3",
teamName: "Iron Eagles",
ownerName: "carol",
displayRank: 3,
currentRank: 3,
points: 2493,
href: "/leagues/1/standings/1/teams/t3",
},
],
},
};
export const FullLeague: Story = {
args: {
entries: [
{
teamId: "t1",
teamName: "Lightning Wolves",
ownerName: "alice",
displayRank: 1,
currentRank: 1,
points: 2810,
rankChange: 2,
pointChange: 87.5,
href: "/leagues/1/standings/1/teams/t1",
},
{
teamId: "t2",
teamName: "Shadow Hawks",
ownerName: "bob",
displayRank: 2,
currentRank: 2,
points: 2654.5,
rankChange: 0,
pointChange: 42.0,
href: "/leagues/1/standings/1/teams/t2",
},
{
teamId: "t3",
teamName: "Iron Eagles",
ownerName: "carol",
displayRank: 3,
currentRank: 3,
points: 2493,
rankChange: -1,
pointChange: -12.3,
href: "/leagues/1/standings/1/teams/t3",
},
{
teamId: "t4",
teamName: "Cyber Foxes",
ownerName: "dave",
displayRank: 4,
currentRank: 4,
points: 2311.8,
rankChange: 1,
pointChange: 23.1,
href: "/leagues/1/standings/1/teams/t4",
},
{
teamId: "t5",
teamName: "Neon Tigers",
ownerName: "eve",
displayRank: 5,
currentRank: 5,
points: 2108,
rankChange: -2,
pointChange: -55.0,
href: "/leagues/1/standings/1/teams/t5",
},
{
teamId: "t6",
teamName: "Phantom Sharks",
ownerName: "frank",
displayRank: 6,
currentRank: 6,
points: 1987.3,
rankChange: 0,
pointChange: 0,
href: "/leagues/1/standings/1/teams/t6",
},
{
teamId: "t7",
teamName: "Crimson Tide FC",
ownerName: "grace",
displayRank: 7,
currentRank: 7,
points: 1834,
href: "/leagues/1/standings/1/teams/t7",
},
{
teamId: "t8",
teamName: "Arctic Wolves United",
ownerName: "hank",
displayRank: 8,
currentRank: 8,
points: 1692.6,
href: "/leagues/1/standings/1/teams/t8",
},
],
},
};
export const WithProjections: Story = {
args: {
showProjected: true,
entries: [
{
teamId: "t1",
teamName: "Lightning Wolves",
ownerName: "alice",
displayRank: 1,
currentRank: 1,
points: 2810,
rankChange: 2,
pointChange: 87.5,
projectedPoints: 3120,
participantsRemaining: 3,
href: "/leagues/1/standings/1/teams/t1",
},
{
teamId: "t2",
teamName: "Shadow Hawks",
ownerName: "bob",
displayRank: 2,
currentRank: 2,
points: 2654.5,
rankChange: -1,
pointChange: 42.0,
projectedPoints: 2980,
participantsRemaining: 2,
href: "/leagues/1/standings/1/teams/t2",
},
{
teamId: "t3",
teamName: "Iron Eagles",
ownerName: "carol",
displayRank: 3,
currentRank: 3,
points: 2493,
// No 7-day change and no live participants — placeholders keep alignment.
projectedPoints: 2493,
participantsRemaining: 0,
href: "/leagues/1/standings/1/teams/t3",
},
],
},
};
export const WithTies: Story = {
args: {
entries: [
{
teamId: "t1",
teamName: "Lightning Wolves",
ownerName: "alice",
displayRank: "T1",
currentRank: 1,
points: 2810,
href: "/leagues/1/standings/1/teams/t1",
},
{
teamId: "t2",
teamName: "Shadow Hawks",
ownerName: "bob",
displayRank: "T1",
currentRank: 1,
points: 2810,
href: "/leagues/1/standings/1/teams/t2",
},
{
teamId: "t3",
teamName: "Iron Eagles",
ownerName: "carol",
displayRank: "T3",
currentRank: 3,
points: 2493,
href: "/leagues/1/standings/1/teams/t3",
},
{
teamId: "t4",
teamName: "Cyber Foxes",
ownerName: "dave",
displayRank: "T3",
currentRank: 3,
points: 2493,
href: "/leagues/1/standings/1/teams/t4",
},
],
},
};
export const AllUnranked: Story = {
args: {
entries: [
{
teamId: "t1",
teamName: "Lightning Wolves",
ownerName: "alice",
displayRank: "T1",
points: 0,
href: "/leagues/1/standings/1/teams/t1",
},
{
teamId: "t2",
teamName: "Shadow Hawks",
ownerName: "bob",
displayRank: "T1",
points: 0,
href: "/leagues/1/standings/1/teams/t2",
},
{
teamId: "t3",
teamName: "Iron Eagles",
ownerName: "carol",
displayRank: "T1",
points: 0,
href: "/leagues/1/standings/1/teams/t3",
},
],
},
};
export const NoOwnerNames: Story = {
args: {
entries: [
{
teamId: "t1",
teamName: "Lightning Wolves",
displayRank: 1,
currentRank: 1,
points: 2810,
},
{
teamId: "t2",
teamName: "Shadow Hawks",
displayRank: 2,
currentRank: 2,
points: 2654.5,
},
{
teamId: "t3",
teamName: "Iron Eagles",
displayRank: 3,
currentRank: 3,
points: 2493,
},
],
},
};
export const LongTeamNames: Story = {
args: {
entries: [
{
teamId: "t1",
teamName: "The Unstoppable Championship Winning Lightning Wolves",
ownerName: "alice_with_a_really_long_username",
displayRank: 1,
currentRank: 1,
points: 2810,
href: "/leagues/1/standings/1/teams/t1",
},
{
teamId: "t2",
teamName: "Shadow Hawks of the Northern Division",
ownerName: "bob",
displayRank: 2,
currentRank: 2,
points: 2654.5,
href: "/leagues/1/standings/1/teams/t2",
},
],
},
};