Move toasts to sonner (#6053)
This commit is contained in:
@@ -2,6 +2,7 @@ import { observer } from "mobx-react";
|
||||
import * as React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMenuState } from "reakit/Menu";
|
||||
import { toast } from "sonner";
|
||||
import User from "~/models/User";
|
||||
import ContextMenu from "~/components/ContextMenu";
|
||||
import OverflowMenuButton from "~/components/ContextMenu/OverflowMenuButton";
|
||||
@@ -18,7 +19,6 @@ import { deleteUserActionFactory } from "~/actions/definitions/users";
|
||||
import useActionContext from "~/hooks/useActionContext";
|
||||
import usePolicy from "~/hooks/usePolicy";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import useToasts from "~/hooks/useToasts";
|
||||
|
||||
type Props = {
|
||||
user: User;
|
||||
@@ -31,7 +31,6 @@ function UserMenu({ user }: Props) {
|
||||
modal: true,
|
||||
});
|
||||
const can = usePolicy(user.id);
|
||||
const { showToast } = useToasts();
|
||||
const context = useActionContext({
|
||||
isContextMenu: true,
|
||||
});
|
||||
@@ -129,17 +128,14 @@ function UserMenu({ user }: Props) {
|
||||
|
||||
try {
|
||||
await users.resendInvite(user);
|
||||
showToast(t(`Invite was resent to ${user.name}`), { type: "success" });
|
||||
toast.success(t(`Invite was resent to ${user.name}`));
|
||||
} catch (err) {
|
||||
showToast(
|
||||
err.message ?? t(`An error occurred while sending the invite`),
|
||||
{
|
||||
type: "error",
|
||||
}
|
||||
toast.error(
|
||||
err.message ?? t(`An error occurred while sending the invite`)
|
||||
);
|
||||
}
|
||||
},
|
||||
[users, user, t, showToast]
|
||||
[users, user, t]
|
||||
);
|
||||
|
||||
const handleActivate = React.useCallback(
|
||||
|
||||
Reference in New Issue
Block a user