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:
co-authored by
Claude Sonnet 5
parent
8621284cab
commit
fc69d4a668
@@ -1,23 +0,0 @@
|
||||
import type { LucideIcon } from "lucide-react"
|
||||
|
||||
export function ArmyStat({
|
||||
icon: Icon,
|
||||
label,
|
||||
value,
|
||||
}: {
|
||||
icon: LucideIcon
|
||||
label: string
|
||||
value: string
|
||||
}) {
|
||||
return (
|
||||
<div className="flex items-center gap-3 rounded-xl border border-border/60 bg-card px-4 py-3">
|
||||
<div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent">
|
||||
<Icon className="h-4.5 w-4.5" />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-lg font-semibold leading-tight tabular-nums">{value}</p>
|
||||
<p className="text-xs text-muted-foreground">{label}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
"use client"
|
||||
|
||||
import Link from "next/link"
|
||||
import { usePathname, useSearchParams } from "next/navigation"
|
||||
import { COUNTRIES } from "@/lib/countries"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
export function CountryNav({ active }: { active: string }) {
|
||||
const pathname = usePathname()
|
||||
const searchParams = useSearchParams()
|
||||
|
||||
function hrefFor(code: string) {
|
||||
const params = new URLSearchParams(searchParams.toString())
|
||||
params.set("country", code)
|
||||
return `${pathname}?${params.toString()}`
|
||||
}
|
||||
|
||||
return (
|
||||
<nav aria-label="Sélection du pays" className="space-y-0.5">
|
||||
{COUNTRIES.map((c) => {
|
||||
const isActive = c.code === active
|
||||
return (
|
||||
<Link
|
||||
key={c.code}
|
||||
href={hrefFor(c.code)}
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
className={cn(
|
||||
"flex items-center gap-2.5 rounded-md border-l-[3px] py-2 pr-3 pl-2.5 text-[13px] font-medium transition-colors",
|
||||
isActive
|
||||
? "border-l-accent bg-panel-hover text-foreground"
|
||||
: "border-l-transparent text-muted-foreground hover:bg-panel-hover/60 hover:text-foreground"
|
||||
)}
|
||||
>
|
||||
<span aria-hidden className="w-5 shrink-0 text-center text-base leading-none">
|
||||
{c.flagEmoji}
|
||||
</span>
|
||||
{c.name}
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
</nav>
|
||||
)
|
||||
}
|
||||
|
||||
export function CountryNavMobile({ active }: { active: string }) {
|
||||
const pathname = usePathname()
|
||||
const searchParams = useSearchParams()
|
||||
|
||||
function hrefFor(code: string) {
|
||||
const params = new URLSearchParams(searchParams.toString())
|
||||
params.set("country", code)
|
||||
return `${pathname}?${params.toString()}`
|
||||
}
|
||||
|
||||
return (
|
||||
<nav
|
||||
aria-label="Sélection du pays"
|
||||
className="flex gap-1.5 overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
||||
>
|
||||
{COUNTRIES.map((c) => {
|
||||
const isActive = c.code === active
|
||||
return (
|
||||
<Link
|
||||
key={c.code}
|
||||
href={hrefFor(c.code)}
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
className={cn(
|
||||
"flex shrink-0 items-center gap-1.5 rounded-full px-3 py-1.5 text-[13px] font-medium",
|
||||
isActive ? "bg-accent-soft text-foreground" : "text-muted-foreground"
|
||||
)}
|
||||
>
|
||||
<span aria-hidden>{c.flagEmoji}</span>
|
||||
{c.name}
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
</nav>
|
||||
)
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
"use client"
|
||||
|
||||
import Link from "next/link"
|
||||
import { usePathname, useSearchParams } from "next/navigation"
|
||||
import { COUNTRIES } from "@/lib/countries"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"
|
||||
|
||||
export function CountrySelector({ active }: { active: string }) {
|
||||
const pathname = usePathname()
|
||||
const searchParams = useSearchParams()
|
||||
|
||||
function hrefFor(code: string) {
|
||||
const params = new URLSearchParams(searchParams.toString())
|
||||
params.set("country", code)
|
||||
return `${pathname}?${params.toString()}`
|
||||
}
|
||||
|
||||
return (
|
||||
<ScrollArea className="w-full">
|
||||
<nav
|
||||
aria-label="Sélection du pays"
|
||||
className="flex items-center gap-1.5 pb-3"
|
||||
>
|
||||
{COUNTRIES.map((c) => {
|
||||
const isActive = c.code === active
|
||||
return (
|
||||
<Link
|
||||
key={c.code}
|
||||
href={hrefFor(c.code)}
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
className={cn(
|
||||
"flex shrink-0 items-center gap-1.5 rounded-full border px-3.5 py-2 text-sm font-medium transition-colors",
|
||||
isActive
|
||||
? "border-accent bg-accent-soft text-foreground"
|
||||
: "border-border text-muted-foreground hover:border-accent/40 hover:text-foreground"
|
||||
)}
|
||||
>
|
||||
<span aria-hidden className="text-base leading-none">
|
||||
{c.flagEmoji}
|
||||
</span>
|
||||
{c.name}
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
</nav>
|
||||
<ScrollBar orientation="horizontal" />
|
||||
</ScrollArea>
|
||||
)
|
||||
}
|
||||
@@ -1,21 +1,18 @@
|
||||
/**
|
||||
* The one shared mascot mark: a geometric fox/trickster silhouette.
|
||||
* Palette-swapped per country via currentColor — never hardcode a fill here.
|
||||
* The one shared mascot mark: a simplified fox head. Two ears, a tapered
|
||||
* muzzle, two eyes — designed to stay legible at 20-24px, not just at hero
|
||||
* size. Palette-swapped per country via currentColor — never hardcode a
|
||||
* fill here.
|
||||
*/
|
||||
export function LokiMark({ className }: { className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
viewBox="0 0 48 48"
|
||||
fill="none"
|
||||
className={className}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<svg viewBox="0 0 48 48" fill="none" className={className} aria-hidden="true">
|
||||
<path
|
||||
d="M24 6 L34 16 L41 11 L38 22 L41 33 L32 29 L24 42 L16 29 L7 33 L10 22 L7 11 L14 16 Z"
|
||||
d="M9 10 L19 19 Q24 16 29 19 L39 10 L36 23 Q38 28 36 33 Q31 41 24 41 Q17 41 12 33 Q10 28 12 23 Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<circle cx="19.5" cy="24" r="2.4" fill="var(--background)" />
|
||||
<circle cx="28.5" cy="24" r="2.4" fill="var(--background)" />
|
||||
<circle cx="19" cy="26" r="2.1" fill="var(--background)" />
|
||||
<circle cx="29" cy="26" r="2.1" fill="var(--background)" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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" })
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import { NumberSequence } from "@/components/number-sequence"
|
||||
import type { LotteryFeedEntry } from "@/lib/lokilab-feed"
|
||||
|
||||
export function LotteryMobileCard({ entry }: { entry: LotteryFeedEntry }) {
|
||||
const { lifetime, lastDraw } = entry
|
||||
const resultSet = new Set(lastDraw?.result ?? [])
|
||||
|
||||
return (
|
||||
<div className="space-y-2.5 border-b border-border/60 p-3 last:border-b-0">
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="font-semibold">{entry.name}</p>
|
||||
{lifetime.picksTracked > 0 ? (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
<span className="font-semibold text-foreground tabular-nums">
|
||||
{(lifetime.winRate * 100).toFixed(0)}%
|
||||
</span>{" "}
|
||||
sur {lifetime.picksTracked}
|
||||
</p>
|
||||
) : (
|
||||
<p className="text-xs text-muted-foreground">Nouveau</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{lastDraw ? (
|
||||
<>
|
||||
<div>
|
||||
<p className="mb-1 text-xs text-muted-foreground">
|
||||
Résultat du {formatDate(lastDraw.date)}
|
||||
</p>
|
||||
<NumberSequence numbers={lastDraw.result} />
|
||||
</div>
|
||||
{lastDraw.pick ? (
|
||||
<div>
|
||||
<p className="mb-1 text-xs text-muted-foreground">
|
||||
Choix pour ce tirage —{" "}
|
||||
<span className={lastDraw.won ? "font-semibold text-success" : ""}>
|
||||
{lastDraw.matched} / {lastDraw.result.length}
|
||||
</span>
|
||||
</p>
|
||||
<NumberSequence numbers={lastDraw.pick} hitSet={resultSet} />
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-xs text-muted-foreground">Aucun choix pour ce tirage.</p>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<p className="text-xs text-muted-foreground">Aucun tirage disponible.</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function formatDate(iso: string): string {
|
||||
const d = new Date(iso + "T00:00:00")
|
||||
return d.toLocaleDateString("fr-CA", { day: "numeric", month: "short" })
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { LotteryRow } from "@/components/lottery-row"
|
||||
import { LotteryMobileCard } from "@/components/lottery-mobile-card"
|
||||
import type { LotteryFeedEntry } from "@/lib/lokilab-feed"
|
||||
|
||||
export function LotteryResultsPanel({ lotteries }: { lotteries: LotteryFeedEntry[] }) {
|
||||
return (
|
||||
<div className="overflow-hidden rounded-md border border-border/60 bg-panel">
|
||||
<div className="hidden sm:grid grid-cols-[160px_1fr_1fr_72px_120px] gap-3 border-b border-border/60 px-3 py-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
||||
<span>Loterie</span>
|
||||
<span>Résultat officiel</span>
|
||||
<span>Choix de Loki</span>
|
||||
<span className="text-right">Score</span>
|
||||
<span className="text-right">Historique</span>
|
||||
</div>
|
||||
|
||||
<div className="hidden sm:block">
|
||||
{lotteries.map((entry) => (
|
||||
<LotteryRow key={entry.id} entry={entry} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="sm:hidden">
|
||||
{lotteries.map((entry) => (
|
||||
<LotteryMobileCard key={entry.id} entry={entry} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { NumberSequence } from "@/components/number-sequence"
|
||||
import type { LotteryFeedEntry } from "@/lib/lokilab-feed"
|
||||
|
||||
export function LotteryRow({ entry }: { entry: LotteryFeedEntry }) {
|
||||
const { lifetime, lastDraw } = entry
|
||||
const resultSet = new Set(lastDraw?.result ?? [])
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-[160px_1fr_1fr_72px_120px] items-center gap-3 border-b border-border/60 px-3 py-3 text-sm last:border-b-0 hover:bg-panel-hover/40">
|
||||
<div className="min-w-0">
|
||||
<p className="truncate font-semibold leading-tight" title={entry.name}>
|
||||
{entry.name}
|
||||
</p>
|
||||
{lastDraw && (
|
||||
<p className="text-xs text-muted-foreground">{formatDate(lastDraw.date)}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>{lastDraw ? <NumberSequence numbers={lastDraw.result} /> : <Dash />}</div>
|
||||
|
||||
<div>
|
||||
{lastDraw?.pick ? (
|
||||
<NumberSequence numbers={lastDraw.pick} hitSet={resultSet} />
|
||||
) : (
|
||||
<span className="text-xs text-muted-foreground">Aucun choix pour ce tirage</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="text-right tabular-nums">
|
||||
{lastDraw?.pick ? (
|
||||
<span className={lastDraw.won ? "font-semibold text-success" : "text-foreground"}>
|
||||
{lastDraw.matched} / {lastDraw.result.length}
|
||||
</span>
|
||||
) : (
|
||||
<Dash />
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="text-right">
|
||||
{lifetime.picksTracked > 0 ? (
|
||||
<>
|
||||
<span className="font-semibold tabular-nums">
|
||||
{(lifetime.winRate * 100).toFixed(0)}%
|
||||
</span>
|
||||
<span className="ml-1 text-xs text-muted-foreground">
|
||||
sur {lifetime.picksTracked} grilles
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
<span className="text-xs text-muted-foreground">Nouveau</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function Dash() {
|
||||
return <span className="text-muted-foreground">—</span>
|
||||
}
|
||||
|
||||
function formatDate(iso: string): string {
|
||||
const d = new Date(iso + "T00:00:00")
|
||||
return d.toLocaleDateString("fr-CA", { day: "numeric", month: "short" })
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
export function NumberSequence({
|
||||
numbers,
|
||||
hitSet,
|
||||
}: {
|
||||
numbers: number[]
|
||||
hitSet?: Set<number>
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-1">
|
||||
{numbers.map((n, i) => (
|
||||
<span
|
||||
key={i}
|
||||
className={
|
||||
"flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-[13px] font-semibold tabular-nums " +
|
||||
(hitSet?.has(n)
|
||||
? "bg-success text-success-foreground"
|
||||
: "bg-muted text-foreground")
|
||||
}
|
||||
>
|
||||
{n}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user