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
+28
-15
@@ -30,6 +30,10 @@
|
|||||||
--color-accent-foreground: var(--accent-foreground);
|
--color-accent-foreground: var(--accent-foreground);
|
||||||
--color-accent: var(--accent);
|
--color-accent: var(--accent);
|
||||||
--color-accent-soft: var(--accent-soft);
|
--color-accent-soft: var(--accent-soft);
|
||||||
|
--color-success: var(--success);
|
||||||
|
--color-success-foreground: var(--success-foreground);
|
||||||
|
--color-panel: var(--panel);
|
||||||
|
--color-panel-hover: var(--panel-hover);
|
||||||
--color-muted-foreground: var(--muted-foreground);
|
--color-muted-foreground: var(--muted-foreground);
|
||||||
--color-muted: var(--muted);
|
--color-muted: var(--muted);
|
||||||
--color-secondary-foreground: var(--secondary-foreground);
|
--color-secondary-foreground: var(--secondary-foreground);
|
||||||
@@ -86,22 +90,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
--background: oklch(0.145 0.002 264);
|
--background: oklch(0.183 0.031 263.4);
|
||||||
--foreground: oklch(0.96 0 0);
|
--foreground: oklch(0.969 0.007 260.7);
|
||||||
--card: oklch(0.195 0.004 264);
|
--card: oklch(0.229 0.037 257.2);
|
||||||
--card-foreground: oklch(0.96 0 0);
|
--card-foreground: oklch(0.969 0.007 260.7);
|
||||||
--popover: oklch(0.195 0.004 264);
|
--popover: oklch(0.266 0.043 255.9);
|
||||||
--popover-foreground: oklch(0.96 0 0);
|
--popover-foreground: oklch(0.969 0.007 260.7);
|
||||||
--primary: var(--accent);
|
/* --primary stays neutral — never tied to the country accent, so generic
|
||||||
--primary-foreground: oklch(0.145 0 0);
|
shadcn controls (menu hover, focus states) don't inherit a country's
|
||||||
--secondary: oklch(0.255 0.004 264);
|
color as if it meant something semantically. */
|
||||||
--secondary-foreground: oklch(0.96 0 0);
|
--primary: oklch(0.969 0.007 260.7);
|
||||||
--muted: oklch(0.225 0.004 264);
|
--primary-foreground: oklch(0.183 0.031 263.4);
|
||||||
--muted-foreground: oklch(0.63 0.01 264);
|
--secondary: oklch(0.317 0.050 254.8);
|
||||||
--accent-foreground: oklch(0.96 0 0);
|
--secondary-foreground: oklch(0.969 0.007 260.7);
|
||||||
|
--muted: oklch(0.266 0.043 255.9);
|
||||||
|
--muted-foreground: oklch(0.774 0.033 255.6);
|
||||||
|
--accent-foreground: oklch(0.969 0.007 260.7);
|
||||||
|
/* --success is the one stable "won/matched" color across every country —
|
||||||
|
never derived from --accent, so a win doesn't change color by country. */
|
||||||
|
--success: oklch(0.723 0.192 149.6);
|
||||||
|
--success-foreground: oklch(0.1 0.02 149.6);
|
||||||
|
--panel: oklch(0.229 0.037 257.2);
|
||||||
|
--panel-hover: oklch(0.317 0.050 254.8);
|
||||||
--destructive: oklch(0.704 0.191 22.216);
|
--destructive: oklch(0.704 0.191 22.216);
|
||||||
--border: oklch(1 0 0 / 8%);
|
--border: oklch(0.366 0.051 253.4 / 50%);
|
||||||
--input: oklch(1 0 0 / 12%);
|
--input: oklch(0.366 0.051 253.4 / 60%);
|
||||||
--ring: var(--accent);
|
--ring: var(--accent);
|
||||||
--chart-1: oklch(0.87 0 0);
|
--chart-1: oklch(0.87 0 0);
|
||||||
--chart-2: oklch(0.556 0 0);
|
--chart-2: oklch(0.556 0 0);
|
||||||
|
|||||||
+56
-65
@@ -1,10 +1,8 @@
|
|||||||
import { Suspense } from "react"
|
import { Suspense } from "react"
|
||||||
import { Users, Dices, Trophy } from "lucide-react"
|
|
||||||
import { COUNTRIES, countryTheme } from "@/lib/countries"
|
import { COUNTRIES, countryTheme } from "@/lib/countries"
|
||||||
import { getArmyFeed } from "@/lib/lokilab-feed"
|
import { getArmyFeed } from "@/lib/lokilab-feed"
|
||||||
import { CountrySelector } from "@/components/country-selector"
|
import { CountryNav, CountryNavMobile } from "@/components/country-nav"
|
||||||
import { LotteryCard } from "@/components/lottery-card"
|
import { LotteryResultsPanel } from "@/components/lottery-results-panel"
|
||||||
import { ArmyStat } from "@/components/army-stat"
|
|
||||||
import { LokiMark } from "@/components/loki-mark"
|
import { LokiMark } from "@/components/loki-mark"
|
||||||
import { Skeleton } from "@/components/ui/skeleton"
|
import { Skeleton } from "@/components/ui/skeleton"
|
||||||
|
|
||||||
@@ -20,7 +18,7 @@ export default async function Home({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="flex flex-1 flex-col">
|
<main className="flex flex-1 flex-col">
|
||||||
<BrandBar />
|
<AppHeader />
|
||||||
<Suspense fallback={<HomeSkeleton />}>
|
<Suspense fallback={<HomeSkeleton />}>
|
||||||
<HomeContent activeCode={activeCode} />
|
<HomeContent activeCode={activeCode} />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
@@ -28,15 +26,12 @@ export default async function Home({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function BrandBar() {
|
function AppHeader() {
|
||||||
return (
|
return (
|
||||||
<div className="border-b border-border/60 bg-background/95 backdrop-blur">
|
<div className="h-14 border-b border-border/60 bg-card">
|
||||||
<div className="mx-auto flex max-w-6xl items-center gap-2 px-4 py-3 sm:px-6">
|
<div className="mx-auto flex h-full max-w-6xl items-center gap-2 px-4 sm:px-6">
|
||||||
<LokiMark className="h-7 w-7 text-accent" />
|
<LokiMark className="h-8 w-8 shrink-0 text-accent" />
|
||||||
<span className="text-lg font-extrabold tracking-tight">LokiLoto</span>
|
<span className="text-base font-bold tracking-tight">LokiLoto</span>
|
||||||
<span className="ml-1 hidden text-sm text-muted-foreground sm:inline">
|
|
||||||
pronostics et statistiques de loterie, pays par pays
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -48,81 +43,77 @@ async function HomeContent({ activeCode }: { activeCode: string }) {
|
|||||||
const lotteries = feed.lotteries.filter((l) => l.country === activeCode)
|
const lotteries = feed.lotteries.filter((l) => l.country === activeCode)
|
||||||
const totalWins = lotteries.reduce((sum, l) => sum + l.lifetime.wins, 0)
|
const totalWins = lotteries.reduce((sum, l) => sum + l.lifetime.wins, 0)
|
||||||
const totalTracked = lotteries.reduce((sum, l) => sum + l.lifetime.picksTracked, 0)
|
const totalTracked = lotteries.reduce((sum, l) => sum + l.lifetime.picksTracked, 0)
|
||||||
|
const countryMembers = feed.army.byCountry[activeCode] ?? 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ "--accent": theme.accent, "--accent-soft": theme.accentSoft } as React.CSSProperties}>
|
|
||||||
<header className="relative overflow-hidden border-b border-border/60">
|
|
||||||
<div
|
<div
|
||||||
className="absolute inset-0 -z-10"
|
style={{ "--accent": theme.accent, "--accent-soft": theme.accentSoft } as React.CSSProperties}
|
||||||
style={{
|
className="mx-auto w-full max-w-6xl flex-1 px-4 py-4 sm:px-6"
|
||||||
background:
|
>
|
||||||
"radial-gradient(ellipse 90% 60% at 15% 0%, var(--accent-soft), transparent 70%)",
|
<div className="sm:hidden mb-3">
|
||||||
}}
|
<CountryNavMobile active={activeCode} />
|
||||||
/>
|
</div>
|
||||||
<div className="mx-auto max-w-6xl px-4 pt-6 pb-5 sm:px-6">
|
|
||||||
<CountrySelector active={activeCode} />
|
|
||||||
|
|
||||||
<div className="mt-4 flex items-center gap-3">
|
<div className="flex gap-5">
|
||||||
<LokiMark className="h-10 w-10 shrink-0 text-accent" />
|
<aside className="hidden w-[200px] shrink-0 sm:block">
|
||||||
<div>
|
<CountryNav active={activeCode} />
|
||||||
<h2 className="text-xl font-bold tracking-tight">{theme.name}</h2>
|
</aside>
|
||||||
<p className="text-sm text-muted-foreground">
|
|
||||||
Statistiques et pronostics de Loki pour les loteries suivies.
|
<div className="min-w-0 flex-1 space-y-3">
|
||||||
|
<div className="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1">
|
||||||
|
<h1 className="text-[22px] font-bold tracking-tight">{theme.name}</h1>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
{lotteries.length} loterie{lotteries.length === 1 ? "" : "s"} suivie
|
||||||
|
{lotteries.length === 1 ? "" : "s"}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="mt-4 grid grid-cols-1 gap-3 sm:grid-cols-3">
|
<div className="flex h-11 items-center divide-x divide-border rounded-md border border-border/60 bg-panel px-4 text-sm">
|
||||||
<ArmyStat
|
<Stat value={feed.army.total.toLocaleString("fr-CA")} label="Armée (global)" />
|
||||||
icon={Users}
|
<Stat value={countryMembers.toLocaleString("fr-CA")} label={`Membres — ${theme.name}`} />
|
||||||
label="Membres dans l'armée"
|
<Stat
|
||||||
value={feed.army.total.toLocaleString("fr-CA")}
|
|
||||||
/>
|
|
||||||
<ArmyStat
|
|
||||||
icon={Dices}
|
|
||||||
label={`Loteries suivies — ${theme.name}`}
|
|
||||||
value={lotteries.length.toString()}
|
|
||||||
/>
|
|
||||||
<ArmyStat
|
|
||||||
icon={Trophy}
|
|
||||||
label="Gains de Loki"
|
|
||||||
value={totalTracked > 0 ? `${totalWins} / ${totalTracked}` : "—"}
|
value={totalTracked > 0 ? `${totalWins} / ${totalTracked}` : "—"}
|
||||||
|
label="Grilles gagnantes"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<section className="mx-auto w-full max-w-6xl flex-1 px-4 py-6 sm:px-6">
|
|
||||||
{lotteries.length > 0 ? (
|
{lotteries.length > 0 ? (
|
||||||
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
<LotteryResultsPanel lotteries={lotteries} />
|
||||||
{lotteries.map((entry) => (
|
|
||||||
<LotteryCard key={entry.id} entry={entry} />
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<div className="rounded-xl border border-dashed border-border py-16 text-center text-sm text-muted-foreground">
|
<div className="rounded-md border border-dashed border-border py-16 text-center text-sm text-muted-foreground">
|
||||||
Aucune loterie suivie pour {theme.name} pour le moment.
|
Aucune loterie suivie pour {theme.name} pour le moment.
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</section>
|
|
||||||
|
|
||||||
<footer className="border-t border-border/60 px-4 py-4 text-center text-xs text-muted-foreground sm:px-6">
|
<p className="text-[11px] text-muted-foreground">
|
||||||
Données fournies par LokiLab. Statistiques descriptives seulement — aucune garantie de
|
Données fournies par LokiLab. Statistiques descriptives seulement — aucune garantie
|
||||||
gain.
|
de gain.
|
||||||
</footer>
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Stat({ value, label }: { value: string; label: string }) {
|
||||||
|
return (
|
||||||
|
<div className="flex items-baseline gap-1.5 whitespace-nowrap px-4 first:pl-0">
|
||||||
|
<span className="font-semibold tabular-nums">{value}</span>
|
||||||
|
<span className="text-xs text-muted-foreground">{label}</span>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function HomeSkeleton() {
|
function HomeSkeleton() {
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto w-full max-w-6xl px-4 py-8 sm:px-6">
|
<div className="mx-auto w-full max-w-6xl px-4 py-4 sm:px-6">
|
||||||
<Skeleton className="h-10 w-full" />
|
<div className="flex gap-5">
|
||||||
<Skeleton className="mt-4 h-10 w-64" />
|
<Skeleton className="hidden h-96 w-[200px] shrink-0 sm:block" />
|
||||||
<div className="mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
<div className="min-w-0 flex-1 space-y-3">
|
||||||
{Array.from({ length: 6 }).map((_, i) => (
|
<Skeleton className="h-7 w-48" />
|
||||||
<Skeleton key={i} className="h-48 w-full" />
|
<Skeleton className="h-11 w-full" />
|
||||||
))}
|
<Skeleton className="h-64 w-full" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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.
|
* The one shared mascot mark: a simplified fox head. Two ears, a tapered
|
||||||
* Palette-swapped per country via currentColor — never hardcode a fill here.
|
* 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 }) {
|
export function LokiMark({ className }: { className?: string }) {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg viewBox="0 0 48 48" fill="none" className={className} aria-hidden="true">
|
||||||
viewBox="0 0 48 48"
|
|
||||||
fill="none"
|
|
||||||
className={className}
|
|
||||||
aria-hidden="true"
|
|
||||||
>
|
|
||||||
<path
|
<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"
|
fill="currentColor"
|
||||||
/>
|
/>
|
||||||
<circle cx="19.5" cy="24" r="2.4" fill="var(--background)" />
|
<circle cx="19" cy="26" r="2.1" fill="var(--background)" />
|
||||||
<circle cx="28.5" cy="24" r="2.4" fill="var(--background)" />
|
<circle cx="29" cy="26" r="2.1" fill="var(--background)" />
|
||||||
</svg>
|
</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