Session 44: Make it visible — VYNDR archetype names, grade intel, schedule fix, landing page (2061 tests)
Frontend + wiring only. Wires existing backend into the pages users see. - VYNDR Original archetype rename (41) across archetypeService.js + lib/ archetypes.js + ArchetypeBadge, each keeping legacyName (resolves stale data). Judge -> BOMBER. Old POWER PULL slot -> WHIFF strikeout-artist pitcher. - BACKEND_HANDOFF.md: canonical frontend<->backend data contract. - Grade card intel: scan/page.tsx now forwards the engine's intel fields (season_avg/form/usage/matchup_grade/archetype/...) into mapScanToGradeResult -> STAT CONTEXT + VYNDR INTELLIGENCE sections populate. The chain already preserved them (tierGating + /api/scan spread); the page was dropping them. - Schedule freshness: slateAdapter.isRelevantGame drops completed games >24h old; Slate.filteredGames applies it. (TTL already 60s.) - Landing: Features.tsx rewritten to user-facing copy (no Point-biserial/Zone 14/ABS/Phi-coefficient). - Depth chart Next proxies added (/api/stats/lineup|depth|cascade) - were 404. - GameCard swap DEFERRED (Kev): legacy on-demand card stays as a bridge until the snapshot pipeline populates the grades cache; vyndr/GameCard swaps in then. Backend 2045 -> 2061 tests (+16), 167 suites. Web build clean (exit 0). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
const BACKEND_URL = process.env.BACKEND_URL || 'http://localhost:3000';
|
||||
|
||||
/** Cascade proxy (Session 44) — forwards GET /api/stats/cascade/:player to Express. */
|
||||
export async function GET(req: NextRequest, ctx: { params: Promise<{ player: string }> }) {
|
||||
const { player } = await ctx.params;
|
||||
const qs = req.nextUrl.search;
|
||||
try {
|
||||
const upstream = await fetch(`${BACKEND_URL}/api/stats/cascade/${encodeURIComponent(player)}${qs}`, {
|
||||
method: 'GET',
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
const data = await upstream.json().catch(() => ({}));
|
||||
return NextResponse.json(data, { status: upstream.ok ? 200 : upstream.status });
|
||||
} catch {
|
||||
return NextResponse.json({ error: 'Cascade service is unreachable. Try again in a moment.' }, { status: 502 });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
const BACKEND_URL = process.env.BACKEND_URL || 'http://localhost:3000';
|
||||
|
||||
/** Depth chart proxy (Session 44) — forwards GET /api/stats/depth/:team to Express. */
|
||||
export async function GET(req: NextRequest, ctx: { params: Promise<{ team: string }> }) {
|
||||
const { team } = await ctx.params;
|
||||
const qs = req.nextUrl.search;
|
||||
try {
|
||||
const upstream = await fetch(`${BACKEND_URL}/api/stats/depth/${encodeURIComponent(team)}${qs}`, {
|
||||
method: 'GET',
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
const data = await upstream.json().catch(() => ({}));
|
||||
return NextResponse.json(data, { status: upstream.ok ? 200 : upstream.status });
|
||||
} catch {
|
||||
return NextResponse.json({ error: 'Depth chart service is unreachable. Try again in a moment.' }, { status: 502 });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
const BACKEND_URL = process.env.BACKEND_URL || 'http://localhost:3000';
|
||||
|
||||
/** Lineup proxy (Session 44) — forwards GET /api/stats/lineup/:team to Express. */
|
||||
export async function GET(req: NextRequest, ctx: { params: Promise<{ team: string }> }) {
|
||||
const { team } = await ctx.params;
|
||||
const qs = req.nextUrl.search;
|
||||
try {
|
||||
const upstream = await fetch(`${BACKEND_URL}/api/stats/lineup/${encodeURIComponent(team)}${qs}`, {
|
||||
method: 'GET',
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
const data = await upstream.json().catch(() => ({}));
|
||||
return NextResponse.json(data, { status: upstream.ok ? 200 : upstream.status });
|
||||
} catch {
|
||||
return NextResponse.json({ error: 'Lineup service is unreachable. Try again in a moment.' }, { status: 502 });
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,18 @@ interface ScanResponse {
|
||||
tier: 'free' | 'analyst' | 'desk';
|
||||
error?: string;
|
||||
upgrade?: { tier: string; price: number };
|
||||
// Session 43/44 — Player-Intelligence fields the engine attaches; the grade
|
||||
// card's STAT CONTEXT + VYNDR INTELLIGENCE sections read these.
|
||||
season_avg?: number;
|
||||
last10_avg?: number;
|
||||
vs_opp_avg?: number;
|
||||
form?: number;
|
||||
usage?: string;
|
||||
matchup_grade?: string;
|
||||
rest?: string;
|
||||
archetype?: string;
|
||||
archetype_blend?: { archetype: string; weight: number }[];
|
||||
prop_dna?: { reliable: string[]; volatile: string[] };
|
||||
}
|
||||
|
||||
const NBA_STATS = [
|
||||
@@ -689,6 +701,18 @@ export default function ScanPage() {
|
||||
alt_lines: result.alt_lines,
|
||||
kill_conditions: result.kill_conditions,
|
||||
tier,
|
||||
// Session 44 — forward the engine's intel fields so the grade
|
||||
// card's STAT CONTEXT + VYNDR INTELLIGENCE sections populate.
|
||||
season_avg: result.season_avg,
|
||||
last10_avg: result.last10_avg,
|
||||
vs_opp_avg: result.vs_opp_avg,
|
||||
form: result.form,
|
||||
usage: result.usage,
|
||||
matchup_grade: result.matchup_grade,
|
||||
rest: result.rest,
|
||||
archetype: result.archetype,
|
||||
archetype_blend: result.archetype_blend,
|
||||
prop_dna: result.prop_dna,
|
||||
}) as GradeResultData}
|
||||
onAddToParlay={() => {
|
||||
addLeg({
|
||||
|
||||
Reference in New Issue
Block a user