brackt/app/types/standings.ts
Chris Parsons 063834d8e6
Display team owner names in standings views (#184)
* Show team name + username in standings, extract TeamNameDisplay component

- Add TeamNameDisplay component that renders team name (as link) with owner username below, matching the league homepage style
- Update StandingsTable to use TeamNameDisplay with owner username shown below team name
- Update league homepage standings section to use TeamNameDisplay
- Add ownerName/teamOwnerId fields to TeamStanding type
- Extend getSeasonStandings to include teamOwnerId from team relation
- Fetch and attach owner display names in the full standings page loader

https://claude.ai/code/session_01EYgGnuTBaRVdBDapJRTxDZ

* Address code review: type hygiene, explicit types, parallel fetching, style fix

- Remove teamOwnerId from TeamStanding type (was an internal server concern, not display data)
- Remove teamOwnerId from getSeasonStandings return value
- Add TeamStandingWithChange interface extending TeamStanding with sevenDayRankChange/sevenDayOldRank fields
- Annotate getSevenDayStandingsChange with explicit Promise<TeamStandingWithChange[]> return type
- Re-export TeamStandingWithChange from models/standings.ts
- Standings loader: query teams table directly for ownerIds instead of relying on teamOwnerId in standings data
- Standings loader: parallelize all independent queries (standings, teams, progressionData, seasonComplete, completionPercentage) with Promise.all
- Restore font-medium on StandingsTable team TableCell

https://claude.ai/code/session_01EYgGnuTBaRVdBDapJRTxDZ

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-19 20:19:28 -07:00

40 lines
947 B
TypeScript

/**
* Shared types for standings that can be used in both server and client code
*/
export interface TeamStanding {
teamId: string;
teamName: string;
ownerName?: string | null;
totalPoints: number;
currentRank: number;
previousRank: number | null;
rankChange: number; // Positive = moved up, negative = moved down
placementCounts: {
first: number;
second: number;
third: number;
fourth: number;
fifth: number;
sixth: number;
seventh: number;
eighth: number;
};
participantsRemaining: number;
calculatedAt: Date;
// Phase 5.4: Expected value projections
actualPoints?: number | null;
projectedPoints?: number | null;
participantsFinished?: number | null;
}
export interface TeamStandingSnapshot {
date: Date;
rank: number;
totalPoints: number;
}
export interface TeamStandingWithChange extends TeamStanding {
sevenDayRankChange: number;
sevenDayOldRank: number | null;
}