"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; type User = { id: string; name: string; email: string; banned: boolean; createdAt: string; _count: { games: number }; }; type Game = { id: string; mode: string; startArticle: string; targetArticle: string; clicks: number; timeSeconds: number; won: boolean; playedAt: string; user: { name: string }; }; type ModeStat = { mode: string; _count: { id: number }; _avg: { clicks: number | null; timeSeconds: number | null }; }; type ActivityDay = { date: string; count: number }; type AdminStats = { totalUsers: number; totalGames: number; todayGames: number; recentUsers: User[]; recentGames: Game[]; modeStats: ModeStat[]; activity: ActivityDay[]; }; type DailyPuzzle = { id: string; date: string; startArticle: string; targetArticle: string; _count: { results: number }; }; function fmt(s: number) { const m = Math.floor(s / 60); const sec = Math.round(s % 60); return m > 0 ? `${m}m${sec.toString().padStart(2, "0")}s` : `${sec}s`; } function MiniBarChart({ data }: { data: ActivityDay[] }) { const MAX_H = 64; // px, correspond à h-16 const max = Math.max(...data.map((d) => d.count), 1); return (
WikiRush - panneau d'administration
Confirmer la suppression
Supprimer{" "} {confirmDelete.label} {" "} ? Cette action est irréversible.
{label}
{value}
{u.name} {u.banned && ( Banni )}
{u.email}
{u._count.games} parties
{new Date(u.createdAt).toLocaleDateString("fr-FR")}
{g.user.name} - {g.startArticle} → {g.targetArticle}
{new Date(g.playedAt).toLocaleString("fr-FR")}
{p.date}
{p.startArticle} → {p.targetArticle}
{p._count.results} résultat {p._count.results > 1 ? "s" : ""}