Files
lokiloto/app/page.tsx
T
Nazim KriandClaude Opus 5.5 9996f7b823 Restructure navigation after 1xbet: utility bar, lottery strip, right rail
User feedback: still ugly, the 1xbet navigation was never actually
reproduced. Now follows its structure:
- thin utility bar on top (country picker, Connexion + Inscription)
  above the main bar (logo, nav)
- horizontal icon strip of the country's lotteries under the header,
  with the active one underlined in gold
- compact promo banner instead of a full-height hero, so results stay
  above the fold
- right rail in the bet-slip position: top-5 leaderboard and army stats

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:41:16 -04:00

96 lines
3.7 KiB
TypeScript

import { Suspense } from "react"
import { countryTheme } from "@/lib/countries"
import { getArmyFeed } from "@/lib/lokilab-feed"
import { getCurrentMember } from "@/lib/member-auth"
import { listFollowedPicks } from "@/lib/follows"
import { resolveCountry } from "@/lib/country-pref"
import { LotteryResultsPanel } from "@/components/lottery-results-panel"
import { AppHeader } from "@/components/app-header"
import { LotteryStrip } from "@/components/lottery-strip"
import { Hero } from "@/components/hero"
import { SideRail } from "@/components/side-rail"
import { Flag } from "@/components/flag"
import { Skeleton } from "@/components/ui/skeleton"
export const instant = false
export default function Home() {
return (
<main className="flex flex-1 flex-col">
<AppHeader />
<Suspense fallback={<HomeSkeleton />}>
<HomeContent />
</Suspense>
</main>
)
}
async function HomeContent() {
const [feed, member] = await Promise.all([getArmyFeed(), getCurrentMember()])
const activeCode = await resolveCountry(member)
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)
const globalWins = feed.lotteries.reduce((sum, l) => sum + l.lifetime.wins, 0)
const follows = member ? await listFollowedPicks(member.id) : []
const followedKeys = new Set(follows.map((f) => `${f.lotteryId}:${f.targetDrawDate}`))
return (
<>
<LotteryStrip lotteries={lotteries} />
<div
style={{ "--accent": theme.accent, "--accent-soft": theme.accentSoft } as React.CSSProperties}
className="mx-auto grid w-full max-w-6xl flex-1 grid-cols-1 gap-4 px-4 py-4 sm:px-6 lg:grid-cols-[1fr_300px]"
>
<div className="min-w-0 space-y-4">
<Hero isAuthenticated={!!member} />
<div className="overflow-hidden rounded-lg border border-border bg-card">
<div className="flex items-center gap-2.5 border-b border-border bg-[#0b111d] px-4 py-2.5">
<Flag code={theme.code} />
<h2 className="text-sm font-semibold">Derniers tirages — {theme.name}</h2>
<span className="ml-auto text-xs text-muted-foreground">
{totalTracked > 0 ? `Loki : ${totalWins}/${totalTracked} grilles gagnantes` : `${lotteries.length} loteries`}
</span>
</div>
{lotteries.length > 0 ? (
<LotteryResultsPanel
lotteries={lotteries}
country={activeCode}
followedKeys={followedKeys}
isAuthenticated={!!member}
/>
) : (
<p className="py-14 text-center text-sm text-muted-foreground">
Les loteries de {theme.name} arrivent bientôt dans l&apos;univers de Loki.
</p>
)}
</div>
<p className="text-[11px] text-muted-foreground">
Données fournies par LokiLab. Statistiques descriptives seulement — aucune garantie de gain.
</p>
</div>
<Suspense fallback={<Skeleton className="h-72 w-full" />}>
<SideRail armyTotal={feed.army.total} globalWins={globalWins} />
</Suspense>
</div>
</>
)
}
function HomeSkeleton() {
return (
<div className="mx-auto grid w-full max-w-6xl grid-cols-1 gap-4 px-4 py-4 sm:px-6 lg:grid-cols-[1fr_300px]">
<div className="space-y-4">
<Skeleton className="h-44 w-full" />
<Skeleton className="h-80 w-full" />
</div>
<Skeleton className="h-72 w-full" />
</div>
)
}