From c39738833d5edf6c4ff84a9cb7b9d38ebc2af573 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Thu, 27 Jul 2023 12:28:18 +0100 Subject: [PATCH] feat: various inspector components --- .../inspector/RelevantModerationNotices.tsx | 29 ++++++ components/inspector/RelevantObjects.tsx | 47 +++++++++ components/inspector/RelevantReports.tsx | 32 ++++++ components/inspector/UserActions.tsx | 99 +++++++++++++++++++ 4 files changed, 207 insertions(+) create mode 100644 components/inspector/RelevantModerationNotices.tsx create mode 100644 components/inspector/RelevantObjects.tsx create mode 100644 components/inspector/RelevantReports.tsx create mode 100644 components/inspector/UserActions.tsx diff --git a/components/inspector/RelevantModerationNotices.tsx b/components/inspector/RelevantModerationNotices.tsx new file mode 100644 index 0000000..05a5c7d --- /dev/null +++ b/components/inspector/RelevantModerationNotices.tsx @@ -0,0 +1,29 @@ +"use client"; + +import { AccountStrike, Message } from "revolt-api"; +import { ListCompactor } from "../common/ListCompactor"; +import { CompactMessage } from "../cards/CompactMessage"; + +export function RelevantModerationNotices({ + strikes, + notices, +}: { + strikes: AccountStrike[]; + notices: Message[]; +}) { + return ( +
+
+

Strikes

+ null} /> +
+
+

Alerts

+ } + /> +
+
+ ); +} diff --git a/components/inspector/RelevantObjects.tsx b/components/inspector/RelevantObjects.tsx new file mode 100644 index 0000000..d4f7c7b --- /dev/null +++ b/components/inspector/RelevantObjects.tsx @@ -0,0 +1,47 @@ +"use client"; + +import { Server, User } from "revolt-api"; +import { ListCompactor } from "../common/ListCompactor"; +import { UserCard } from "../cards/UserCard"; +import { ServerCard } from "../cards/ServerCard"; +import Link from "next/link"; + +export function RelevantObjects({ + users, + servers, + userId, +}: { + users: User[]; + servers: Server[]; + userId: string; +}) { + return ( +
+
+

Bots & Friends

+ ( + + + + )} + /> +
+
+

Servers

+ ( + + + + )} + /> +
+
+ ); +} diff --git a/components/inspector/RelevantReports.tsx b/components/inspector/RelevantReports.tsx new file mode 100644 index 0000000..6691228 --- /dev/null +++ b/components/inspector/RelevantReports.tsx @@ -0,0 +1,32 @@ +"use client"; + +import { Report } from "revolt-api"; +import { ListCompactor } from "../common/ListCompactor"; +import { ReportCard } from "../cards/ReportCard"; + +export function RelevantReports({ + byUser, + forUser, +}: { + byUser: Report[]; + forUser: Report[]; +}) { + return ( +
+
+

Created Reports

+ } + /> +
+
+

Reports Against User

+ } + /> +
+
+ ); +} diff --git a/components/inspector/UserActions.tsx b/components/inspector/UserActions.tsx new file mode 100644 index 0000000..0a243b0 --- /dev/null +++ b/components/inspector/UserActions.tsx @@ -0,0 +1,99 @@ +"use client"; + +import Link from "next/link"; +import { Button, buttonVariants } from "../ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "../ui/dropdown-menu"; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "../ui/alert-dialog"; +import { Input } from "../ui/input"; +import { sendAlert } from "@/lib/actions"; +import { useRef } from "react"; + +export function UserActions({ id }: { id: string }) { + const alertMessage = useRef(""); + + return ( +
+ + Account + + + + + + + + + + + { + throw "Cancel immediate propagation."; + }} + > + Send Alert + + + + + Send Alert + + + This will send a message from the Platform Moderation + account. + + + (alertMessage.current = e.currentTarget.value) + } + /> + + + + Cancel + { + if (!alertMessage.current) return; + sendAlert(id, alertMessage.current); + alertMessage.current = ""; + }} + > + Send + + + + + + Inspect Messages + Wipe Messages + Clear Friends + + +
+ ); +}