From b2915d06cd7816715167fc278ec71112a3f5a65d Mon Sep 17 00:00:00 2001 From: Nazim Kri Date: Thu, 29 Oct 2026 21:23:01 -0400 Subject: [PATCH] =?UTF-8?q?Scaffold=20LokiLoto:=20country=20theme=20engine?= =?UTF-8?q?,=20LokiLab=20feed=20client,=20Qu=C3=A9bec=20home=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/layout.tsx | 8 +-- app/page.tsx | 128 ++++++++++++++++++++++---------------------- lib/countries.ts | 34 ++++++++++++ lib/lokilab-feed.ts | 40 ++++++++++++++ next.config.ts | 1 + 5 files changed, 143 insertions(+), 68 deletions(-) create mode 100644 lib/countries.ts create mode 100644 lib/lokilab-feed.ts diff --git a/app/layout.tsx b/app/layout.tsx index 9852c15..0d67f5f 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -13,17 +13,17 @@ const geistMono = Geist_Mono({ }); export const metadata: Metadata = { - title: "Create Next App", - description: "Generated by create next app", + title: "LokiLoto", + description: "Lottery stats and Loki's picks, country by country.", }; export default function RootLayout({ children }: LayoutProps<"/">) { return ( - {children} + {children} ); } diff --git a/app/page.tsx b/app/page.tsx index c887311..256a6e3 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -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 ( -
-
- Next.js logo -
-

- To get started, edit the{" "} - - page.tsx - {" "} - file. +
+
+
+

+ LokiLoto

-

- Looking for a starting point or more instructions? Head over to{" "} - - Templates - {" "} - or the{" "} - - Learning - {" "} - center. +

+ {feed.army.total.toLocaleString('fr-CA')} membres dans l'armée · stats et pronostics de Loki, pays par pays

-
- -
-

- ); + + +
+
+ {theme.flagEmoji} +

+ {theme.name} +

+ + {(feed.army.byCountry[theme.code] ?? 0).toLocaleString('fr-CA')} membres + +
+ +
+ {feed.lotteries + .filter((l) => l.country === theme.code) + .map((l) => ( +
+
+ {l.name} + + {l.lifetime.wins}/{l.lifetime.picksTracked} gains + +
+ {l.lastDraw && ( +
+
Dernier tirage {l.lastDraw.date} : {l.lastDraw.result.join(' - ')}
+ {l.lastDraw.pick && ( +
+ Choix de Loki : {l.lastDraw.pick.join(' - ')} + {l.lastDraw.won ? ' — gagnant' : ` — ${l.lastDraw.matched} correspondance(s)`} +
+ )} +
+ )} +
+ ))} +
+
+ +

+ Données fournies par LokiLab. Statistiques descriptives seulement — aucune garantie de gain. +

+
+ + ) } diff --git a/lib/countries.ts b/lib/countries.ts new file mode 100644 index 0000000..21514bf --- /dev/null +++ b/lib/countries.ts @@ -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 = { + 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 } +} diff --git a/lib/lokilab-feed.ts b/lib/lokilab-feed.ts new file mode 100644 index 0000000..a680053 --- /dev/null +++ b/lib/lokilab-feed.ts @@ -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 + } + 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 { + const res = await fetch(LOKILAB_FEED_URL, { next: { revalidate: 300 } }) + if (!res.ok) throw new Error(`LokiLab feed returned ${res.status}`) + return res.json() +} diff --git a/next.config.ts b/next.config.ts index a0cf0c7..f4f290b 100644 --- a/next.config.ts +++ b/next.config.ts @@ -5,6 +5,7 @@ const nextConfig: NextConfig = { cacheComponents: true, partialPrefetching: true, turbopack: { + root: __dirname, rules: { "*.css": { loaders: ["@tailwindcss/turbopack"],