Rebuild layout per Codex's design review: sidebar nav, shared results panel

Codex (independent /codex consult) reviewed the prior card-grid layout
and called it an unstructured "starter dashboard" look: too much chrome
before the data, duplicated card containers competing for attention,
community size outweighing actual draw results, and a real bug —
CardHeader's base class is `grid`, so the `flex-row` override on
LotteryCard never applied.

Rebuilds around a shared data panel instead of isolated cards:
- CountryNav: 200px sidebar (desktop) / horizontal scroller (mobile),
  replacing pill-tab filters that read as tags rather than navigation
- LotteryResultsPanel + LotteryRow: one table-like panel with column
  headers (Loterie / Résultat / Choix / Score / Historique), not N
  separate bordered cards — makes draws directly comparable
- LotteryMobileCard: dedicated compact mobile layout, not a shrunk
  desktop row
- NumberSequence: shared ball component used by both layouts
- --success token, independent of --accent: a winning number is always
  green, never the country's accent color (previously a win in France
  would render in France's red, which reads as a loss)
- --primary now stays neutral, decoupled from --accent, so generic
  shadcn control states don't inherit a country's color as if it meant
  something semantically
- New surface/text palette (page/header/panel/divider tiers) replacing
  the flat near-black scale
- Redrawn LokiMark: clearer two-ear fox silhouette, legible at 20-24px

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Nazim Kri
2026-10-29 22:34:16 -04:00
co-authored by Claude Sonnet 5
parent 8621284cab
commit fc69d4a668
11 changed files with 352 additions and 283 deletions
-112
View File
@@ -1,112 +0,0 @@
import { TrendingUp, Trophy, Target } from "lucide-react"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"
import type { LotteryFeedEntry } from "@/lib/lokilab-feed"
function NumberChip({
value,
tone = "default",
}: {
value: number
tone?: "default" | "hit"
}) {
return (
<span
className={
"flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold tabular-nums " +
(tone === "hit"
? "bg-accent text-primary-foreground ring-2 ring-accent/40"
: "bg-muted text-foreground")
}
>
{value}
</span>
)
}
export function LotteryCard({ entry }: { entry: LotteryFeedEntry }) {
const { lifetime, lastDraw } = entry
const resultSet = new Set(lastDraw?.result ?? [])
return (
<Card className="transition-colors hover:ring-accent/30">
<CardHeader className="flex-row items-center justify-between gap-2 border-b border-border/60 pb-3">
<CardTitle className="text-sm font-semibold tracking-tight">
{entry.name}
</CardTitle>
<WinRateBadge winRate={lifetime.winRate} tracked={lifetime.picksTracked} />
</CardHeader>
<CardContent className="space-y-4 pt-3">
{lastDraw ? (
<>
<div>
<p className="mb-1.5 text-[11px] uppercase tracking-wide text-muted-foreground">
Tirage du {formatDate(lastDraw.date)}
</p>
<div className="flex flex-wrap gap-1.5">
{lastDraw.result.map((n, i) => (
<NumberChip key={i} value={n} />
))}
</div>
</div>
{lastDraw.pick ? (
<div className="rounded-lg bg-muted/60 p-3">
<div className="mb-1.5 flex items-center gap-1.5 text-[11px] uppercase tracking-wide text-muted-foreground">
<Target className="h-3 w-3" />
Choix de Loki
</div>
<div className="flex flex-wrap items-center gap-1.5">
{lastDraw.pick.map((n, i) => (
<NumberChip
key={i}
value={n}
tone={resultSet.has(n) ? "hit" : "default"}
/>
))}
<span className="ml-1 text-xs text-muted-foreground">
{lastDraw.matched} correspondance{lastDraw.matched === 1 ? "" : "s"}
</span>
{lastDraw.won && (
<Badge className="ml-auto gap-1 bg-accent text-primary-foreground">
<Trophy className="h-3 w-3" />
Gagnant
</Badge>
)}
</div>
</div>
) : (
<p className="text-xs text-muted-foreground">
Aucun choix de Loki pour ce tirage.
</p>
)}
</>
) : (
<p className="text-xs text-muted-foreground">Aucun tirage disponible.</p>
)}
</CardContent>
</Card>
)
}
function WinRateBadge({ winRate, tracked }: { winRate: number; tracked: number }) {
if (tracked === 0) {
return (
<Badge variant="outline" className="shrink-0 text-muted-foreground">
Nouveau
</Badge>
)
}
return (
<Badge variant="secondary" className="shrink-0 gap-1 tabular-nums">
<TrendingUp className="h-3 w-3" />
{(winRate * 100).toFixed(0)}% sur {tracked}
</Badge>
)
}
function formatDate(iso: string): string {
const d = new Date(iso + "T00:00:00")
return d.toLocaleDateString("fr-CA", { day: "numeric", month: "short", year: "numeric" })
}