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:
co-authored by
Claude Sonnet 5
parent
b6a4c94e93
commit
b2915d06cd
@@ -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 }
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user