Skip to content

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

docs(download): add toast if someone downloads in preview mode

Marc Seitz689a2322f3e4
diff --git a/components/view/dataroom/nav-dataroom.tsx b/components/view/dataroom/nav-dataroom.tsx
index 385b2984..2c6b869d 100644
--- a/components/view/dataroom/nav-dataroom.tsx
+++ b/components/view/dataroom/nav-dataroom.tsx
@@ -55,7 +55,11 @@ export default function DataroomNav({
const [loading, setLoading] = useState<boolean>(false);
const downloadDataroom = async () => {
- if (!allowDownload || type === "notion" || isPreview) return;
+ if (isPreview) {
+ toast.error("You cannot download datarooms in preview mode.");
+ return;
+ }
+ if (!allowDownload || type === "notion") return;
setLoading(true);
try {
toast.promise(
diff --git a/components/view/nav.tsx b/components/view/nav.tsx
index 127c556d..c2fc89f5 100644
--- a/components/view/nav.tsx
+++ b/components/view/nav.tsx
@@ -78,7 +78,11 @@ export default function Nav({
hasWatermark?: boolean;
}) {
const downloadFile = async () => {
- if (!allowDownload || type === "notion" || isPreview) return;
+ if (isPreview) {
+ toast.error("You cannot download documents in preview mode.");
+ return;
+ }
+ if (!allowDownload || type === "notion") return;
try {
const response = await fetch(`/api/links/download`, {
method: "POST",