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
+63
-72
@@ -1,10 +1,8 @@
|
||||
import { Suspense } from "react"
|
||||
import { Users, Dices, Trophy } from "lucide-react"
|
||||
import { COUNTRIES, countryTheme } from "@/lib/countries"
|
||||
import { getArmyFeed } from "@/lib/lokilab-feed"
|
||||
import { CountrySelector } from "@/components/country-selector"
|
||||
import { LotteryCard } from "@/components/lottery-card"
|
||||
import { ArmyStat } from "@/components/army-stat"
|
||||
import { CountryNav, CountryNavMobile } from "@/components/country-nav"
|
||||
import { LotteryResultsPanel } from "@/components/lottery-results-panel"
|
||||
import { LokiMark } from "@/components/loki-mark"
|
||||
import { Skeleton } from "@/components/ui/skeleton"
|
||||
|
||||
@@ -20,7 +18,7 @@ export default async function Home({
|
||||
|
||||
return (
|
||||
<main className="flex flex-1 flex-col">
|
||||
<BrandBar />
|
||||
<AppHeader />
|
||||
<Suspense fallback={<HomeSkeleton />}>
|
||||
<HomeContent activeCode={activeCode} />
|
||||
</Suspense>
|
||||
@@ -28,15 +26,12 @@ export default async function Home({
|
||||
)
|
||||
}
|
||||
|
||||
function BrandBar() {
|
||||
function AppHeader() {
|
||||
return (
|
||||
<div className="border-b border-border/60 bg-background/95 backdrop-blur">
|
||||
<div className="mx-auto flex max-w-6xl items-center gap-2 px-4 py-3 sm:px-6">
|
||||
<LokiMark className="h-7 w-7 text-accent" />
|
||||
<span className="text-lg font-extrabold 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 className="h-14 border-b border-border/60 bg-card">
|
||||
<div className="mx-auto flex h-full max-w-6xl items-center gap-2 px-4 sm:px-6">
|
||||
<LokiMark className="h-8 w-8 shrink-0 text-accent" />
|
||||
<span className="text-base font-bold tracking-tight">LokiLoto</span>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -48,81 +43,77 @@ async function HomeContent({ activeCode }: { activeCode: string }) {
|
||||
const lotteries = feed.lotteries.filter((l) => l.country === activeCode)
|
||||
const totalWins = lotteries.reduce((sum, l) => sum + l.lifetime.wins, 0)
|
||||
const totalTracked = lotteries.reduce((sum, l) => sum + l.lifetime.picksTracked, 0)
|
||||
const countryMembers = feed.army.byCountry[activeCode] ?? 0
|
||||
|
||||
return (
|
||||
<div style={{ "--accent": theme.accent, "--accent-soft": theme.accentSoft } as React.CSSProperties}>
|
||||
<header className="relative overflow-hidden border-b border-border/60">
|
||||
<div
|
||||
className="absolute inset-0 -z-10"
|
||||
style={{
|
||||
background:
|
||||
"radial-gradient(ellipse 90% 60% at 15% 0%, var(--accent-soft), transparent 70%)",
|
||||
}}
|
||||
/>
|
||||
<div className="mx-auto max-w-6xl px-4 pt-6 pb-5 sm:px-6">
|
||||
<CountrySelector active={activeCode} />
|
||||
<div
|
||||
style={{ "--accent": theme.accent, "--accent-soft": theme.accentSoft } as React.CSSProperties}
|
||||
className="mx-auto w-full max-w-6xl flex-1 px-4 py-4 sm:px-6"
|
||||
>
|
||||
<div className="sm:hidden mb-3">
|
||||
<CountryNavMobile active={activeCode} />
|
||||
</div>
|
||||
|
||||
<div className="mt-4 flex items-center gap-3">
|
||||
<LokiMark className="h-10 w-10 shrink-0 text-accent" />
|
||||
<div>
|
||||
<h2 className="text-xl font-bold tracking-tight">{theme.name}</h2>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Statistiques et pronostics de Loki pour les loteries suivies.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex gap-5">
|
||||
<aside className="hidden w-[200px] shrink-0 sm:block">
|
||||
<CountryNav active={activeCode} />
|
||||
</aside>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 grid grid-cols-1 gap-3 sm:grid-cols-3">
|
||||
<ArmyStat
|
||||
icon={Users}
|
||||
label="Membres dans l'armée"
|
||||
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"
|
||||
<div className="flex h-11 items-center divide-x divide-border rounded-md border border-border/60 bg-panel px-4 text-sm">
|
||||
<Stat value={feed.army.total.toLocaleString("fr-CA")} label="Armée (global)" />
|
||||
<Stat value={countryMembers.toLocaleString("fr-CA")} label={`Membres — ${theme.name}`} />
|
||||
<Stat
|
||||
value={totalTracked > 0 ? `${totalWins} / ${totalTracked}` : "—"}
|
||||
label="Grilles gagnantes"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{lotteries.length > 0 ? (
|
||||
<LotteryResultsPanel lotteries={lotteries} />
|
||||
) : (
|
||||
<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.
|
||||
</div>
|
||||
)}
|
||||
|
||||
<p className="text-[11px] text-muted-foreground">
|
||||
Données fournies par LokiLab. Statistiques descriptives seulement — aucune garantie
|
||||
de gain.
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
<section className="mx-auto w-full max-w-6xl flex-1 px-4 py-6 sm:px-6">
|
||||
{lotteries.length > 0 ? (
|
||||
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{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">
|
||||
Aucune loterie suivie pour {theme.name} pour le moment.
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<footer className="border-t border-border/60 px-4 py-4 text-center text-xs text-muted-foreground sm:px-6">
|
||||
Données fournies par LokiLab. Statistiques descriptives seulement — aucune garantie de
|
||||
gain.
|
||||
</footer>
|
||||
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>
|
||||
)
|
||||
}
|
||||
|
||||
function HomeSkeleton() {
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-6xl px-4 py-8 sm:px-6">
|
||||
<Skeleton className="h-10 w-full" />
|
||||
<Skeleton className="mt-4 h-10 w-64" />
|
||||
<div className="mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{Array.from({ length: 6 }).map((_, i) => (
|
||||
<Skeleton key={i} className="h-48 w-full" />
|
||||
))}
|
||||
<div className="mx-auto w-full max-w-6xl px-4 py-4 sm:px-6">
|
||||
<div className="flex gap-5">
|
||||
<Skeleton className="hidden h-96 w-[200px] shrink-0 sm:block" />
|
||||
<div className="min-w-0 flex-1 space-y-3">
|
||||
<Skeleton className="h-7 w-48" />
|
||||
<Skeleton className="h-11 w-full" />
|
||||
<Skeleton className="h-64 w-full" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user