forked from administration/panel
feat: show username of grouped reports rather than id
parent
cdb05a5af7
commit
e9b623f60d
|
@ -1,7 +1,7 @@
|
||||||
import { ReportCard } from "@/components/cards/ReportCard";
|
import { ReportCard } from "@/components/cards/ReportCard";
|
||||||
import { CardLink } from "@/components/common/CardLink";
|
import { CardLink } from "@/components/common/CardLink";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { fetchOpenReports } from "@/lib/db";
|
import { fetchOpenReports, fetchUsersById } from "@/lib/db";
|
||||||
import { PizzaIcon } from "lucide-react";
|
import { PizzaIcon } from "lucide-react";
|
||||||
import { Report } from "revolt-api";
|
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 (
|
return (
|
||||||
<div className="flex flex-col gap-8">
|
<div className="flex flex-col gap-8">
|
||||||
{/*<Input placeholder="Search for reports..." disabled />*/}
|
{/*<Input placeholder="Search for reports..." disabled />*/}
|
||||||
|
@ -48,7 +53,7 @@ export default async function Reports() {
|
||||||
keyOrder.map((key) => {
|
keyOrder.map((key) => {
|
||||||
return (
|
return (
|
||||||
<div key={key} className="flex flex-col gap-2">
|
<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) => (
|
{byCategory[key].map((report) => (
|
||||||
<CardLink
|
<CardLink
|
||||||
key={report._id}
|
key={report._id}
|
||||||
|
|
Loading…
Reference in New Issue