Session 23: All-day intelligence layer — schedule, game lines, streaks, hot lists, stat filtering, ParlayAPI dead (1567 tests)

This commit is contained in:
Kev
2026-06-12 11:16:58 -04:00
parent 6ab49d4c37
commit 0538205fab
32 changed files with 2276 additions and 2 deletions
+39
View File
@@ -0,0 +1,39 @@
/**
* Stat-filter categories per sport — frontend mirror (Session 23).
* Keep aligned with `src/config/statFilters.js` in the Node backend.
*
* The stat filter is VYNDR's navigation system: users browse by what
* they care about (a 3-point streak, hot hitters, run lines), not by
* sport alone. Drives StatFilterPills and the `?stat=` param on the
* /api/streaks and /api/hotlist endpoints.
*/
export type StatFilterSport = 'nba' | 'wnba' | 'mlb' | 'soccer' | 'nfl';
export const STAT_FILTERS: Record<StatFilterSport, string[]> = {
nba: ['all', 'points', 'rebounds', 'assists', 'threes', 'blocks', 'steals', 'pra'],
wnba: ['all', 'points', 'rebounds', 'assists', 'threes', 'blocks', 'steals'],
mlb: ['all', 'hits', 'home_runs', 'stolen_bases', 'rbis', 'strikeouts', 'total_bases', 'on_base'],
soccer: ['all', 'goals', 'assists', 'shots', 'tackles', 'saves'],
nfl: ['all', 'passing_yards', 'rushing_yards', 'receiving_yards', 'touchdowns', 'interceptions'],
};
const LABELS: Record<string, string> = {
all: 'All',
points: 'Points', rebounds: 'Rebounds', assists: 'Assists', threes: '3-Pointers',
blocks: 'Blocks', steals: 'Steals', pra: 'PRA',
hits: 'Hits', home_runs: 'Home Runs', stolen_bases: 'Stolen Bases', rbis: 'RBIs',
strikeouts: 'Strikeouts', total_bases: 'Total Bases', on_base: 'On-Base',
goals: 'Goals', shots: 'Shots', tackles: 'Tackles', saves: 'Saves',
passing_yards: 'Pass Yds', rushing_yards: 'Rush Yds', receiving_yards: 'Rec Yds',
touchdowns: 'TDs', interceptions: 'INTs',
};
export function getStatFilters(sport: string): string[] {
return STAT_FILTERS[sport as StatFilterSport] || ['all'];
}
export function formatStatLabel(stat: string): string {
if (LABELS[stat]) return LABELS[stat];
return stat.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
}