diff --git a/app/panel/reports/[id]/page.tsx b/app/panel/reports/[id]/page.tsx
index 33e3ea0..f7cd304 100644
--- a/app/panel/reports/[id]/page.tsx
+++ b/app/panel/reports/[id]/page.tsx
@@ -1,37 +1,47 @@
import { MessageContextCard } from "@/components/cards/MessageContextCard";
+import { ReportCard } from "@/components/cards/ReportCard";
import { UserCard } from "@/components/cards/UserCard";
-import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
import { Badge } from "@/components/ui/badge";
-import { Button, buttonVariants } from "@/components/ui/button";
+import { buttonVariants } from "@/components/ui/button";
import {
Card,
- CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
-import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/components/ui/popover";
import { Separator } from "@/components/ui/separator";
import {
fetchReportById,
+ fetchReports,
fetchSnapshotsByReport,
fetchUserById,
} from "@/lib/db";
import { ArrowLeft } from "lucide-react";
import Link from "next/link";
+import { notFound } from "next/navigation";
import { Fragment } from "react";
export default async function Reports({ params }: { params: { id: string } }) {
const report = await fetchReportById(params.id);
- if (!report) return 404;
+ if (!report) return notFound();
const author = await fetchUserById(report.author_id);
const snapshots = await fetchSnapshotsByReport(report._id);
+ const relatedReports = await Promise.all(
+ snapshots
+ .map((snapshot) => snapshot._id)
+ .map((contentId) =>
+ fetchReports({
+ _id: {
+ $ne: report._id,
+ },
+ status: "Created",
+ "content.id": contentId,
+ })
+ )
+ );
+
return (
- {snapshots.map((snapshot) => (
+ {snapshots.map((snapshot, index) => (
- {/**/}
+
- {/*
*/}
+ {relatedReports[index].length ? (
+
+ ) : undefined}
{snapshot._type === "Message" && (
)}
-
- {/*
Related Open Reports
*/}
-
+ {relatedReports[index].length ? (
+
+
Other Reports
+ {relatedReports[index].map((relatedReport) => (
+
+ ))}
+
+ ) : undefined}
))}
diff --git a/app/panel/reports/page.tsx b/app/panel/reports/page.tsx
index 40536c3..f0d1f53 100644
--- a/app/panel/reports/page.tsx
+++ b/app/panel/reports/page.tsx
@@ -1,13 +1,6 @@
-import { Badge } from "@/components/ui/badge";
-import {
- Card,
- CardDescription,
- CardHeader,
- CardTitle,
-} from "@/components/ui/card";
+import { ReportCard } from "@/components/cards/ReportCard";
import { Input } from "@/components/ui/input";
import { fetchReports } from "@/lib/db";
-import Link from "next/link";
export default async function Reports() {
const reports = (await fetchReports()).sort((b, _) =>
@@ -18,22 +11,7 @@ export default async function Reports() {
{reports.map((report) => (
-
-
-
-
- {report.content.report_reason.includes("Illegal") && (
- Urgent
- )}{" "}
- {report.additional_context || "No reason specified"}
-
-
- {report._id.toString().substring(20, 26)} ·{" "}
- {report.content.report_reason} · {report.content.type}
-
-
-
-
+
))}
);
diff --git a/app/panel/sparkle/page.tsx b/app/panel/sparkle/page.tsx
index 1fbbbd0..4500dc3 100644
--- a/app/panel/sparkle/page.tsx
+++ b/app/panel/sparkle/page.tsx
@@ -1,6 +1,7 @@
export default function Sparkle() {
return (
-
+
+
Running version v0.0.1
-
+
{user?.avatar && (
- )}
- {user?.username}
+ )}{" "}
+ {user?.username}#{user?.discriminator}
{message.content && {message.content}}
diff --git a/components/cards/ReportCard.tsx b/components/cards/ReportCard.tsx
new file mode 100644
index 0000000..3481cb8
--- /dev/null
+++ b/components/cards/ReportCard.tsx
@@ -0,0 +1,25 @@
+import Link from "next/link";
+import { Report } from "revolt-api";
+import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
+import { Badge } from "../ui/badge";
+
+export function ReportCard({ report }: { report: Report }) {
+ return (
+
+
+
+
+ {report.content.report_reason.includes("Illegal") && (
+ Urgent
+ )}{" "}
+ {report.additional_context || "No reason specified"}
+
+
+ {report._id.toString().substring(20, 26)} ·{" "}
+ {report.content.report_reason} · {report.content.type}
+
+
+
+
+ );
+}