From 7f1619d33a5841c77ca1afd2bcbee72016b87aea Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sun, 26 Nov 2023 13:23:00 +0000 Subject: [PATCH] chore: make cased reports go away --- app/panel/reports/page.tsx | 2 ++ components/cards/ReportCard.tsx | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/panel/reports/page.tsx b/app/panel/reports/page.tsx index ba6bc48..064fbcb 100644 --- a/app/panel/reports/page.tsx +++ b/app/panel/reports/page.tsx @@ -30,6 +30,8 @@ export default async function Reports() { } for (const report of reports) { + if (report.case_id) continue; + if (!report.content.report_reason.includes("Illegal")) { if (countsByAuthor[report.author_id] > 1) { if (!keyOrder.includes(report.author_id)) { diff --git a/components/cards/ReportCard.tsx b/components/cards/ReportCard.tsx index b9870d4..6ddfeb5 100644 --- a/components/cards/ReportCard.tsx +++ b/components/cards/ReportCard.tsx @@ -1,10 +1,10 @@ -import { Report } from "revolt-api"; import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card"; import { Badge } from "../ui/badge"; import dayjs from "dayjs"; import { decodeTime } from "ulid"; import relativeTime from "dayjs/plugin/relativeTime"; +import { ReportDocument } from "@/lib/db"; dayjs.extend(relativeTime); const lastWeek = new Date(); @@ -13,7 +13,7 @@ lastWeek.setDate(lastWeek.getDate() - 7); const yesterday = new Date(); yesterday.setDate(yesterday.getDate() - 1); -export function ReportCard({ report }: { report: Report }) { +export function ReportCard({ report }: { report: ReportDocument }) { const dueDate = +(report.content.report_reason.includes("Illegal") ? yesterday : lastWeek); @@ -48,6 +48,14 @@ export function ReportCard({ report }: { report: Report }) { {report.status !== "Created" && report.closed_at && ( <>· Closed {dayjs(report.closed_at).fromNow()} )}{" "} + {report.case_id && ( + <> + ·{" "} + + Assigned + + + )}{" "} {report.status === "Created" && decodeTime(report._id) < dueDate && ( <> ·{" "}