diff --git a/components/pages/inspector/UserActions.tsx b/components/pages/inspector/UserActions.tsx index cee89ca..92a8ca1 100644 --- a/components/pages/inspector/UserActions.tsx +++ b/components/pages/inspector/UserActions.tsx @@ -35,6 +35,7 @@ import { Bot, User } from "revolt-api"; import { Card, CardHeader } from "../../ui/card"; import { cn } from "@/lib/utils"; import { decodeTime } from "ulid"; +import { Checkbox } from "@/components/ui/checkbox"; const badges = [1, 2, 4, 8, 16, 32, 128, 0, 256, 512, 1024]; @@ -44,6 +45,13 @@ export function UserActions({ user, bot }: { user: User; bot?: Bot }) { const [userDraft, setUserDraft] = useState(user); const [botDraft, setBotDraft] = useState(bot); + const [wipeDraft, setWipeDraft] = useState({ + banner: false, + avatar: false, + bio: false, + displayName: false, + status: false, + }); const userInaccessible = userDraft.flags === 4 || userDraft.flags === 2; @@ -324,6 +332,45 @@ export function UserActions({ user, bot }: { user: User; bot?: Bot }) { + + + + + + + + Reset user profile + + + setWipeDraft({ ...wipeDraft, bio: e == true })}> + Bio + + setWipeDraft({ ...wipeDraft, status: e == true })}> + Status + + setWipeDraft({ ...wipeDraft, displayName: e == true })}> + Display Name + + setWipeDraft({ ...wipeDraft, avatar: e == true })}> + Avatar + + setWipeDraft({ ...wipeDraft, banner: e == true })}> + Profile Banner + + + + + Cancel + i).length} + onClick={() => { + toast({ title: "todo" }) + }} + >Reset + + + + diff --git a/components/ui/checkbox.tsx b/components/ui/checkbox.tsx new file mode 100644 index 0000000..0f39913 --- /dev/null +++ b/components/ui/checkbox.tsx @@ -0,0 +1,46 @@ +"use client" + +import { cn } from '@/lib/utils'; +import * as CheckBox from '@radix-ui/react-checkbox'; +import { CheckIcon } from 'lucide-react'; + +const Checkbox = (props: { + children: React.ReactNode, + checked?: boolean, + onChange?: (checked: CheckBox.CheckedState) => void, +}) => { + // good enough i guess + const checkId = `${Date.now()}${Math.random()}`; + + return ( +
+ + + + + + +
+ ); +} + +export { Checkbox } diff --git a/package.json b/package.json index 94eefc7..33f05fd 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "@radix-ui/react-alert-dialog": "^1.0.4", "@radix-ui/react-avatar": "^1.0.3", + "@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-dialog": "^1.0.4", "@radix-ui/react-dropdown-menu": "^2.0.5", "@radix-ui/react-label": "^2.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8477e20..8c649f3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,5 +1,9 @@ lockfileVersion: '6.0' +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + dependencies: '@radix-ui/react-alert-dialog': specifier: ^1.0.4 @@ -7,6 +11,9 @@ dependencies: '@radix-ui/react-avatar': specifier: ^1.0.3 version: 1.0.3(@types/react-dom@18.2.7)(@types/react@18.2.15)(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-checkbox': + specifier: ^1.0.4 + version: 1.0.4(@types/react-dom@18.2.7)(@types/react@18.2.15)(react-dom@18.2.0)(react@18.2.0) '@radix-ui/react-dialog': specifier: ^1.0.4 version: 1.0.4(@types/react-dom@18.2.7)(@types/react@18.2.15)(react-dom@18.2.0)(react@18.2.0) @@ -477,6 +484,34 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: false + /@radix-ui/react-checkbox@1.0.4(@types/react-dom@18.2.7)(@types/react@18.2.15)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-CBuGQa52aAYnADZVt/KBQzXrwx6TqnlwtcIPGtVt5JkkzQwMOLJjPukimhfKEr4GQNd43C+djUh5Ikopj8pSLg==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 + react-dom: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + dependencies: + '@babel/runtime': 7.22.6 + '@radix-ui/primitive': 1.0.1 + '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.15)(react@18.2.0) + '@radix-ui/react-context': 1.0.1(@types/react@18.2.15)(react@18.2.0) + '@radix-ui/react-presence': 1.0.1(@types/react-dom@18.2.7)(@types/react@18.2.15)(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.7)(@types/react@18.2.15)(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-use-controllable-state': 1.0.1(@types/react@18.2.15)(react@18.2.0) + '@radix-ui/react-use-previous': 1.0.1(@types/react@18.2.15)(react@18.2.0) + '@radix-ui/react-use-size': 1.0.1(@types/react@18.2.15)(react@18.2.0) + '@types/react': 18.2.15 + '@types/react-dom': 18.2.7 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + /@radix-ui/react-collection@1.0.3(@types/react-dom@18.2.7)(@types/react@18.2.15)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-3SzW+0PW7yBBoQlT8wNcGtaxaD0XSu0uLUFgrtHY08Acx05TaHaOmVLR73c0j/cqpDy53KBMO7s0dx2wmOIDIA==} peerDependencies: @@ -1203,6 +1238,20 @@ packages: react: 18.2.0 dev: false + /@radix-ui/react-use-previous@1.0.1(@types/react@18.2.15)(react@18.2.0): + resolution: {integrity: sha512-cV5La9DPwiQ7S0gf/0qiD6YgNqM5Fk97Kdrlc5yBcrF3jyEZQwm7vYFqMo4IfeHgJXsRaMvLABFtd0OVEmZhDw==} + peerDependencies: + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + '@types/react': + optional: true + dependencies: + '@babel/runtime': 7.22.6 + '@types/react': 18.2.15 + react: 18.2.0 + dev: false + /@radix-ui/react-use-rect@1.0.1(@types/react@18.2.15)(react@18.2.0): resolution: {integrity: sha512-Cq5DLuSiuYVKNU8orzJMbl15TXilTnJKUCltMVQg53BQOF1/C5toAaGrowkgksdBQ9H+SRL23g0HDmg9tvmxXw==} peerDependencies: