Members register via email+password (scrypt) or Google OAuth — same signed-cookie + scrypt pattern as LokiLab (lib/auth.ts, member-password.ts, member-auth.ts, google-oauth.ts), own AUTH_SECRET and own OAuth client, own dedicated Postgres database (lokiloto-db on Coolify), fully isolated from LokiLab's own DB and auth. Leaderboard tracks who follows Loki's picks most accurately — members star a pick from the results panel (FollowButton), resolution reuses LokiLab's own lastDraw.won, no money or pooled play involved anywhere. Leaderboard page renders a horizontal bar chart (recharts) plus a ranked list. Profile page: public nickname (required to appear on the leaderboard), list of followed picks. Header now carries nav + a user menu (avatar dropdown when signed in, "Connexion" button otherwise). Dockerfile runs prisma migrate deploy at container start via docker-entrypoint.sh, same pattern as LokiLab. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
"use client"
|
|
|
|
import { Bar, BarChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"
|
|
import type { MemberStanding } from "@/lib/follows"
|
|
|
|
export function LeaderboardChart({ standings }: { standings: MemberStanding[] }) {
|
|
const data = standings.slice(0, 10).map((s) => ({
|
|
name: s.displayName,
|
|
"Taux de réussite": Math.round(s.winRate * 100),
|
|
}))
|
|
|
|
return (
|
|
<ResponsiveContainer width="100%" height={Math.max(220, data.length * 36)}>
|
|
<BarChart data={data} layout="vertical" margin={{ left: 8, right: 24, top: 8, bottom: 8 }}>
|
|
<CartesianGrid strokeDasharray="3 3" stroke="var(--border)" horizontal={false} />
|
|
<XAxis type="number" domain={[0, 100]} tick={{ fill: "var(--muted-foreground)", fontSize: 12 }} unit="%" />
|
|
<YAxis
|
|
type="category"
|
|
dataKey="name"
|
|
width={110}
|
|
tick={{ fill: "var(--foreground)", fontSize: 12 }}
|
|
/>
|
|
<Tooltip
|
|
contentStyle={{
|
|
background: "var(--panel)",
|
|
border: "1px solid var(--border)",
|
|
borderRadius: 6,
|
|
fontSize: 12,
|
|
}}
|
|
cursor={{ fill: "var(--panel-hover)" }}
|
|
/>
|
|
<Bar dataKey="Taux de réussite" fill="var(--accent)" radius={[0, 4, 4, 0]} />
|
|
</BarChart>
|
|
</ResponsiveContainer>
|
|
)
|
|
}
|