feat(mod): help-center tickets queue with reduced PII
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m35s

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-28 20:26:57 +02:00
1 parent 01126207dc
commit b6b8625246
31 files changed
+502 -82

No files matched your search

+59 -27
View File
@@ -1,4 +1,12 @@
import { Ban, Gavel, Radio, Shield, Ticket, Users } from "lucide-react";
import {
Ban,
Gavel,
LifeBuoy,
Radio,
Shield,
Ticket,
Users,
} from "lucide-react";
import Link from "next/link";
import { getTranslations } from "next-intl/server";
import { StatsCard } from "@/components/admin/stats-card";
@@ -30,24 +38,30 @@ export default async function ModDashboardPage() {
canAccess(permissions, PERMS.MOD_TEAM_VIEW, rank) ||
canAccess(permissions, PERMS.MODERATION_VIEW, rank);
const [openCfh, todayBans, modsOnline, openTickets] = await Promise.all([
showCfh
? prisma.supportTickets.count({ where: { state: 0 } }).catch(() => 0)
: Promise.resolve(0),
showBans
? prisma.ban
.count({ where: { timestamp: { gte: todayStart } } })
.catch(() => 0)
: Promise.resolve(0),
prisma.user
.count({ where: { online: "1", rank: { gte: minStaffRank } } })
.catch(() => 0),
showTickets
? prisma.websiteTicket
.count({ where: { status: { not: "closed" } } })
.catch(() => 0)
: Promise.resolve(0),
]);
const [openCfh, todayBans, modsOnline, openTickets, openHelpTickets] =
await Promise.all([
showCfh
? prisma.supportTickets.count({ where: { state: 0 } }).catch(() => 0)
: Promise.resolve(0),
showBans
? prisma.ban
.count({ where: { timestamp: { gte: todayStart } } })
.catch(() => 0)
: Promise.resolve(0),
prisma.user
.count({ where: { online: "1", rank: { gte: minStaffRank } } })
.catch(() => 0),
showTickets
? prisma.websiteTicket
.count({ where: { status: { not: "closed" } } })
.catch(() => 0)
: Promise.resolve(0),
showTickets
? prisma.websiteHelpCenterTickets
.count({ where: { open: true } })
.catch(() => 0)
: Promise.resolve(0),
]);
return (
<div className="space-y-6">
@@ -75,6 +89,14 @@ export default async function ModDashboardPage() {
href="/mod/tickets"
/>
) : null}
{showTickets ? (
<StatsCard
title={t("stats.openHelpTickets")}
value={openHelpTickets}
icon={<LifeBuoy className="h-4 w-4" />}
href="/mod/help-tickets"
/>
) : null}
{showBans ? (
<StatsCard
title={t("stats.bansToday")}
@@ -120,14 +142,24 @@ export default async function ModDashboardPage() {
</li>
) : null}
{showTickets ? (
<li>
<Link
href="/mod/tickets"
className="text-primary hover:underline"
>
{t("nav.tickets")}
</Link>
</li>
<>
<li>
<Link
href="/mod/tickets"
className="text-primary hover:underline"
>
{t("nav.tickets")}
</Link>
</li>
<li>
<Link
href="/mod/help-tickets"
className="text-primary hover:underline"
>
{t("nav.helpTickets")}
</Link>
</li>
</>
) : null}
{showActions ? (
<li>