Session 43: Data pipeline + audit fixes + depth chart foundation (2045 tests)

P0 fixes + wiring real data into the S42 Player Intelligence architecture.

- P0 dropdown z-index: the nav's backdrop-filter stacking context let the
  Ticker/HeartbeatBar paint over the avatar/More dropdowns and eat clicks.
  nav now position:relative zIndex:2; menus zIndex:100. Avatar Settings ->
  /settings.
- Real MLB stats: mlbStatsAdapter.searchPlayer + getPlayerStats (name->id->
  season+gamelog). playerIntelService.resolvePlayerStats normalizes into the
  archetype classifier; getPlayerIntel returns found:true + real season +
  archetype classified from real stats. NBA via nbaStatsClient (degrades).
- Game cards: slateAdapter.groupPropsByPlayer (playerStrips, name once) +
  mapPitchers (MLB probables), folded into mapScheduleToGameCards. Legacy
  GameCard line grid renders BookChip (brand colors) not grey text.
- Grade card intel: analyzeViaEngine1.buildIntelFields computes stat-context +
  form/usage/matchup/rest from the existing feature vector (zero extra I/O);
  gradeAdapter lights up the card sections. Archetype deferred (needs season
  line at grade time).
- Depth chart foundation: depthChartService (getLineup/getDepthChart/
  getCascadeProjection) + /api/stats/lineup|depth|cascade, graceful + injectable.
- Mobile: player hero name overflow-wrap + 24px on <=640px (was clipping).

Backend 2011 -> 2045 tests (+34), 163 suites. Web build clean (exit 0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-06-18 15:38:06 -04:00
parent 8bc79f3c38
commit 80683e71b4
19 changed files with 940 additions and 18 deletions
+3
View File
@@ -1246,6 +1246,9 @@ html[data-font="readable"] .wm::after { opacity: 0.45 !important; }
/* Grade hero zone: full-width, slightly smaller letter on phones. */
@media (max-width: 640px) {
.grade-hero { font-size: 80px !important; }
/* Session 43 — player-profile hero name was clipping (e.g. "Wembanyam")
at 390px. Shrink + wrap instead of overflowing the flex row. */
.player-hero-name { font-size: 24px !important; overflow-wrap: anywhere; }
}
/* Book-line tables scroll horizontally on small screens with a sticky
+2 -2
View File
@@ -86,8 +86,8 @@ export default function PlayerProfilePage() {
<div style={{ position: 'absolute', inset: 0, pointerEvents: 'none', background: 'repeating-linear-gradient(0deg, rgba(0,212,160,0.045) 0px, rgba(0,212,160,0.045) 1px, transparent 1px, transparent 4px)' }} />
<div style={{ position: 'relative', display: 'flex', gap: 20, alignItems: 'flex-start', flexWrap: 'wrap' }}>
<div className="mono" style={{ flex: 'none', width: 72, height: 72, borderRadius: '50%', display: 'flex', alignItems: 'center', justifyContent: 'center', background: 'radial-gradient(circle at 30% 25%, #14241F, #0A100E)', border: '1.5px solid #00D4A066', color: 'var(--g-a)', fontWeight: 700, fontSize: 30, boxShadow: '0 0 24px #00D4A022' }}>{initials(p.player)}</div>
<div style={{ flex: 1, minWidth: 240 }}>
<h1 style={{ margin: 0, fontSize: 30, fontWeight: 800, letterSpacing: '-0.015em', lineHeight: 1.05 }}>{p.player}</h1>
<div style={{ flex: 1, minWidth: 0 }}>
<h1 className="player-hero-name" style={{ margin: 0, fontSize: 30, fontWeight: 800, letterSpacing: '-0.015em', lineHeight: 1.05, overflowWrap: 'anywhere' }}>{p.player}</h1>
<div style={{ marginTop: 8, display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap' }}>
<SportBadge sport={p.sport} />
{p.team && <span className="mono" style={{ fontSize: 12, color: 'var(--text-1)' }}>{p.team}</span>}
+3 -1
View File
@@ -4,6 +4,7 @@ import { useState } from 'react';
import type { PropRowProp, PropRowResult, Tier } from '@/components/PropRow';
import SportBadge from '@/components/vyndr/SportBadge';
import SectionHead from '@/components/vyndr/SectionHead';
import BookChip from '@/components/vyndr/BookChip';
import { detectBestLines } from '@/lib/slateAdapter';
// Session 19 — PlayerCard groups props by player so a single player
// with 4 props renders as ONE card with their headshot + 4 stat
@@ -345,7 +346,8 @@ export default function GameCard(props: GameCardProps) {
<div className="label" style={{ fontSize: 10, textAlign: 'center' }}>O/U</div>
{lineRows.map((r) => (
<span key={r.book} style={{ display: 'contents' }}>
<div className="mono" style={{ fontSize: 12, fontWeight: 700, color: 'var(--text-1)', textTransform: 'capitalize', paddingLeft: 2, alignSelf: 'center' }}>{r.book}</div>
{/* Session 43 — brand-colored book chip (was plain grey text). */}
<div style={{ paddingLeft: 2, alignSelf: 'center' }}><BookChip book={r.book} size="sm" showName /></div>
<LineCell value={r.awayML} best={r.bestAway} worst={r.worstAway} />
<LineCell value={r.homeML} best={r.bestHome} worst={r.worstHome} />
<LineCell value={r.ou} />
+11 -1
View File
@@ -71,6 +71,14 @@ export default function Nav() {
<div style={{ position: 'fixed', top: 0, left: 0, right: 0, zIndex: 50 }}>
<nav
style={{
// Session 43 (P0) — the nav's backdrop-filter creates a stacking
// context; the Ticker + HeartbeatBar render after it as siblings, so
// without this they painted OVER the avatar/More dropdowns (which
// overflow below the 60px bar) and ate the clicks. position+zIndex
// floats the whole nav (and its dropdowns) above those living-layer
// bars so menu items are clickable again.
position: 'relative',
zIndex: 2,
height: 60,
borderBottom: '1px solid var(--border)',
background: 'rgba(6, 6, 11, 0.86)',
@@ -130,6 +138,7 @@ export default function Nav() {
position: 'absolute',
left: 0,
top: 'calc(100% + 8px)',
zIndex: 100,
minWidth: 180,
background: 'var(--bg-2)',
border: '1px solid var(--border-hi)',
@@ -273,6 +282,7 @@ export default function Nav() {
position: 'absolute',
right: 0,
top: 'calc(100% + 8px)',
zIndex: 100,
minWidth: 220,
background: 'var(--bg-2)',
border: '1px solid var(--border-hi)',
@@ -293,7 +303,7 @@ export default function Nav() {
</div>
</div>
<a href="/account" role="menuitem" style={menuItem}>Account</a>
<a href="/settings/security" role="menuitem" style={menuItem}>Settings</a>
<a href="/settings" role="menuitem" style={menuItem}>Settings</a>
{tier === 'free' && (
<a href="/pricing" role="menuitem" style={{ ...menuItem, color: 'var(--g-a)' }}>
Upgrade $14.99/mo
+60
View File
@@ -88,6 +88,11 @@ function mapScheduleToGameCards(schedule, gamelines, streaks, grades) {
venue: g.venue || undefined,
lines: mapGameLines(linesEntry),
props: mapGradedProps(grades, g),
// Session 43 — design enhanced-card fields (consumed by vyndr/GameCard;
// legacy GameCard ignores the extras). playerStrips = props grouped so the
// name appears once; pitchers = MLB probables when published.
playerStrips: groupPropsByPlayer(mapGradedProps(grades, g)),
pitchers: mapPitchers({ ...g, sport: g.sport }),
streaks: mapStreaks(streaks, g),
};
});
@@ -117,10 +122,65 @@ function mapStreaks(streaks, game) {
.map((s) => ({ player: s.player, text: s.text || s.description || '' }));
}
/**
* Group graded props by player → the design's enhanced-card `playerStrips`
* (Session 43): player name once, archetype + stats placeholder, all props on
* one line. `archetypeLookup(player)` is optional (sync) — when absent the
* strip renders without an archetype badge (still valid).
*/
function groupPropsByPlayer(props, archetypeLookup) {
if (!Array.isArray(props)) return [];
const byPlayer = {};
const order = [];
for (const p of props) {
if (!p || !p.player) continue;
if (!byPlayer[p.player]) {
const archetype = typeof archetypeLookup === 'function' ? archetypeLookup(p.player) : undefined;
byPlayer[p.player] = {
player: p.player,
team: p.team || '',
archetype: archetype || undefined,
stats: [], // season stats wired when the stats cache lands (Session 44)
props: [],
};
order.push(p.player);
}
byPlayer[p.player].props.push({
stat: p.stat,
line: p.line,
side: (p.side || 'Over').toString().charAt(0).toUpperCase(),
grade: p.grade,
});
}
return order.map((name) => byPlayer[name]);
}
/**
* Map an MLB schedule game's probable pitchers → the GameCard `pitchers` shape.
* Returns undefined for non-MLB or when no probables are published.
*/
function mapPitchers(game) {
if (!game || String(game.sport || '').toLowerCase() !== 'mlb') return undefined;
const a = game.away?.probablePitcher || game.awayPitcher;
const h = game.home?.probablePitcher || game.homePitcher;
if (!a && !h) return undefined;
const one = (p, era, arch) => ({
name: (p && (p.name || p.fullName)) || (typeof p === 'string' ? p : '') || 'TBD',
era: era != null ? String(era) : (p && p.era != null ? String(p.era) : '—'),
archetype: arch || (p && p.archetype) || undefined,
});
return {
away: one(a, game.awayPitcherERA, game.awayPitcherArchetype),
home: one(h, game.homePitcherERA, game.homePitcherArchetype),
};
}
module.exports = {
parseAmericanOdds,
detectBestLines,
mapGameLines,
mapScheduleToGameCards,
formatGameTime,
groupPropsByPlayer,
mapPitchers,
};