Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

chore: send less information to Notification component

Marc Seitz00f3664f7694
diff --git a/components/Notification.tsx b/components/Notification.tsx
index 39408cb3..afc72865 100644
--- a/components/Notification.tsx
+++ b/components/Notification.tsx
@@ -2,13 +2,14 @@ import { CheckCircleIcon } from "@heroicons/react/24/outline";
import { XMarkIcon } from "@heroicons/react/20/solid";
import { Transition } from "@headlessui/react";
import { Fragment } from "react";
+import { Toast } from "react-hot-toast";
export default function Notification({
- t,
+ visible,
closeToast,
message = "Document uploaded and link copied to clipboard.",
}: {
- t: any;
+ visible: boolean;
closeToast: () => void;
message?: string;
}) {
@@ -16,7 +17,7 @@ export default function Notification({
<div className="flex w-full flex-col items-center space-y-4 sm:items-end">
{/* Notification panel, dynamically insert this into the live region when it needs to be displayed */}
<Transition
- show={t.visible}
+ show={visible}
as={Fragment}
enter="transform ease-out duration-300 transition"
enterFrom="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
diff --git a/components/documents/document-card.tsx b/components/documents/document-card.tsx
index 6268fbbe..548831e2 100644
--- a/components/documents/document-card.tsx
+++ b/components/documents/document-card.tsx
@@ -3,6 +3,7 @@ import { ChevronRightIcon } from "@heroicons/react/20/solid";
import { DocumentDuplicateIcon } from "@heroicons/react/24/outline";
import Link from "next/link";
import { DocumentWithLinksAndLinkCount } from "@/lib/types";
+import toast from "react-hot-toast";
import Notification from "@/components/Notification";
export default function DocumentsCard({
@@ -15,6 +16,13 @@ export default function DocumentsCard({
`${process.env.NEXT_PUBLIC_BASE_URL}/view/${id}`
);
+ toast.custom((t) => (
+ <Notification
+ visible={t.visible}
+ closeToast={() => toast.dismiss(t.id)}
+ message={``}
+ />
+ ));
}
return (
diff --git a/pages/documents/[id].tsx b/pages/documents/[id].tsx
index 88981729..3b580894 100644
--- a/pages/documents/[id].tsx
+++ b/pages/documents/[id].tsx
@@ -63,7 +63,11 @@ const DocumentPage = ({
);
toast.custom((t) => (
- <Notification t={t} closeToast={() => toast.dismiss(t.id)} message={``} />
+ <Notification
+ visible={t.visible}
+ closeToast={() => toast.dismiss(t.id)}
+ message={``}
+ />
));
};
diff --git a/pages/documents/new.tsx b/pages/documents/new.tsx
index 6c327922..c50d2506 100644
--- a/pages/documents/new.tsx
+++ b/pages/documents/new.tsx
@@ -63,7 +63,7 @@ export default function Form() {
toast.custom((t) => (
<Notification
- t={t}
+ visible={t.visible}
closeToast={() => toast.dismiss(t.id)}
message={
"Document uploaded and link copied to clipboard. Redirecting to document page..."