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>
113 lines
3.7 KiB
TypeScript
113 lines
3.7 KiB
TypeScript
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" })
|
|
}
|