Scaffold LokiLoto: country theme engine, LokiLab feed client, Québec home page

International lottery stats layer, fed by LokiLab's army-feed API
(results, Loki's picks, lifetime win record, army size). One mascot
reskinned per country via flag-derived colors; Québec is the first
locale, same pattern every future country will follow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Nazim Kri
2026-10-29 21:23:01 -04:00
co-authored by Claude Sonnet 5
parent b6a4c94e93
commit b2915d06cd
5 changed files with 143 additions and 68 deletions
+4 -4
View File
@@ -13,17 +13,17 @@ const geistMono = Geist_Mono({
}); });
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Create Next App", title: "LokiLoto",
description: "Generated by create next app", description: "Lottery stats and Loki's picks, country by country.",
}; };
export default function RootLayout({ children }: LayoutProps<"/">) { export default function RootLayout({ children }: LayoutProps<"/">) {
return ( return (
<html <html
lang="en" lang="fr"
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`} className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
> >
<body className="min-h-full flex flex-col">{children}</body> <body className="min-h-full flex flex-col bg-zinc-50 text-zinc-900">{children}</body>
</html> </html>
); );
} }
+61 -61
View File
@@ -1,69 +1,69 @@
import Image from "next/image"; import { countryTheme } from '@/lib/countries'
import { getArmyFeed } from '@/lib/lokilab-feed'
export const instant = false
export default async function Home() {
const feed = await getArmyFeed()
const theme = countryTheme('CA-QC')
export default function Home() {
return ( return (
<div className="flex flex-col flex-1 items-center justify-center bg-zinc-50 font-sans dark:bg-black"> <main className="flex flex-1 flex-col items-center px-6 py-16">
<main className="flex flex-1 w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start"> <div className="w-full max-w-3xl space-y-8">
<Image <header className="text-center">
className="dark:invert h-5 w-[100px]" <h1 className="text-4xl font-bold tracking-tight" style={{ color: theme.primary }}>
src="/next.svg" LokiLoto
alt="Next.js logo"
width={100}
height={20}
priority
/>
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
To get started, edit the{" "}
<code className="rounded bg-black/[.06] px-1.5 py-0.5 font-mono text-[0.9em] dark:bg-white/[.08]">
page.tsx
</code>{" "}
file.
</h1> </h1>
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400"> <p className="mt-2 text-zinc-600">
Looking for a starting point or more instructions? Head over to{" "} {feed.army.total.toLocaleString('fr-CA')} membres dans l'armée · stats et pronostics de Loki, pays par pays
<a </p>
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app" </header>
className="font-medium text-zinc-950 dark:text-zinc-50"
<section
className="rounded-2xl border p-6"
style={{ borderColor: theme.secondary + '30', background: theme.primary + '08' }}
> >
Templates <div className="mb-4 flex items-center gap-2">
</a>{" "} <span className="text-2xl">{theme.flagEmoji}</span>
or the{" "} <h2 className="text-xl font-semibold" style={{ color: theme.secondary }}>
<a {theme.name}
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app" </h2>
className="font-medium text-zinc-950 dark:text-zinc-50" <span className="ml-auto text-sm text-zinc-500">
> {(feed.army.byCountry[theme.code] ?? 0).toLocaleString('fr-CA')} membres
Learning </span>
</a>{" "} </div>
center.
<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> </p>
</div> </div>
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
<a
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert h-[14px] w-4"
src="/vercel.svg"
alt="Vercel logomark"
width={16}
height={14}
/>
Deploy Now
</a>
<a
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Documentation
</a>
</div>
</main> </main>
</div> )
);
} }
+34
View File
@@ -0,0 +1,34 @@
/**
* One mascot, palette-swapped per country/region. Colors are derived from
* each flag's dominant hues (primary = most saturated non-neutral color,
* secondary = next), with manual overrides where the algorithmic pick would
* clash as a 2-color UI (e.g. flags that are only red/white or green/white).
*/
export interface CountryTheme {
code: string // ISO 3166-1 alpha-2, or a region code like 'CA-QC'
name: string
flagEmoji: string
primary: string
secondary: string
}
const FALLBACK: Pick<CountryTheme, 'primary' | 'secondary'> = {
primary: '#D7AE54', // LokiLab gold — used when a flag has no usable non-neutral color
secondary: '#242B36',
}
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: 'FR', name: 'France', flagEmoji: '🇫🇷', primary: '#0055A4', secondary: '#EF4135' },
{ code: 'US', name: 'United States', flagEmoji: '🇺🇸', primary: '#B22234', secondary: '#3C3B6E' },
{ code: 'ES', name: 'España', flagEmoji: '🇪🇸', primary: '#AA151B', secondary: '#F1BF00' },
{ code: 'IT', name: 'Italia', flagEmoji: '🇮🇹', primary: '#009246', secondary: '#CE2B37' },
{ code: 'PT', name: 'Portugal', flagEmoji: '🇵🇹', primary: '#046A38', secondary: '#DA020E' },
{ code: 'DZ', name: 'Algérie', flagEmoji: '🇩🇿', primary: '#006233', secondary: '#D21034' },
{ code: 'MA', name: 'Maroc', flagEmoji: '🇲🇦', primary: '#C1272D', secondary: '#006233' },
]
export function countryTheme(code: string): CountryTheme {
return COUNTRIES.find((c) => c.code === code) ?? { code, name: code, flagEmoji: '🏳️', ...FALLBACK }
}
+40
View File
@@ -0,0 +1,40 @@
import 'server-only'
/**
* The one contract between LokiLab and LokiLoto: results, Loki's picks,
* lifetime win record, and army size. LokiLoto never talks to LokiLab's
* database or stats engine directly — only this feed.
*/
export interface ArmyFeed {
army: {
total: number
byCountry: Record<string, number>
}
lotteries: LotteryFeedEntry[]
}
export interface LotteryFeedEntry {
id: string
name: string
country: string
lifetime: {
picksTracked: number
wins: number
winRate: number
}
lastDraw: {
date: string
result: number[]
pick: number[] | null
matched: number | null
won: boolean | null
} | null
}
const LOKILAB_FEED_URL = process.env.LOKILAB_FEED_URL ?? 'https://goldd.devyouz.net/api/public/army-feed'
export async function getArmyFeed(): Promise<ArmyFeed> {
const res = await fetch(LOKILAB_FEED_URL, { next: { revalidate: 300 } })
if (!res.ok) throw new Error(`LokiLab feed returned ${res.status}`)
return res.json()
}
+1
View File
@@ -5,6 +5,7 @@ const nextConfig: NextConfig = {
cacheComponents: true, cacheComponents: true,
partialPrefetching: true, partialPrefetching: true,
turbopack: { turbopack: {
root: __dirname,
rules: { rules: {
"*.css": { "*.css": {
loaders: ["@tailwindcss/turbopack"], loaders: ["@tailwindcss/turbopack"],