forked from administration/panel
fix: remove unnecessary toast description
parent
a896884593
commit
1d8bc5f301
|
@ -47,12 +47,12 @@ export function UserActions({ user, bot }: { user: User; bot?: Bot }) {
|
||||||
const [userDraft, setUserDraft] = useState(user);
|
const [userDraft, setUserDraft] = useState(user);
|
||||||
const [botDraft, setBotDraft] = useState(bot);
|
const [botDraft, setBotDraft] = useState(bot);
|
||||||
const [wipeDraft, setWipeDraft] = useState({
|
const [wipeDraft, setWipeDraft] = useState({
|
||||||
banner: false,
|
banner: false,
|
||||||
avatar: false,
|
avatar: false,
|
||||||
bio: false,
|
bio: false,
|
||||||
displayName: false,
|
displayName: false,
|
||||||
status: false,
|
status: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const userInaccessible = userDraft.flags === 4 || userDraft.flags === 2;
|
const userInaccessible = userDraft.flags === 4 || userDraft.flags === 2;
|
||||||
|
|
||||||
|
@ -88,9 +88,6 @@ export function UserActions({ user, bot }: { user: User; bot?: Bot }) {
|
||||||
setUserDraft((user) => ({ ...user!, badges }));
|
setUserDraft((user) => ({ ...user!, badges }));
|
||||||
toast({
|
toast({
|
||||||
title: "Updated user badges",
|
title: "Updated user badges",
|
||||||
description: result.updatePublished
|
|
||||||
? undefined
|
|
||||||
: "Failed to publish event, users will need to reload to see the change",
|
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast({
|
toast({
|
||||||
|
@ -258,17 +255,11 @@ export function UserActions({ user, bot }: { user: User; bot?: Bot }) {
|
||||||
|
|
||||||
<AlertDialog>
|
<AlertDialog>
|
||||||
<AlertDialogTrigger asChild>
|
<AlertDialogTrigger asChild>
|
||||||
<Button
|
<Button className="flex-1 bg-yellow-600">Bees</Button>
|
||||||
className="flex-1 bg-yellow-600"
|
|
||||||
>
|
|
||||||
Bees
|
|
||||||
</Button>
|
|
||||||
</AlertDialogTrigger>
|
</AlertDialogTrigger>
|
||||||
<AlertDialogContent>
|
<AlertDialogContent>
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>
|
<AlertDialogTitle>Release the bees</AlertDialogTitle>
|
||||||
Release the bees
|
|
||||||
</AlertDialogTitle>
|
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
Are you sure you want to send the bees?
|
Are you sure you want to send the bees?
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
|
@ -342,23 +333,46 @@ export function UserActions({ user, bot }: { user: User; bot?: Bot }) {
|
||||||
</AlertDialogTrigger>
|
</AlertDialogTrigger>
|
||||||
<AlertDialogContent>
|
<AlertDialogContent>
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>
|
<AlertDialogTitle>Reset user profile</AlertDialogTitle>
|
||||||
Reset user profile
|
|
||||||
</AlertDialogTitle>
|
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
<Checkbox checked={wipeDraft.avatar} onChange={(e) => setWipeDraft({ ...wipeDraft, avatar: e == true })}>
|
<Checkbox
|
||||||
|
checked={wipeDraft.avatar}
|
||||||
|
onChange={(e) =>
|
||||||
|
setWipeDraft({ ...wipeDraft, avatar: e == true })
|
||||||
|
}
|
||||||
|
>
|
||||||
Avatar
|
Avatar
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox checked={wipeDraft.banner} onChange={(e) => setWipeDraft({ ...wipeDraft, banner: e == true })}>
|
<Checkbox
|
||||||
|
checked={wipeDraft.banner}
|
||||||
|
onChange={(e) =>
|
||||||
|
setWipeDraft({ ...wipeDraft, banner: e == true })
|
||||||
|
}
|
||||||
|
>
|
||||||
Profile Banner
|
Profile Banner
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox checked={wipeDraft.displayName} onChange={(e) => setWipeDraft({ ...wipeDraft, displayName: e == true })}>
|
<Checkbox
|
||||||
|
checked={wipeDraft.displayName}
|
||||||
|
onChange={(e) =>
|
||||||
|
setWipeDraft({ ...wipeDraft, displayName: e == true })
|
||||||
|
}
|
||||||
|
>
|
||||||
Display Name
|
Display Name
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox checked={wipeDraft.bio} onChange={(e) => setWipeDraft({ ...wipeDraft, bio: e == true })}>
|
<Checkbox
|
||||||
|
checked={wipeDraft.bio}
|
||||||
|
onChange={(e) =>
|
||||||
|
setWipeDraft({ ...wipeDraft, bio: e == true })
|
||||||
|
}
|
||||||
|
>
|
||||||
Bio
|
Bio
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox checked={wipeDraft.status} onChange={(e) => setWipeDraft({ ...wipeDraft, status: e == true })}>
|
<Checkbox
|
||||||
|
checked={wipeDraft.status}
|
||||||
|
onChange={(e) =>
|
||||||
|
setWipeDraft({ ...wipeDraft, status: e == true })
|
||||||
|
}
|
||||||
|
>
|
||||||
Status
|
Status
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
|
@ -366,27 +380,33 @@ export function UserActions({ user, bot }: { user: User; bot?: Bot }) {
|
||||||
<AlertDialogFooter>
|
<AlertDialogFooter>
|
||||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||||
<AlertDialogAction
|
<AlertDialogAction
|
||||||
disabled={!Object.values(wipeDraft).filter(i => i).length}
|
disabled={!Object.values(wipeDraft).filter((i) => i).length}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
wipeUserProfile(user._id, wipeDraft)
|
wipeUserProfile(user._id, wipeDraft)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toast({ title: "Wiped selected fields" });
|
toast({ title: "Wiped selected fields" });
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
})
|
||||||
.catch((e) => toast({
|
.catch((e) =>
|
||||||
title: "Failed to wipe profile",
|
toast({
|
||||||
description: String(e),
|
title: "Failed to wipe profile",
|
||||||
variant: "destructive",
|
description: String(e),
|
||||||
}))
|
variant: "destructive",
|
||||||
.finally(() => setWipeDraft({
|
})
|
||||||
avatar: false,
|
)
|
||||||
banner: false,
|
.finally(() =>
|
||||||
bio: false,
|
setWipeDraft({
|
||||||
displayName: false,
|
avatar: false,
|
||||||
status: false,
|
banner: false,
|
||||||
}));
|
bio: false,
|
||||||
|
displayName: false,
|
||||||
|
status: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
>Reset</AlertDialogAction>
|
>
|
||||||
|
Reset
|
||||||
|
</AlertDialogAction>
|
||||||
</AlertDialogFooter>
|
</AlertDialogFooter>
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
</AlertDialog>
|
</AlertDialog>
|
||||||
|
|
Loading…
Reference in New Issue