Move toasts to sonner (#6053)

This commit is contained in:
Tom Moor
2023-10-22 17:30:24 -04:00
committed by GitHub
parent 389297a337
commit ef76405bd6
92 changed files with 363 additions and 1015 deletions

View File

@@ -3,6 +3,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 Comment from "~/models/Comment";
import CommentDeleteDialog from "~/components/CommentDeleteDialog";
import ContextMenu from "~/components/ContextMenu";
@@ -12,7 +13,6 @@ import Separator from "~/components/ContextMenu/Separator";
import EventBoundary from "~/components/EventBoundary";
import usePolicy from "~/hooks/usePolicy";
import useStores from "~/hooks/useStores";
import useToasts from "~/hooks/useToasts";
import { commentPath, urlify } from "~/utils/routeHelpers";
type Props = {
@@ -30,7 +30,6 @@ function CommentMenu({ comment, onEdit, onDelete, className }: Props) {
const menu = useMenuState({
modal: true,
});
const { showToast } = useToasts();
const { documents, dialogs } = useStores();
const { t } = useTranslation();
const can = usePolicy(comment.id);
@@ -47,9 +46,9 @@ function CommentMenu({ comment, onEdit, onDelete, className }: Props) {
const handleCopyLink = React.useCallback(() => {
if (document) {
copy(urlify(commentPath(document, comment)));
showToast(t("Link copied"));
toast.message(t("Link copied"));
}
}, [t, document, comment, showToast]);
}, [t, document, comment]);
return (
<>