{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "session-stats",
  "title": "Session stats",
  "description": "Your HUD from a hand history you uploaded to Poker Study AI. Needs your API key.",
  "registryDependencies": [
    "https://www.pokerstudy.ai/r/poker-core.json",
    "https://www.pokerstudy.ai/r/player-stats.json",
    "https://www.pokerstudy.ai/r/pokerstudy-api.json"
  ],
  "files": [
    {
      "path": "src/components/pokerstudy/session-stats.tsx",
      "content": "\"use client\";\n\nimport { PlayerStatsGrid } from \"@/components/pokerstudy/player-stats\";\nimport { PokerStudyStatus, usePokerStudy } from \"@/components/pokerstudy/use-pokerstudy\";\nimport type { SessionListItem, SessionSummary } from \"@/lib/pokerstudy/poker\";\n\n/** A session's headline numbers and the hero's HUD, from data already fetched. */\nexport function SessionStatsView({ data }: { data: SessionSummary }) {\n  const s = data.session;\n  const when = s.lastTs ?? s.firstTs ?? data.createdAt;\n  return (\n    <div className=\"flex w-full max-w-[560px] flex-col gap-4\">\n      <div className=\"flex flex-wrap items-baseline justify-between gap-2\">\n        <span className=\"text-sm font-medium text-foreground\">\n          {data.hero}\n          {s.gameType ? <span className=\"text-muted-foreground\"> · {s.gameType}</span> : null}\n        </span>\n        <span className=\"font-mono text-xs text-muted-foreground\">\n          {s.heroHandsPlayed} of {s.totalHands} hands · {new Date(when).toLocaleDateString()}\n        </span>\n      </div>\n      <PlayerStatsGrid stats={data.heroStats} />\n    </div>\n  );\n}\n\n/**\n * Your stats from a hand history you uploaded to Poker Study AI. Pass\n * `sessionId`, or leave it out for the most recent session. Reads the key\n * owner's private data through `/api/pokerstudy`, so it only works where\n * `authorizePrivate` lets the request through.\n */\nexport function SessionStats({\n  sessionId,\n  endpoint = \"/api/pokerstudy\",\n  initialData,\n}: {\n  sessionId?: string;\n  endpoint?: string;\n  initialData?: SessionSummary;\n}) {\n  const list = usePokerStudy<{ sessions: SessionListItem[] }>(\n    sessionId || initialData ? null : `${endpoint}/sessions`,\n  );\n  const id = sessionId ?? (list.status === \"ready\" ? list.data.sessions[0]?.id : undefined);\n  const detail = usePokerStudy<SessionSummary>(id ? `${endpoint}/sessions/${id}` : null, { initialData });\n\n  if (!sessionId && !initialData && list.status !== \"ready\") return <PokerStudyStatus state={list} />;\n  if (!id && !initialData) {\n    return <p className=\"text-sm text-muted-foreground\">No uploaded sessions yet. Upload a hand history at pokerstudy.ai.</p>;\n  }\n  if (detail.status !== \"ready\") return <PokerStudyStatus state={detail} />;\n  return <SessionStatsView data={detail.data} />;\n}\n",
      "type": "registry:component",
      "target": "components/pokerstudy/session-stats.tsx"
    }
  ],
  "type": "registry:block"
}