Skip to content

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

fix: missing isPreview

Marc Seitzecfe6ddb6c2e
diff --git a/components/NotionPage.tsx b/components/NotionPage.tsx
index fa890c9d..a9145fc5 100644
--- a/components/NotionPage.tsx
+++ b/components/NotionPage.tsx
@@ -140,6 +140,7 @@ export const NotionPage = ({
isDataroom={dataroomId ? true : false}
setDocumentData={setDocumentData}
type="notion"
+ isPreview={isPreview}
/>
<div>
diff --git a/components/view/PagesViewerNew.tsx b/components/view/PagesViewerNew.tsx
index eb2020a6..c69965ed 100644
--- a/components/view/PagesViewerNew.tsx
+++ b/components/view/PagesViewerNew.tsx
@@ -716,6 +716,7 @@ export default function PagesViewer({
viewId={viewId}
submittedFeedback={submittedFeedback}
setSubmittedFeedback={setSubmittedFeedback}
+ isPreview={isPreview}
/>
</div>
) : null}
@@ -795,7 +796,11 @@ export default function PagesViewer({
</>
)}
{feedbackEnabled && pageNumber <= numPages ? (
- <Toolbar viewId={viewId} pageNumber={pageNumber} />
+ <Toolbar
+ viewId={viewId}
+ pageNumber={pageNumber}
+ isPreview={isPreview}
+ />
) : null}
{screenshotProtectionEnabled ? <ScreenProtector /> : null}
{showPoweredByBanner ? <PoweredBy linkId={linkId} /> : null}
diff --git a/components/view/question.tsx b/components/view/question.tsx
index 5d8f5724..f7b134b6 100644
--- a/components/view/question.tsx
+++ b/components/view/question.tsx
@@ -11,17 +11,26 @@ export default function Question({
viewId,
submittedFeedback,
setSubmittedFeedback,
+ isPreview,
}: {
feedback: { id: string; data: { question: string; type: string } };
- viewId: string;
+ viewId?: string;
submittedFeedback: boolean;
setSubmittedFeedback: (submittedFeedback: boolean) => void;
+ isPreview?: boolean;
}) {
const [answer, setAnswer] = useState<"yes" | "no" | "">("");
const handleQuestionSubmit = async (answer: string) => {
if (answer === "") return;
+ // If in preview mode, skip recording the answer
+ if (isPreview) {
+ setAnswer(answer as "yes" | "no");
+ setSubmittedFeedback(true);
+ return;
+ }
+
const response = await fetch(`/api/feedback`, {
method: "POST",
headers: { "Content-Type": "application/json" },
diff --git a/components/view/toolbar.tsx b/components/view/toolbar.tsx
index 92c139d4..b1e2ca5f 100644
--- a/components/view/toolbar.tsx
+++ b/components/view/toolbar.tsx
@@ -10,9 +10,11 @@ import GripVertical from "../shared/icons/grip-vertical";
export default function Toolbar({
viewId,
pageNumber,
+ isPreview,
}: {
- viewId: string;
+ viewId?: string;
pageNumber: number;
+ isPreview?: boolean;
}) {
const [currentEmoji, setCurrentEmoji] = useState<{
emoji: string;
@@ -46,6 +48,9 @@ export default function Toolbar({
setCurrentEmoji(null);
}, 3000); // Adjust this duration to match your animation
+ // skip recording reactions if in preview mode
+ if (isPreview) return;
+
await fetch("/api/record_reaction", {
method: "POST",
headers: {
diff --git a/components/view/viewer/advanced-excel-viewer.tsx b/components/view/viewer/advanced-excel-viewer.tsx
index 7840d83d..a430d3e9 100644
--- a/components/view/viewer/advanced-excel-viewer.tsx
+++ b/components/view/viewer/advanced-excel-viewer.tsx
@@ -110,6 +110,7 @@ export default function AdvancedExcelViewer({
isDataroom={dataroomId ? true : false}
setDocumentData={setDocumentData}
type="sheet"
+ isPreview={isPreview}
/>
<div
style={{ height: "calc(100dvh - 64px)" }}
diff --git a/components/view/viewer/excel-viewer.tsx b/components/view/viewer/excel-viewer.tsx
index ec304f7d..376fe0b6 100644
--- a/components/view/viewer/excel-viewer.tsx
+++ b/components/view/viewer/excel-viewer.tsx
@@ -51,6 +51,7 @@ export default function ExcelViewer({
brand,
dataroomId,
setDocumentData,
+ isPreview,
}: {
linkId: string;
viewId?: string;
@@ -224,6 +225,7 @@ export default function ExcelViewer({
isDataroom={dataroomId ? true : false}
setDocumentData={setDocumentData}
type="sheet"
+ isPreview={isPreview}
/>
<div
style={{ height: "calc(100dvh - 64px)" }}