Files
lokiloto/app/loterie/[id]/page.tsx
T
Nazim KriandClaude Opus 5.5 9996f7b823 Restructure navigation after 1xbet: utility bar, lottery strip, right rail
User feedback: still ugly, the 1xbet navigation was never actually
reproduced. Now follows its structure:
- thin utility bar on top (country picker, Connexion + Inscription)
  above the main bar (logo, nav)
- horizontal icon strip of the country's lotteries under the header,
  with the active one underlined in gold
- compact promo banner instead of a full-height hero, so results stay
  above the fold
- right rail in the bet-slip position: top-5 leaderboard and army stats

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:41:16 -04:00

90 lines
3.8 KiB
TypeScript

import type { Metadata } from "next"
import { notFound } from "next/navigation"
import { getArmyFeed } from "@/lib/lokilab-feed"
import { numberFrequency, performanceOverTime } from "@/lib/chart-data"
import { countryTheme } from "@/lib/countries"
import { AppHeader } from "@/components/app-header"
import { NumberFrequencyChart } from "@/components/number-frequency-chart"
import { PerformanceChart } from "@/components/performance-chart"
import { DrawTimeline } from "@/components/draw-timeline"
import { Badge } from "@/components/ui/badge"
import { Flag } from "@/components/flag"
import { LotteryStrip } from "@/components/lottery-strip"
export const instant = false
export async function generateMetadata({ params }: { params: Promise<{ id: string }> }): Promise<Metadata> {
const { id } = await params
return { title: `${id} — Statistiques LokiLoto` }
}
export default async function LotteryStatsPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params
const feed = await getArmyFeed()
const entry = feed.lotteries.find((l) => l.id === id)
if (!entry) notFound()
const theme = countryTheme(entry.country)
const frequency = numberFrequency(entry)
const performance = performanceOverTime(entry)
return (
<main
className="flex flex-1 flex-col"
style={{ "--accent": theme.accent, "--accent-soft": theme.accentSoft } as React.CSSProperties}
>
<AppHeader />
<LotteryStrip lotteries={feed.lotteries.filter((l) => l.country === entry.country)} activeId={entry.id} />
<div className="mx-auto w-full max-w-4xl flex-1 px-4 py-6 sm:px-6">
<div className="flex flex-wrap items-center gap-2">
<h1 className="text-2xl font-bold tracking-tight">{entry.name}</h1>
<Badge variant="secondary" className="gap-1.5">
<Flag code={theme.code} /> {theme.name}
</Badge>
</div>
<p className="mt-1 text-sm text-muted-foreground">
{entry.lifetime.picksTracked > 0
? `${(entry.lifetime.winRate * 100).toFixed(0)}% de réussite sur ${entry.lifetime.picksTracked} grilles suivies`
: "Pas encore de grilles résolues pour cette loterie."}
</p>
<section className="mt-6 rounded-md border border-border/60 bg-panel p-4">
<h2 className="mb-1 text-sm font-semibold">Fréquence des numéros</h2>
<p className="mb-3 text-xs text-muted-foreground">
Sur les {entry.recentDraws.length} derniers tirages — statistique descriptive seulement.
</p>
{frequency.length > 0 ? (
<NumberFrequencyChart data={frequency} />
) : (
<p className="text-sm text-muted-foreground">Pas encore assez de données.</p>
)}
</section>
<section className="mt-4 rounded-md border border-border/60 bg-panel p-4">
<h2 className="mb-1 text-sm font-semibold">Performance de Loki dans le temps</h2>
<p className="mb-3 text-xs text-muted-foreground">Taux de réussite cumulé, grille après grille.</p>
{performance.length > 1 ? (
<PerformanceChart data={performance} />
) : (
<p className="text-sm text-muted-foreground">Pas encore assez de grilles résolues.</p>
)}
</section>
<section className="mt-4">
<h2 className="mb-2 text-sm font-semibold">Historique des tirages</h2>
{entry.recentDraws.length > 0 ? (
<DrawTimeline entry={entry} />
) : (
<p className="text-sm text-muted-foreground">Aucun tirage disponible.</p>
)}
</section>
<p className="mt-6 text-[11px] text-muted-foreground">
Données fournies par LokiLab. Statistiques descriptives seulement — aucune garantie de
gain.
</p>
</div>
</main>
)
}