1
0
Fork 0

feat: show username of grouped reports rather than id

main
Paul Makles 2023-11-25 20:59:28 +00:00
parent cdb05a5af7
commit e9b623f60d
No known key found for this signature in database
GPG Key ID: 5059F398521BB0F6
1 changed files with 7 additions and 2 deletions

View File

@ -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<string, string> = {};
for (const user of await fetchUsersById(Object.keys(countsByAuthor))) {
authorNames[user._id] = user.username + "#" + user.discriminator;
}
return (
<div className="flex flex-col gap-8">
{/*<Input placeholder="Search for reports..." disabled />*/}
@ -48,7 +53,7 @@ export default async function Reports() {
keyOrder.map((key) => {
return (
<div key={key} className="flex flex-col gap-2">
<h1 className="text-2xl">{key}</h1>
<h1 className="text-2xl">{authorNames[key] ?? key}</h1>
{byCategory[key].map((report) => (
<CardLink
key={report._id}