From e9b623f60d279fe1e9e07c0c652c7dac8b0d0e0f Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sat, 25 Nov 2023 20:59:28 +0000 Subject: [PATCH] feat: show username of grouped reports rather than id --- app/panel/reports/page.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/panel/reports/page.tsx b/app/panel/reports/page.tsx index 4aaaefc..9ffd39c 100644 --- a/app/panel/reports/page.tsx +++ b/app/panel/reports/page.tsx @@ -1,7 +1,7 @@ import { ReportCard } from "@/components/cards/ReportCard"; import { CardLink } from "@/components/common/CardLink"; import { Input } from "@/components/ui/input"; -import { fetchOpenReports } from "@/lib/db"; +import { fetchOpenReports, fetchUsersById } from "@/lib/db"; import { PizzaIcon } from "lucide-react"; import { Report } from "revolt-api"; @@ -41,6 +41,11 @@ export default async function Reports() { } } + const authorNames: Record = {}; + for (const user of await fetchUsersById(Object.keys(countsByAuthor))) { + authorNames[user._id] = user.username + "#" + user.discriminator; + } + return (
{/**/} @@ -48,7 +53,7 @@ export default async function Reports() { keyOrder.map((key) => { return (
-

{key}

+

{authorNames[key] ?? key}

{byCategory[key].map((report) => (