Stu Mason
Stu Mason

Activity

Pull Request Opened

PR #120 opened: feat(ux): phase 8 — per-prediction share view + pre-warm scheduler

Scope

Phase 8 of the UX overhaul (plan / audit / tokens / brief).

Two showpiece editorial features bolted on top of the foundational work: a screenshot-ready per-prediction share view, and scheduler pre-warm so the slow reports don't pay the 20s render cost on first visit after deploy.

What's in

  • /reports/predictions/{id} route + predictionShareCard() controller — 200 for resolved predictions; 404 for missing or unresolved.
  • reports/prediction-share.tsx — share card composed of: top eyebrow, big text-display story title, two-column metric strip (PREDICTED / ACTUAL) using <MetricValue>, "we called this" line with <StatusBadge> and short rationale, sparkline of score_history, footer with predicted/resolved timestamps + <SmartLink> to source URL. Designed for 1200×800 screenshotting.
  • <Sparkline> (new) — minimal recharts line, stroke var(--color-accent-brand), no axes/grid/tooltip. Accepts {t, score} or {t, s} data shape; "Not enough data" empty state when <2 points.
  • routes/console.php — two staggered reports:refresh entries (30 */4 / 35 */4) for AnthropicVsOpenAi + ClaudeCodeWars.
  • 4 new Pest cases for the controller (200/404/404 + schedule-list smoke).

Pragmatic notes

  • score_history shape: brief said {t, s} but PredictionFactory ships {t, score}. Sparkline accepts either to be robust.
  • Route ordered before /reports/{slug} for intent clarity (whereNumber('id') already disambiguates).

Test plan

  • npm run build clean
  • vendor/bin/pint --dirty --format agent clean
  • php artisan test --compact — 192 pass + 4 new, 26 skipped, 2 pre-existing LinkedIn failures (unrelated)
  • php artisan schedule:list | grep reports:refresh — both entries present

Merge order note

⚠️ #119 (token-utility fix) should ship first. Without that, none of Phases 1–7's visual work actually renders on prod, and Phase 8's share view will also no-op its text-strong / border-default / bg-panel-raised classes. Merge #119, let Coolify deploy, then merge this.

+364
additions
-1
deletions
7
files changed