forked from administration/panel
chore: make cased reports go away
parent
5cdb02b5bf
commit
7f1619d33a
|
@ -30,6 +30,8 @@ export default async function Reports() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const report of reports) {
|
for (const report of reports) {
|
||||||
|
if (report.case_id) continue;
|
||||||
|
|
||||||
if (!report.content.report_reason.includes("Illegal")) {
|
if (!report.content.report_reason.includes("Illegal")) {
|
||||||
if (countsByAuthor[report.author_id] > 1) {
|
if (countsByAuthor[report.author_id] > 1) {
|
||||||
if (!keyOrder.includes(report.author_id)) {
|
if (!keyOrder.includes(report.author_id)) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { Report } from "revolt-api";
|
|
||||||
import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
||||||
import { Badge } from "../ui/badge";
|
import { Badge } from "../ui/badge";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { decodeTime } from "ulid";
|
import { decodeTime } from "ulid";
|
||||||
|
|
||||||
import relativeTime from "dayjs/plugin/relativeTime";
|
import relativeTime from "dayjs/plugin/relativeTime";
|
||||||
|
import { ReportDocument } from "@/lib/db";
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
const lastWeek = new Date();
|
const lastWeek = new Date();
|
||||||
|
@ -13,7 +13,7 @@ lastWeek.setDate(lastWeek.getDate() - 7);
|
||||||
const yesterday = new Date();
|
const yesterday = new Date();
|
||||||
yesterday.setDate(yesterday.getDate() - 1);
|
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")
|
const dueDate = +(report.content.report_reason.includes("Illegal")
|
||||||
? yesterday
|
? yesterday
|
||||||
: lastWeek);
|
: lastWeek);
|
||||||
|
@ -48,6 +48,14 @@ export function ReportCard({ report }: { report: Report }) {
|
||||||
{report.status !== "Created" && report.closed_at && (
|
{report.status !== "Created" && report.closed_at && (
|
||||||
<>· Closed {dayjs(report.closed_at).fromNow()}</>
|
<>· Closed {dayjs(report.closed_at).fromNow()}</>
|
||||||
)}{" "}
|
)}{" "}
|
||||||
|
{report.case_id && (
|
||||||
|
<>
|
||||||
|
·{" "}
|
||||||
|
<Badge className="align-middle" variant="secondary">
|
||||||
|
Assigned
|
||||||
|
</Badge>
|
||||||
|
</>
|
||||||
|
)}{" "}
|
||||||
{report.status === "Created" && decodeTime(report._id) < dueDate && (
|
{report.status === "Created" && decodeTime(report._id) < dueDate && (
|
||||||
<>
|
<>
|
||||||
·{" "}
|
·{" "}
|
||||||
|
|
Loading…
Reference in New Issue