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
-16
@@ -1,26 +1,131 @@
|
|||||||
@import "tailwindcss";
|
@import "tailwindcss";
|
||||||
|
@import "tw-animate-css";
|
||||||
|
@import "shadcn/tailwind.css";
|
||||||
|
|
||||||
:root {
|
@custom-variant dark (&:is(.dark *));
|
||||||
--background: #ffffff;
|
|
||||||
--foreground: #171717;
|
|
||||||
}
|
|
||||||
|
|
||||||
@theme inline {
|
@theme inline {
|
||||||
--color-background: var(--background);
|
--color-background: var(--background);
|
||||||
--color-foreground: var(--foreground);
|
--color-foreground: var(--foreground);
|
||||||
--font-sans: var(--font-geist-sans);
|
--font-sans: var(--font-sans);
|
||||||
--font-mono: var(--font-geist-mono);
|
--font-mono: var(--font-geist-mono);
|
||||||
|
--font-heading: var(--font-sans);
|
||||||
|
--color-sidebar-ring: var(--sidebar-ring);
|
||||||
|
--color-sidebar-border: var(--sidebar-border);
|
||||||
|
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||||
|
--color-sidebar-accent: var(--sidebar-accent);
|
||||||
|
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||||
|
--color-sidebar-primary: var(--sidebar-primary);
|
||||||
|
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||||
|
--color-sidebar: var(--sidebar);
|
||||||
|
--color-chart-5: var(--chart-5);
|
||||||
|
--color-chart-4: var(--chart-4);
|
||||||
|
--color-chart-3: var(--chart-3);
|
||||||
|
--color-chart-2: var(--chart-2);
|
||||||
|
--color-chart-1: var(--chart-1);
|
||||||
|
--color-ring: var(--ring);
|
||||||
|
--color-input: var(--input);
|
||||||
|
--color-border: var(--border);
|
||||||
|
--color-destructive: var(--destructive);
|
||||||
|
--color-accent-foreground: var(--accent-foreground);
|
||||||
|
--color-accent: var(--accent);
|
||||||
|
--color-accent-soft: var(--accent-soft);
|
||||||
|
--color-muted-foreground: var(--muted-foreground);
|
||||||
|
--color-muted: var(--muted);
|
||||||
|
--color-secondary-foreground: var(--secondary-foreground);
|
||||||
|
--color-secondary: var(--secondary);
|
||||||
|
--color-primary-foreground: var(--primary-foreground);
|
||||||
|
--color-primary: var(--primary);
|
||||||
|
--color-popover-foreground: var(--popover-foreground);
|
||||||
|
--color-popover: var(--popover);
|
||||||
|
--color-card-foreground: var(--card-foreground);
|
||||||
|
--color-card: var(--card);
|
||||||
|
--radius-sm: calc(var(--radius) * 0.6);
|
||||||
|
--radius-md: calc(var(--radius) * 0.8);
|
||||||
|
--radius-lg: var(--radius);
|
||||||
|
--radius-xl: calc(var(--radius) * 1.4);
|
||||||
|
--radius-2xl: calc(var(--radius) * 1.8);
|
||||||
|
--radius-3xl: calc(var(--radius) * 2.2);
|
||||||
|
--radius-4xl: calc(var(--radius) * 2.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
:root {
|
||||||
:root {
|
--background: oklch(1 0 0);
|
||||||
--background: #0a0a0a;
|
--foreground: oklch(0.145 0 0);
|
||||||
--foreground: #ededed;
|
--card: oklch(1 0 0);
|
||||||
|
--card-foreground: oklch(0.145 0 0);
|
||||||
|
--popover: oklch(1 0 0);
|
||||||
|
--popover-foreground: oklch(0.145 0 0);
|
||||||
|
--primary: oklch(0.205 0 0);
|
||||||
|
--primary-foreground: oklch(0.985 0 0);
|
||||||
|
--secondary: oklch(0.97 0 0);
|
||||||
|
--secondary-foreground: oklch(0.205 0 0);
|
||||||
|
--muted: oklch(0.97 0 0);
|
||||||
|
--muted-foreground: oklch(0.556 0 0);
|
||||||
|
--accent: oklch(0.75 0.15 85);
|
||||||
|
--accent-soft: oklch(0.75 0.15 85 / 12%);
|
||||||
|
--accent-foreground: oklch(0.205 0 0);
|
||||||
|
--destructive: oklch(0.577 0.245 27.325);
|
||||||
|
--border: oklch(0.922 0 0);
|
||||||
|
--input: oklch(0.922 0 0);
|
||||||
|
--ring: oklch(0.708 0 0);
|
||||||
|
--chart-1: oklch(0.87 0 0);
|
||||||
|
--chart-2: oklch(0.556 0 0);
|
||||||
|
--chart-3: oklch(0.439 0 0);
|
||||||
|
--chart-4: oklch(0.371 0 0);
|
||||||
|
--chart-5: oklch(0.269 0 0);
|
||||||
|
--radius: 0.625rem;
|
||||||
|
--sidebar: oklch(0.985 0 0);
|
||||||
|
--sidebar-foreground: oklch(0.145 0 0);
|
||||||
|
--sidebar-primary: oklch(0.205 0 0);
|
||||||
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-accent: oklch(0.97 0 0);
|
||||||
|
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||||
|
--sidebar-border: oklch(0.922 0 0);
|
||||||
|
--sidebar-ring: oklch(0.708 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
--background: oklch(0.145 0.002 264);
|
||||||
|
--foreground: oklch(0.96 0 0);
|
||||||
|
--card: oklch(0.195 0.004 264);
|
||||||
|
--card-foreground: oklch(0.96 0 0);
|
||||||
|
--popover: oklch(0.195 0.004 264);
|
||||||
|
--popover-foreground: oklch(0.96 0 0);
|
||||||
|
--primary: var(--accent);
|
||||||
|
--primary-foreground: oklch(0.145 0 0);
|
||||||
|
--secondary: oklch(0.255 0.004 264);
|
||||||
|
--secondary-foreground: oklch(0.96 0 0);
|
||||||
|
--muted: oklch(0.225 0.004 264);
|
||||||
|
--muted-foreground: oklch(0.63 0.01 264);
|
||||||
|
--accent-foreground: oklch(0.96 0 0);
|
||||||
|
--destructive: oklch(0.704 0.191 22.216);
|
||||||
|
--border: oklch(1 0 0 / 8%);
|
||||||
|
--input: oklch(1 0 0 / 12%);
|
||||||
|
--ring: var(--accent);
|
||||||
|
--chart-1: oklch(0.87 0 0);
|
||||||
|
--chart-2: oklch(0.556 0 0);
|
||||||
|
--chart-3: oklch(0.439 0 0);
|
||||||
|
--chart-4: oklch(0.371 0 0);
|
||||||
|
--chart-5: oklch(0.269 0 0);
|
||||||
|
--sidebar: oklch(0.205 0 0);
|
||||||
|
--sidebar-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||||
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-accent: oklch(0.269 0 0);
|
||||||
|
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-border: oklch(1 0 0 / 10%);
|
||||||
|
--sidebar-ring: oklch(0.556 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
* {
|
||||||
|
@apply border-border outline-ring/50;
|
||||||
}
|
}
|
||||||
}
|
body {
|
||||||
|
@apply bg-background text-foreground;
|
||||||
body {
|
}
|
||||||
background: var(--background);
|
html {
|
||||||
color: var(--foreground);
|
@apply font-sans;
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -3,7 +3,7 @@ import { Geist, Geist_Mono } from "next/font/google";
|
|||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
|
|
||||||
const geistSans = Geist({
|
const geistSans = Geist({
|
||||||
variable: "--font-geist-sans",
|
variable: "--font-sans",
|
||||||
subsets: ["latin"],
|
subsets: ["latin"],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -21,9 +21,9 @@ export default function RootLayout({ children }: LayoutProps<"/">) {
|
|||||||
return (
|
return (
|
||||||
<html
|
<html
|
||||||
lang="fr"
|
lang="fr"
|
||||||
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
className={`dark ${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
||||||
>
|
>
|
||||||
<body className="min-h-full flex flex-col bg-zinc-50 text-zinc-900">{children}</body>
|
<body className="min-h-full flex flex-col">{children}</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+121
-61
@@ -1,69 +1,129 @@
|
|||||||
import { countryTheme } from '@/lib/countries'
|
import { Suspense } from "react"
|
||||||
import { getArmyFeed } from '@/lib/lokilab-feed'
|
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 const instant = false
|
||||||
|
|
||||||
export default async function Home() {
|
export default async function Home({
|
||||||
const feed = await getArmyFeed()
|
searchParams,
|
||||||
const theme = countryTheme('CA-QC')
|
}: {
|
||||||
|
searchParams: Promise<{ country?: string }>
|
||||||
|
}) {
|
||||||
|
const sp = await searchParams
|
||||||
|
const activeCode = sp.country && COUNTRIES.some((c) => c.code === sp.country) ? sp.country : "CA-QC"
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="flex flex-1 flex-col items-center px-6 py-16">
|
<main className="flex flex-1 flex-col">
|
||||||
<div className="w-full max-w-3xl space-y-8">
|
<BrandBar />
|
||||||
<header className="text-center">
|
<Suspense fallback={<HomeSkeleton />}>
|
||||||
<h1 className="text-4xl font-bold tracking-tight" style={{ color: theme.primary }}>
|
<HomeContent activeCode={activeCode} />
|
||||||
LokiLoto
|
</Suspense>
|
||||||
</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>
|
</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>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://ui.shadcn.com/schema.json",
|
||||||
|
"style": "radix-nova",
|
||||||
|
"rsc": true,
|
||||||
|
"tsx": true,
|
||||||
|
"tailwind": {
|
||||||
|
"config": "",
|
||||||
|
"css": "app/globals.css",
|
||||||
|
"baseColor": "neutral",
|
||||||
|
"cssVariables": true,
|
||||||
|
"prefix": ""
|
||||||
|
},
|
||||||
|
"iconLibrary": "lucide",
|
||||||
|
"rtl": false,
|
||||||
|
"aliases": {
|
||||||
|
"components": "@/components",
|
||||||
|
"utils": "@/lib/utils",
|
||||||
|
"ui": "@/components/ui",
|
||||||
|
"lib": "@/lib",
|
||||||
|
"hooks": "@/hooks"
|
||||||
|
},
|
||||||
|
"menuColor": "default",
|
||||||
|
"menuAccent": "subtle",
|
||||||
|
"registries": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
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,50 @@
|
|||||||
|
"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>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* The one shared mascot mark: a geometric fox/trickster silhouette.
|
||||||
|
* 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"
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
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)" />
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
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,48 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
import { cn } from "cn"
|
||||||
|
import { Slot } from "radix-ui"
|
||||||
|
|
||||||
|
const badgeVariants = cva(
|
||||||
|
"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
||||||
|
secondary:
|
||||||
|
"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
||||||
|
destructive:
|
||||||
|
"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
||||||
|
outline:
|
||||||
|
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
||||||
|
ghost:
|
||||||
|
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
||||||
|
link: "text-primary underline-offset-4 hover:underline",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function Badge({
|
||||||
|
className,
|
||||||
|
variant = "default",
|
||||||
|
asChild = false,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"span"> &
|
||||||
|
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
||||||
|
const Comp = asChild ? Slot.Root : "span"
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Comp
|
||||||
|
data-slot="badge"
|
||||||
|
data-variant={variant}
|
||||||
|
className={cn(badgeVariants({ variant }), className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Badge, badgeVariants }
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
import { cn } from "cn"
|
||||||
|
import { Slot } from "radix-ui"
|
||||||
|
|
||||||
|
const buttonVariants = cva(
|
||||||
|
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
||||||
|
outline:
|
||||||
|
"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
||||||
|
secondary:
|
||||||
|
"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
||||||
|
ghost:
|
||||||
|
"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
||||||
|
destructive:
|
||||||
|
"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
||||||
|
link: "text-primary underline-offset-4 hover:underline",
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
default:
|
||||||
|
"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
||||||
|
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
||||||
|
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
||||||
|
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
||||||
|
icon: "size-8",
|
||||||
|
"icon-xs":
|
||||||
|
"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
||||||
|
"icon-sm":
|
||||||
|
"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
||||||
|
"icon-lg": "size-9",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
size: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function Button({
|
||||||
|
className,
|
||||||
|
variant = "default",
|
||||||
|
size = "default",
|
||||||
|
asChild = false,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"button"> &
|
||||||
|
VariantProps<typeof buttonVariants> & {
|
||||||
|
asChild?: boolean
|
||||||
|
}) {
|
||||||
|
const Comp = asChild ? Slot.Root : "button"
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Comp
|
||||||
|
data-slot="button"
|
||||||
|
data-variant={variant}
|
||||||
|
data-size={size}
|
||||||
|
className={cn(buttonVariants({ variant, size, className }))}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Button, buttonVariants }
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { cn } from "cn"
|
||||||
|
|
||||||
|
function Card({
|
||||||
|
className,
|
||||||
|
size = "default",
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="card"
|
||||||
|
data-size={size}
|
||||||
|
className={cn(
|
||||||
|
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="card-header"
|
||||||
|
className={cn(
|
||||||
|
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="card-title"
|
||||||
|
className={cn(
|
||||||
|
"font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="card-description"
|
||||||
|
className={cn("text-sm text-muted-foreground", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="card-action"
|
||||||
|
className={cn(
|
||||||
|
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="card-content"
|
||||||
|
className={cn("px-(--card-spacing)", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="card-footer"
|
||||||
|
className={cn(
|
||||||
|
"flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
Card,
|
||||||
|
CardHeader,
|
||||||
|
CardFooter,
|
||||||
|
CardTitle,
|
||||||
|
CardAction,
|
||||||
|
CardDescription,
|
||||||
|
CardContent,
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import * as React from "react"
|
||||||
|
import { cn } from "cn"
|
||||||
|
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
|
||||||
|
|
||||||
|
function ScrollArea({
|
||||||
|
className,
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
||||||
|
return (
|
||||||
|
<ScrollAreaPrimitive.Root
|
||||||
|
data-slot="scroll-area"
|
||||||
|
className={cn("relative", className)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<ScrollAreaPrimitive.Viewport
|
||||||
|
data-slot="scroll-area-viewport"
|
||||||
|
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</ScrollAreaPrimitive.Viewport>
|
||||||
|
<ScrollBar />
|
||||||
|
<ScrollAreaPrimitive.Corner />
|
||||||
|
</ScrollAreaPrimitive.Root>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ScrollBar({
|
||||||
|
className,
|
||||||
|
orientation = "vertical",
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
|
||||||
|
return (
|
||||||
|
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
||||||
|
data-slot="scroll-area-scrollbar"
|
||||||
|
data-orientation={orientation}
|
||||||
|
orientation={orientation}
|
||||||
|
className={cn(
|
||||||
|
"flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<ScrollAreaPrimitive.ScrollAreaThumb
|
||||||
|
data-slot="scroll-area-thumb"
|
||||||
|
className="relative flex-1 rounded-full bg-border"
|
||||||
|
/>
|
||||||
|
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { ScrollArea, ScrollBar }
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import * as React from "react"
|
||||||
|
import { cn } from "cn"
|
||||||
|
import { Select as SelectPrimitive } from "radix-ui"
|
||||||
|
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react"
|
||||||
|
|
||||||
|
function Select({
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
||||||
|
return <SelectPrimitive.Root data-slot="select" {...props} />
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectGroup({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
||||||
|
return (
|
||||||
|
<SelectPrimitive.Group
|
||||||
|
data-slot="select-group"
|
||||||
|
className={cn("scroll-my-1 p-1", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectValue({
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
||||||
|
return <SelectPrimitive.Value data-slot="select-value" {...props} />
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectTrigger({
|
||||||
|
className,
|
||||||
|
size = "default",
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
||||||
|
size?: "sm" | "default"
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<SelectPrimitive.Trigger
|
||||||
|
data-slot="select-trigger"
|
||||||
|
data-size={size}
|
||||||
|
className={cn(
|
||||||
|
"flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
<SelectPrimitive.Icon asChild>
|
||||||
|
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
||||||
|
</SelectPrimitive.Icon>
|
||||||
|
</SelectPrimitive.Trigger>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectContent({
|
||||||
|
className,
|
||||||
|
children,
|
||||||
|
position = "item-aligned",
|
||||||
|
align = "center",
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
||||||
|
return (
|
||||||
|
<SelectPrimitive.Portal>
|
||||||
|
<SelectPrimitive.Content
|
||||||
|
data-slot="select-content"
|
||||||
|
data-align-trigger={position === "item-aligned"}
|
||||||
|
className={cn("relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", position ==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className )}
|
||||||
|
position={position}
|
||||||
|
align={align}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<SelectScrollUpButton />
|
||||||
|
<SelectPrimitive.Viewport
|
||||||
|
data-position={position}
|
||||||
|
className={cn(
|
||||||
|
"data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",
|
||||||
|
position === "popper" && ""
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</SelectPrimitive.Viewport>
|
||||||
|
<SelectScrollDownButton />
|
||||||
|
</SelectPrimitive.Content>
|
||||||
|
</SelectPrimitive.Portal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectLabel({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
||||||
|
return (
|
||||||
|
<SelectPrimitive.Label
|
||||||
|
data-slot="select-label"
|
||||||
|
className={cn("px-1.5 py-1 text-xs text-muted-foreground", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectItem({
|
||||||
|
className,
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
||||||
|
return (
|
||||||
|
<SelectPrimitive.Item
|
||||||
|
data-slot="select-item"
|
||||||
|
className={cn(
|
||||||
|
"relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center">
|
||||||
|
<SelectPrimitive.ItemIndicator>
|
||||||
|
<CheckIcon className="pointer-events-none" />
|
||||||
|
</SelectPrimitive.ItemIndicator>
|
||||||
|
</span>
|
||||||
|
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
||||||
|
</SelectPrimitive.Item>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectSeparator({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
||||||
|
return (
|
||||||
|
<SelectPrimitive.Separator
|
||||||
|
data-slot="select-separator"
|
||||||
|
className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectScrollUpButton({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
||||||
|
return (
|
||||||
|
<SelectPrimitive.ScrollUpButton
|
||||||
|
data-slot="select-scroll-up-button"
|
||||||
|
className={cn(
|
||||||
|
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<ChevronUpIcon
|
||||||
|
/>
|
||||||
|
</SelectPrimitive.ScrollUpButton>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectScrollDownButton({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
||||||
|
return (
|
||||||
|
<SelectPrimitive.ScrollDownButton
|
||||||
|
data-slot="select-scroll-down-button"
|
||||||
|
className={cn(
|
||||||
|
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<ChevronDownIcon
|
||||||
|
/>
|
||||||
|
</SelectPrimitive.ScrollDownButton>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectGroup,
|
||||||
|
SelectItem,
|
||||||
|
SelectLabel,
|
||||||
|
SelectScrollDownButton,
|
||||||
|
SelectScrollUpButton,
|
||||||
|
SelectSeparator,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import * as React from "react"
|
||||||
|
import { cn } from "cn"
|
||||||
|
import { Separator as SeparatorPrimitive } from "radix-ui"
|
||||||
|
|
||||||
|
function Separator({
|
||||||
|
className,
|
||||||
|
orientation = "horizontal",
|
||||||
|
decorative = true,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
||||||
|
return (
|
||||||
|
<SeparatorPrimitive.Root
|
||||||
|
data-slot="separator"
|
||||||
|
decorative={decorative}
|
||||||
|
orientation={orientation}
|
||||||
|
className={cn(
|
||||||
|
"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Separator }
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { cn } from "cn"
|
||||||
|
|
||||||
|
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="skeleton"
|
||||||
|
className={cn("animate-pulse rounded-md bg-muted", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Skeleton }
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import * as React from "react"
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
import { cn } from "cn"
|
||||||
|
import { Tabs as TabsPrimitive } from "radix-ui"
|
||||||
|
|
||||||
|
function Tabs({
|
||||||
|
className,
|
||||||
|
orientation = "horizontal",
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof TabsPrimitive.Root>) {
|
||||||
|
return (
|
||||||
|
<TabsPrimitive.Root
|
||||||
|
data-slot="tabs"
|
||||||
|
data-orientation={orientation}
|
||||||
|
className={cn(
|
||||||
|
"group/tabs flex gap-2 data-horizontal:flex-col",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const tabsListVariants = cva(
|
||||||
|
"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default: "bg-muted",
|
||||||
|
line: "gap-1 bg-transparent",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function TabsList({
|
||||||
|
className,
|
||||||
|
variant = "default",
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof TabsPrimitive.List> &
|
||||||
|
VariantProps<typeof tabsListVariants>) {
|
||||||
|
return (
|
||||||
|
<TabsPrimitive.List
|
||||||
|
data-slot="tabs-list"
|
||||||
|
data-variant={variant}
|
||||||
|
className={cn(tabsListVariants({ variant }), className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function TabsTrigger({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
|
||||||
|
return (
|
||||||
|
<TabsPrimitive.Trigger
|
||||||
|
data-slot="tabs-trigger"
|
||||||
|
className={cn(
|
||||||
|
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
|
||||||
|
"data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
|
||||||
|
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function TabsContent({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof TabsPrimitive.Content>) {
|
||||||
|
return (
|
||||||
|
<TabsPrimitive.Content
|
||||||
|
data-slot="tabs-content"
|
||||||
|
className={cn("flex-1 text-sm outline-none", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
|
||||||
+95
-20
@@ -1,34 +1,109 @@
|
|||||||
/**
|
/**
|
||||||
* One mascot, palette-swapped per country/region. Colors are derived from
|
* One mascot, palette-swapped per country. `flagPrimary`/`flagSecondary` are
|
||||||
* each flag's dominant hues (primary = most saturated non-neutral color,
|
* the true flag hex values (used for the small flag swatch / badges).
|
||||||
* secondary = next), with manual overrides where the algorithmic pick would
|
* `accent`/`accentSoft` are OKLCH values tuned for legibility as a UI accent
|
||||||
* clash as a 2-color UI (e.g. flags that are only red/white or green/white).
|
* on a dark background — several flag colors (navy, dark green, deep red)
|
||||||
|
* are too dark/desaturated to use directly as an accent on dark UI, so they
|
||||||
|
* are lightened here rather than algorithmically derived, same as the
|
||||||
|
* manual-override policy described for the mascot palette.
|
||||||
*/
|
*/
|
||||||
export interface CountryTheme {
|
export interface CountryTheme {
|
||||||
code: string // ISO 3166-1 alpha-2, or a region code like 'CA-QC'
|
code: string // ISO 3166-1 alpha-2, or a region code like 'CA-QC'
|
||||||
name: string
|
name: string
|
||||||
flagEmoji: string
|
flagEmoji: string
|
||||||
primary: string
|
flagPrimary: string
|
||||||
secondary: string
|
flagSecondary: string
|
||||||
|
accent: string // oklch(), CSS custom property value
|
||||||
|
accentSoft: string // oklch() with alpha, for subtle backgrounds
|
||||||
}
|
}
|
||||||
|
|
||||||
const FALLBACK: Pick<CountryTheme, 'primary' | 'secondary'> = {
|
const FALLBACK_ACCENT = 'oklch(0.77 0.118 84.8)' // LokiLab gold
|
||||||
primary: '#D7AE54', // LokiLab gold — used when a flag has no usable non-neutral color
|
|
||||||
secondary: '#242B36',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const COUNTRIES: CountryTheme[] = [
|
export const COUNTRIES: CountryTheme[] = [
|
||||||
{ code: 'CA-QC', name: 'Québec', flagEmoji: '⚜️', primary: '#1768C4', secondary: '#183653' },
|
{
|
||||||
{ code: 'CA', name: 'Canada', flagEmoji: '🇨🇦', primary: '#D52B1E', secondary: '#FFFFFF' },
|
code: 'CA-QC',
|
||||||
{ code: 'FR', name: 'France', flagEmoji: '🇫🇷', primary: '#0055A4', secondary: '#EF4135' },
|
name: 'Québec',
|
||||||
{ code: 'US', name: 'United States', flagEmoji: '🇺🇸', primary: '#B22234', secondary: '#3C3B6E' },
|
flagEmoji: '⚜️',
|
||||||
{ code: 'ES', name: 'España', flagEmoji: '🇪🇸', primary: '#AA151B', secondary: '#F1BF00' },
|
flagPrimary: '#1768C4',
|
||||||
{ code: 'IT', name: 'Italia', flagEmoji: '🇮🇹', primary: '#009246', secondary: '#CE2B37' },
|
flagSecondary: '#183653',
|
||||||
{ code: 'PT', name: 'Portugal', flagEmoji: '🇵🇹', primary: '#046A38', secondary: '#DA020E' },
|
accent: 'oklch(0.62 0.16 255.5)',
|
||||||
{ code: 'DZ', name: 'Algérie', flagEmoji: '🇩🇿', primary: '#006233', secondary: '#D21034' },
|
accentSoft: 'oklch(0.62 0.16 255.5 / 14%)',
|
||||||
{ code: 'MA', name: 'Maroc', flagEmoji: '🇲🇦', primary: '#C1272D', secondary: '#006233' },
|
},
|
||||||
|
{
|
||||||
|
code: 'FR',
|
||||||
|
name: 'France',
|
||||||
|
flagEmoji: '🇫🇷',
|
||||||
|
flagPrimary: '#0055A4',
|
||||||
|
flagSecondary: '#EF4135',
|
||||||
|
accent: 'oklch(0.63 0.19 28.6)',
|
||||||
|
accentSoft: 'oklch(0.63 0.19 28.6 / 14%)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'US',
|
||||||
|
name: 'United States',
|
||||||
|
flagEmoji: '🇺🇸',
|
||||||
|
flagPrimary: '#B22234',
|
||||||
|
flagSecondary: '#3C3B6E',
|
||||||
|
accent: 'oklch(0.6 0.17 20.7)',
|
||||||
|
accentSoft: 'oklch(0.6 0.17 20.7 / 14%)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'ES',
|
||||||
|
name: 'España',
|
||||||
|
flagEmoji: '🇪🇸',
|
||||||
|
flagPrimary: '#AA151B',
|
||||||
|
flagSecondary: '#F1BF00',
|
||||||
|
accent: 'oklch(0.76 0.16 89.6)',
|
||||||
|
accentSoft: 'oklch(0.76 0.16 89.6 / 14%)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'IT',
|
||||||
|
name: 'Italia',
|
||||||
|
flagEmoji: '🇮🇹',
|
||||||
|
flagPrimary: '#009246',
|
||||||
|
flagSecondary: '#CE2B37',
|
||||||
|
accent: 'oklch(0.65 0.15 151.1)',
|
||||||
|
accentSoft: 'oklch(0.65 0.15 151.1 / 14%)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'PT',
|
||||||
|
name: 'Portugal',
|
||||||
|
flagEmoji: '🇵🇹',
|
||||||
|
flagPrimary: '#046A38',
|
||||||
|
flagSecondary: '#DA020E',
|
||||||
|
accent: 'oklch(0.63 0.14 153.6)',
|
||||||
|
accentSoft: 'oklch(0.63 0.14 153.6 / 14%)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'DZ',
|
||||||
|
name: 'Algérie',
|
||||||
|
flagEmoji: '🇩🇿',
|
||||||
|
flagPrimary: '#006233',
|
||||||
|
flagSecondary: '#D21034',
|
||||||
|
accent: 'oklch(0.6 0.13 153.7)',
|
||||||
|
accentSoft: 'oklch(0.6 0.13 153.7 / 14%)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'MA',
|
||||||
|
name: 'Maroc',
|
||||||
|
flagEmoji: '🇲🇦',
|
||||||
|
flagPrimary: '#C1272D',
|
||||||
|
flagSecondary: '#006233',
|
||||||
|
accent: 'oklch(0.58 0.19 25)',
|
||||||
|
accentSoft: 'oklch(0.58 0.19 25 / 14%)',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export function countryTheme(code: string): CountryTheme {
|
export function countryTheme(code: string): CountryTheme {
|
||||||
return COUNTRIES.find((c) => c.code === code) ?? { code, name: code, flagEmoji: '🏳️', ...FALLBACK }
|
return (
|
||||||
|
COUNTRIES.find((c) => c.code === code) ?? {
|
||||||
|
code,
|
||||||
|
name: code,
|
||||||
|
flagEmoji: '🏳️',
|
||||||
|
flagPrimary: '#D7AE54',
|
||||||
|
flagSecondary: '#242B36',
|
||||||
|
accent: FALLBACK_ACCENT,
|
||||||
|
accentSoft: 'oklch(0.77 0.118 84.8 / 14%)',
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export { cn } from "cn"
|
||||||
Generated
+4553
-11
File diff suppressed because it is too large
Load Diff
+7
-1
@@ -8,9 +8,15 @@
|
|||||||
"start": "next start"
|
"start": "next start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"class-variance-authority": "^0.7.1",
|
||||||
|
"cn": "^0.5.0",
|
||||||
|
"lucide-react": "^1.64.0",
|
||||||
"next": "16.4.3",
|
"next": "16.4.3",
|
||||||
|
"radix-ui": "^1.8.1",
|
||||||
"react": "19.3.0",
|
"react": "19.3.0",
|
||||||
"react-dom": "19.3.0"
|
"react-dom": "19.3.0",
|
||||||
|
"shadcn": "^4.23.0",
|
||||||
|
"tw-animate-css": "^1.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/turbopack": "^4",
|
"@tailwindcss/turbopack": "^4",
|
||||||
|
|||||||
Reference in New Issue
Block a user