Real design pass: shadcn/ui, dark sportsbook-style UI, per-country accent
Replaces the plain proof-of-concept page with a proper design: shadcn/ui component foundation, dark theme by default, a brand bar + country selector pill nav, lottery cards with real number chips and win-state highlighting, and a shared Loki mark reskinned per country via a single --accent CSS variable (set from lib/countries.ts's flag-derived OKLCH palette) — one mascot, one layout, color is the only thing that changes per country, as specified. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
3017d612e3
commit
8621284cab
+121
-61
@@ -1,69 +1,129 @@
|
||||
import { countryTheme } from '@/lib/countries'
|
||||
import { getArmyFeed } from '@/lib/lokilab-feed'
|
||||
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 { LokiMark } from "@/components/loki-mark"
|
||||
import { Skeleton } from "@/components/ui/skeleton"
|
||||
|
||||
export const instant = false
|
||||
|
||||
export default async function Home() {
|
||||
const feed = await getArmyFeed()
|
||||
const theme = countryTheme('CA-QC')
|
||||
export default async function Home({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ country?: string }>
|
||||
}) {
|
||||
const sp = await searchParams
|
||||
const activeCode = sp.country && COUNTRIES.some((c) => c.code === sp.country) ? sp.country : "CA-QC"
|
||||
|
||||
return (
|
||||
<main className="flex flex-1 flex-col items-center px-6 py-16">
|
||||
<div className="w-full max-w-3xl space-y-8">
|
||||
<header className="text-center">
|
||||
<h1 className="text-4xl font-bold tracking-tight" style={{ color: theme.primary }}>
|
||||
LokiLoto
|
||||
</h1>
|
||||
<p className="mt-2 text-zinc-600">
|
||||
{feed.army.total.toLocaleString('fr-CA')} membres dans l'armée · stats et pronostics de Loki, pays par pays
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<section
|
||||
className="rounded-2xl border p-6"
|
||||
style={{ borderColor: theme.secondary + '30', background: theme.primary + '08' }}
|
||||
>
|
||||
<div className="mb-4 flex items-center gap-2">
|
||||
<span className="text-2xl">{theme.flagEmoji}</span>
|
||||
<h2 className="text-xl font-semibold" style={{ color: theme.secondary }}>
|
||||
{theme.name}
|
||||
</h2>
|
||||
<span className="ml-auto text-sm text-zinc-500">
|
||||
{(feed.army.byCountry[theme.code] ?? 0).toLocaleString('fr-CA')} membres
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-3 sm:grid-cols-2">
|
||||
{feed.lotteries
|
||||
.filter((l) => l.country === theme.code)
|
||||
.map((l) => (
|
||||
<div key={l.id} className="rounded-xl border border-zinc-200 bg-white p-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="font-medium">{l.name}</span>
|
||||
<span className="text-xs text-zinc-500">
|
||||
{l.lifetime.wins}/{l.lifetime.picksTracked} gains
|
||||
</span>
|
||||
</div>
|
||||
{l.lastDraw && (
|
||||
<div className="mt-2 text-sm text-zinc-600">
|
||||
<div>Dernier tirage {l.lastDraw.date} : {l.lastDraw.result.join(' - ')}</div>
|
||||
{l.lastDraw.pick && (
|
||||
<div style={{ color: l.lastDraw.won ? '#188653' : theme.secondary }}>
|
||||
Choix de Loki : {l.lastDraw.pick.join(' - ')}
|
||||
{l.lastDraw.won ? ' — gagnant' : ` — ${l.lastDraw.matched} correspondance(s)`}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<p className="text-center text-xs text-zinc-400">
|
||||
Données fournies par LokiLab. Statistiques descriptives seulement — aucune garantie de gain.
|
||||
</p>
|
||||
</div>
|
||||
<main className="flex flex-1 flex-col">
|
||||
<BrandBar />
|
||||
<Suspense fallback={<HomeSkeleton />}>
|
||||
<HomeContent activeCode={activeCode} />
|
||||
</Suspense>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
function BrandBar() {
|
||||
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>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
async function HomeContent({ activeCode }: { activeCode: string }) {
|
||||
const feed = await getArmyFeed()
|
||||
const theme = countryTheme(activeCode)
|
||||
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)
|
||||
|
||||
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 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>
|
||||
|
||||
<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"
|
||||
value={totalTracked > 0 ? `${totalWins} / ${totalTracked}` : "—"}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<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>
|
||||
</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>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user