Add per-lottery stats page: number frequency, draw timeline, Loki's performance over time
New /loterie/[id] page, linked from each lottery's name in the results panel. Three visualizations, all derived client-side from LokiLab's extended army-feed (recentDraws + pickHistory) with no new math on LokiLab's side: - NumberFrequencyChart: bar chart of each number's appearances across the last ~30 draws - PerformanceChart: Loki's cumulative win rate over time, line chart - DrawTimeline: scannable list of recent draws with Loki's pick and hit highlighting where available Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
c3a0a7b765
commit
c36b621d39
@@ -0,0 +1,27 @@
|
||||
import { NumberSequence } from "@/components/number-sequence"
|
||||
import type { LotteryFeedEntry } from "@/lib/lokilab-feed"
|
||||
|
||||
export function DrawTimeline({ entry }: { entry: LotteryFeedEntry }) {
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{entry.recentDraws.map((draw) => {
|
||||
const resultSet = new Set(draw.result)
|
||||
return (
|
||||
<div
|
||||
key={draw.date}
|
||||
className="flex flex-wrap items-center gap-3 rounded-md border border-border/60 bg-panel px-3 py-2"
|
||||
>
|
||||
<span className="w-20 shrink-0 text-xs text-muted-foreground tabular-nums">{draw.date}</span>
|
||||
<NumberSequence numbers={draw.result} />
|
||||
{draw.pick && (
|
||||
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
Choix:
|
||||
<NumberSequence numbers={draw.pick} hitSet={resultSet} />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import Link from "next/link"
|
||||
import { NumberSequence } from "@/components/number-sequence"
|
||||
import { FollowButton } from "@/components/follow-button"
|
||||
import type { LotteryFeedEntry } from "@/lib/lokilab-feed"
|
||||
@@ -29,7 +30,9 @@ export function LotteryMobileCard({
|
||||
isAuthenticated={isAuthenticated}
|
||||
/>
|
||||
)}
|
||||
{entry.name}
|
||||
<Link href={`/loterie/${entry.id}`} className="hover:text-accent hover:underline">
|
||||
{entry.name}
|
||||
</Link>
|
||||
</p>
|
||||
{lifetime.picksTracked > 0 ? (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import Link from "next/link"
|
||||
import { NumberSequence } from "@/components/number-sequence"
|
||||
import { FollowButton } from "@/components/follow-button"
|
||||
import type { LotteryFeedEntry } from "@/lib/lokilab-feed"
|
||||
@@ -31,9 +32,13 @@ export function LotteryRow({
|
||||
</div>
|
||||
|
||||
<div className="min-w-0">
|
||||
<p className="truncate font-semibold leading-tight" title={entry.name}>
|
||||
<Link
|
||||
href={`/loterie/${entry.id}`}
|
||||
className="block truncate font-semibold leading-tight hover:text-accent hover:underline"
|
||||
title={entry.name}
|
||||
>
|
||||
{entry.name}
|
||||
</p>
|
||||
</Link>
|
||||
{lastDraw && (
|
||||
<p className="text-xs text-muted-foreground">{formatDate(lastDraw.date)}</p>
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
"use client"
|
||||
|
||||
import { Bar, BarChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"
|
||||
import type { FrequencyPoint } from "@/lib/chart-data"
|
||||
|
||||
export function NumberFrequencyChart({ data }: { data: FrequencyPoint[] }) {
|
||||
return (
|
||||
<ResponsiveContainer width="100%" height={220}>
|
||||
<BarChart data={data} margin={{ left: 0, right: 8, top: 8, bottom: 0 }}>
|
||||
<CartesianGrid strokeDasharray="3 3" stroke="var(--border)" vertical={false} />
|
||||
<XAxis dataKey="number" tick={{ fill: "var(--muted-foreground)", fontSize: 11 }} />
|
||||
<YAxis tick={{ fill: "var(--muted-foreground)", fontSize: 11 }} allowDecimals={false} />
|
||||
<Tooltip
|
||||
contentStyle={{
|
||||
background: "var(--panel)",
|
||||
border: "1px solid var(--border)",
|
||||
borderRadius: 6,
|
||||
fontSize: 12,
|
||||
}}
|
||||
cursor={{ fill: "var(--panel-hover)" }}
|
||||
labelFormatter={(v) => `Numéro ${v}`}
|
||||
/>
|
||||
<Bar dataKey="count" name="Apparitions" fill="var(--accent)" radius={[3, 3, 0, 0]} />
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
"use client"
|
||||
|
||||
import { CartesianGrid, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"
|
||||
import type { PerformancePoint } from "@/lib/chart-data"
|
||||
|
||||
export function PerformanceChart({ data }: { data: PerformancePoint[] }) {
|
||||
const chartData = data.map((p) => ({ ...p, pct: Math.round(p.cumulativeWinRate * 100) }))
|
||||
|
||||
return (
|
||||
<ResponsiveContainer width="100%" height={220}>
|
||||
<LineChart data={chartData} margin={{ left: 0, right: 8, top: 8, bottom: 0 }}>
|
||||
<CartesianGrid strokeDasharray="3 3" stroke="var(--border)" vertical={false} />
|
||||
<XAxis dataKey="date" tick={{ fill: "var(--muted-foreground)", fontSize: 11 }} minTickGap={24} />
|
||||
<YAxis
|
||||
domain={[0, 100]}
|
||||
unit="%"
|
||||
tick={{ fill: "var(--muted-foreground)", fontSize: 11 }}
|
||||
/>
|
||||
<Tooltip
|
||||
contentStyle={{
|
||||
background: "var(--panel)",
|
||||
border: "1px solid var(--border)",
|
||||
borderRadius: 6,
|
||||
fontSize: 12,
|
||||
}}
|
||||
formatter={(v) => [`${v}%`, "Taux de réussite cumulé"]}
|
||||
/>
|
||||
<Line type="monotone" dataKey="pct" stroke="var(--accent)" strokeWidth={2} dot={false} />
|
||||
</LineChart>
|
||||
</ResponsiveContainer>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user