From a03c539890a28e519cb6a9955d5bd9e8f87a6be3 Mon Sep 17 00:00:00 2001 From: Lea Date: Tue, 22 Aug 2023 18:02:56 +0200 Subject: [PATCH] feat: quarantine button --- app/panel/inspect/server/[id]/page.tsx | 4 +- components/pages/inspector/ServerActions.tsx | 67 +++++++++++++++-- lib/accessPermissions.ts | 4 +- lib/actions.ts | 75 ++++++++++++++++++++ lib/constants.ts | 4 ++ 5 files changed, 147 insertions(+), 7 deletions(-) diff --git a/app/panel/inspect/server/[id]/page.tsx b/app/panel/inspect/server/[id]/page.tsx index ec414cf..7d38f89 100644 --- a/app/panel/inspect/server/[id]/page.tsx +++ b/app/panel/inspect/server/[id]/page.tsx @@ -36,9 +36,11 @@ export default async function Server({ params }: { params: { id: string } }) { )} - + { + owner && + } diff --git a/components/pages/inspector/ServerActions.tsx b/components/pages/inspector/ServerActions.tsx index 422e1f9..32d1a0d 100644 --- a/components/pages/inspector/ServerActions.tsx +++ b/components/pages/inspector/ServerActions.tsx @@ -14,19 +14,21 @@ import { import { Check, ChevronsUpDown } from "lucide-react"; import { cn } from "@/lib/utils"; import { useState } from "react"; -import { addServerMember, updateServerDiscoverability, updateServerFlags, updateServerOwner } from "@/lib/actions"; +import { addServerMember, quarantineServer, updateServerDiscoverability, updateServerFlags, updateServerOwner } from "@/lib/actions"; import { useToast } from "../../ui/use-toast"; import Link from "next/link"; import { DropdownMenu, DropdownMenuContent } from "@/components/ui/dropdown-menu"; import { DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "@/components/ui/alert-dialog"; -import { Input } from "@/components/ui/input"; import { Checkbox } from "@/components/ui/checkbox"; import UserSelector from "@/components/ui/user-selector"; +import { Textarea } from "@/components/ui/textarea"; +import { SEVRER_REMOVAL_MESSAGE } from "@/lib/constants"; export function ServerActions({ server }: { server: Server }) { const [selectBadges, setSelectBadges] = useState(false); const [serverDraft, setDraft] = useState(server); + const [quarantineMessage, setQuarantineMessage] = useState(SEVRER_REMOVAL_MESSAGE(server)); const [newOwner, setNewOwner] = useState(null); const [newMember, setNewMember] = useState(null); const [newMemberEvent, setNewMemberEvent] = useState(true); @@ -144,9 +146,64 @@ export function ServerActions({ server }: { server: Server }) { Invites - + + + + + + + + Quarantine server + + + This will remove all members from this server and revoke all invites. + This action is irreversible! +
+