8bc79f3c38
Built from the Claude Design "VYNDR Player Intelligence" bundle (10 sections). - Archetypes: src/services/archetypeService.js — 41 archetypes (15 NBA / 5 WNBA-unique / 15 MLB / 6 soccer), classify -> primary+secondary+blend. Frontend visual map web/src/lib/archetypes.js (colors verified == backend). ArchetypeBadge (full/ghost/tint + glyphs) + ArchetypeBlend (DNA bar). - StatStrip (compact/expanded): player name once, horizontal mono stats, inline GradeBadge props, onPlayerClick -> profile. - Stats API: extended src/routes/stats.js with /player/:name, /leaders, /game/:id (rate-limited). Aggregation in playerIntelService.js (sanitizes name param; grades cache; graceful on cold cache). Next proxies added. - Player Profile /player/[name]: all 9 design sections, graceful empty states. - Enhanced GameCard (MLB pitchers + player-grouped StatStrips) + GradeResultCard (archetype strip + stat context + VYNDR intelligence, optional/self-hiding via gradeAdapter.buildIntelFields). Player-name links wired everywhere. - Settings page replaces the S41 redirect (account/subscription/notifications/ display/responsible-play/danger-zone with DELETE-gated delete). LINKS to the real /settings/security MFA page — does not replace it. + BookChip. - Bonus: Stats Explorer /explore (real /api/stats/leaders leaderboard); added Explore + Settings to Nav MORE. Deferred (need data pipelines, Session 43): Team Hub, Offseason Intel, Slate redesign, Stats Explorer sub-panels. Backend 1940 -> 2011 tests (+71), 157 suites. Web build clean (exit 0). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
49 lines
1.8 KiB
JavaScript
49 lines
1.8 KiB
JavaScript
// Session 42 — StatStrip (.tsx asserted as text; the design's hard rules are
|
|
// structural so they're verifiable in source).
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const WEB = path.join(__dirname, '..', '..', 'web', 'src');
|
|
const src = fs.readFileSync(path.join(WEB, 'components', 'vyndr', 'StatStrip.tsx'), 'utf8');
|
|
|
|
describe('StatStrip.tsx', () => {
|
|
it('renders the player name ONCE (single PlayerName helper, not per-stat)', () => {
|
|
// PlayerName is defined once and the stats map never references `player`.
|
|
const playerNameUses = (src.match(/<PlayerName/g) || []).length;
|
|
expect(playerNameUses).toBeGreaterThan(0);
|
|
// the stat row maps over `stats`, not the player name
|
|
expect(src).toMatch(/stats\.map/);
|
|
expect(src).not.toMatch(/stats\.map[\s\S]{0,80}\{player\}/);
|
|
});
|
|
|
|
it('lays stats out horizontally with mono + separators (no vertical repetition)', () => {
|
|
expect(src).toContain('className="mono"');
|
|
expect(src).toContain('const Sep =');
|
|
expect(src).toMatch(/flexWrap: 'wrap'/);
|
|
});
|
|
|
|
it('renders props inline with GradeBadge', () => {
|
|
expect(src).toContain('GradeBadge');
|
|
expect(src).toMatch(/props\.map/);
|
|
expect(src).toContain('PROPS');
|
|
});
|
|
|
|
it('expanded variant shows archetype badge(s)', () => {
|
|
expect(src).toContain("variant === 'expanded'");
|
|
expect(src).toContain('ArchetypeBadge');
|
|
expect(src).toContain('showDesc');
|
|
});
|
|
|
|
it('supports an onPlayerClick navigation hook (keyboard accessible)', () => {
|
|
expect(src).toContain('onPlayerClick');
|
|
expect(src).toContain('onKeyDown');
|
|
expect(src).toContain("role=\"link\"");
|
|
});
|
|
|
|
it('compact variant supports primary + secondary archetypes', () => {
|
|
expect(src).toContain('archetype.primary');
|
|
expect(src).toContain('archetype?.secondary');
|
|
expect(src).toContain("variant=\"ghost\"");
|
|
});
|
|
});
|