forked from administration/panel
feat: warning banner on restricted users
parent
0210d385aa
commit
543baee97f
|
@ -24,6 +24,7 @@ import { User } from "revolt-api";
|
||||||
import { decodeTime } from "ulid";
|
import { decodeTime } from "ulid";
|
||||||
import relativeTime from "dayjs/plugin/relativeTime";
|
import relativeTime from "dayjs/plugin/relativeTime";
|
||||||
import SafetyNotesCard from "@/components/cards/SafetyNotesCard";
|
import SafetyNotesCard from "@/components/cards/SafetyNotesCard";
|
||||||
|
import { RestrictedUserCard } from "@/components/cards/RestrictedUserCard";
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
|
@ -41,6 +42,8 @@ export default async function User({
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<NavigationToolbar>Inspecting Account</NavigationToolbar>
|
<NavigationToolbar>Inspecting Account</NavigationToolbar>
|
||||||
|
|
||||||
|
<RestrictedUserCard id={params.id} />
|
||||||
{user && <UserCard user={user} subtitle={`${account.email} · Created ${dayjs(decodeTime(account._id)).fromNow()}`} withLink />}
|
{user && <UserCard user={user} subtitle={`${account.email} · Created ${dayjs(decodeTime(account._id)).fromNow()}`} withLink />}
|
||||||
<AccountActions account={account} user={user as User} />
|
<AccountActions account={account} user={user as User} />
|
||||||
<EmailClassificationCard email={account.email} />
|
<EmailClassificationCard email={account.email} />
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { notFound } from "next/navigation";
|
||||||
import { Bot } from "revolt-api";
|
import { Bot } from "revolt-api";
|
||||||
import relativeTime from "dayjs/plugin/relativeTime";
|
import relativeTime from "dayjs/plugin/relativeTime";
|
||||||
import { decodeTime } from "ulid";
|
import { decodeTime } from "ulid";
|
||||||
|
import { RestrictedUserCard } from "@/components/cards/RestrictedUserCard";
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
|
@ -80,6 +81,7 @@ export default async function User({
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<NavigationToolbar>Inspecting User</NavigationToolbar>
|
<NavigationToolbar>Inspecting User</NavigationToolbar>
|
||||||
|
|
||||||
|
<RestrictedUserCard id={user._id} />
|
||||||
<UserCard user={user} subtitle={`Joined ${dayjs(decodeTime(user._id)).fromNow()} · ${user.status?.text ?? "No status set"}`} />
|
<UserCard user={user} subtitle={`Joined ${dayjs(decodeTime(user._id)).fromNow()} · ${user.status?.text ?? "No status set"}`} />
|
||||||
<UserActions user={user} bot={bot as Bot} />
|
<UserActions user={user} bot={bot as Bot} />
|
||||||
<SafetyNotesCard objectId={user._id} type="user" />
|
<SafetyNotesCard objectId={user._id} type="user" />
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { RESTRICT_ACCESS_LIST } from "@/lib/constants";
|
||||||
|
import { User } from "revolt-api";
|
||||||
|
import { Card } from "../ui/card";
|
||||||
|
import { AlertCircle } from "lucide-react";
|
||||||
|
|
||||||
|
export function RestrictedUserCard({ id }: { id: string | null | undefined }) {
|
||||||
|
if (!id || !RESTRICT_ACCESS_LIST.includes(id)) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
className="p-2 bg-red-500 text-white flex flex-row gap-2"
|
||||||
|
>
|
||||||
|
<AlertCircle />
|
||||||
|
Destructive actions are disabled for this user
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue