From 8534512194fe547c891d21760eed8ae25bae9d5f Mon Sep 17 00:00:00 2001 From: trafficlunar Date: Sun, 30 Mar 2025 13:23:12 +0100 Subject: [PATCH] feat: dynamic mii count --- src/app/page.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 2ef066d..a6d25ca 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -31,7 +31,8 @@ export default async function Page({ searchParams }: { searchParams: Promise<{ [ : []; const where = tagFilter.length > 0 ? { tags: { hasSome: tagFilter } } : undefined; - const miiCount = prisma.mii.count(); + const totalMiiCount = await prisma.mii.count(); + const shownMiiCount = await prisma.mii.count({ where }); const miis = await prisma.mii.findMany({ where: where, orderBy, @@ -41,7 +42,15 @@ export default async function Page({ searchParams }: { searchParams: Promise<{ [

- {miiCount} Miis + {totalMiiCount == shownMiiCount ? ( + <> + {totalMiiCount} Miis + + ) : ( + <> + {shownMiiCount} of {totalMiiCount} Miis + + )}