From a2e1ac1c93ceab2c2593bcbb4c84f7daab928751 Mon Sep 17 00:00:00 2001
From: jessy-david-dev
Date: Mon, 13 Apr 2026 17:07:27 +0200
Subject: [PATCH] feat(profile): add pagination for game history (10 games per
page)
---
app/components/ProfileScreen.tsx | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/app/components/ProfileScreen.tsx b/app/components/ProfileScreen.tsx
index 4635002..3b49585 100644
--- a/app/components/ProfileScreen.tsx
+++ b/app/components/ProfileScreen.tsx
@@ -58,8 +58,10 @@ export function ProfileScreen({
const [games, setGames] = useState([]);
const [loading, setLoading] = useState(true);
const [filter, setFilter] = useState<"all" | "solo" | "multi">("all");
+ const [page, setPage] = useState(1);
const [confirmDelete, setConfirmDelete] = useState(false);
const [deleting, setDeleting] = useState(false);
+ const PAGE_SIZE = 10;
async function handleDeleteAccount() {
setDeleting(true);
@@ -77,6 +79,8 @@ export function ProfileScreen({
const filtered =
filter === "all" ? games : games.filter((g) => g.mode === filter);
+ const totalPages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE));
+ const paginated = filtered.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
const stats = computeStats(filtered);
const allStats = computeStats(games);
@@ -186,7 +190,7 @@ export function ProfileScreen({
@@ -205,7 +209,7 @@ export function ProfileScreen({
Aucune partie enregistrée.
)}
- {filtered.map((g) => (
+ {paginated.map((g) => (
+ {/* Pagination */}
+ {totalPages > 1 && (
+
+
+
+ {page} / {totalPages}
+
+
+
+ )}
+
{/* Mes données */}