Session 8: Frontend Stripe cutover, soccer pages, sport selector, grade result cards, beta badge

This commit is contained in:
Kev
2026-06-10 15:34:23 -04:00
parent ad5ea8d5a8
commit 4db1c1c539
15 changed files with 1583 additions and 161 deletions
+10 -3
View File
@@ -9,18 +9,22 @@ const monthKey = () => new Date().toISOString().slice(0, 7) + '-01';
const isSameMonth = (date: string | null | undefined) =>
!!date && date.slice(0, 7) === new Date().toISOString().slice(0, 7);
const VALID_SPORTS = new Set(['NBA', 'MLB', 'WNBA']);
const VALID_SPORTS = new Set(['NBA', 'MLB', 'WNBA', 'Soccer']);
const VALID_DIRECTIONS = new Set(['over', 'under']);
const VALID_NBA_STATS = new Set(['points', 'rebounds', 'assists', 'threes', 'blocks', 'steals', 'pra', 'turnovers']);
const VALID_MLB_STATS = new Set([
'strikeouts', 'hits_allowed', 'earned_runs', 'innings_pitched', 'walks_allowed',
'hits', 'total_bases', 'rbi', 'runs', 'stolen_bases', 'home_runs', 'walks', 'singles', 'doubles',
]);
const VALID_SOCCER_STATS = new Set([
'goals', 'assists', 'shots_on_target', 'shots', 'tackles',
'cards', 'corners', 'saves', 'goals_conceded', 'passes', 'clean_sheet',
]);
export const dynamic = 'force-dynamic';
interface ScanBody {
sport: 'NBA' | 'MLB' | 'WNBA';
sport: 'NBA' | 'MLB' | 'WNBA' | 'Soccer';
player: string;
stat: string;
line: number;
@@ -45,7 +49,10 @@ export async function POST(req: NextRequest) {
return jsonError(400, 'Line must be a number between 0 and 500.');
}
const validStats = body.sport === 'MLB' ? VALID_MLB_STATS : VALID_NBA_STATS;
const validStats =
body.sport === 'MLB' ? VALID_MLB_STATS :
body.sport === 'Soccer' ? VALID_SOCCER_STATS :
VALID_NBA_STATS;
if (!validStats.has(body.stat)) {
return jsonError(400, `Stat "${body.stat}" not supported for ${body.sport}.`);
}