Skip to content

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

feat: show preview button for Excel files with advanced mode on document detail page

Cursor Agent41b6d888fe4f
diff --git a/components/documents/document-preview-button.tsx b/components/documents/document-preview-button.tsx
index 77179f62..86d90532 100644
--- a/components/documents/document-preview-button.tsx
+++ b/components/documents/document-preview-button.tsx
@@ -14,6 +14,7 @@ interface DocumentPreviewButtonProps {
type?: string | null;
numPages?: number | null;
};
+ advancedExcelEnabled?: boolean;
isProcessing?: boolean;
variant?: "ghost" | "outline" | "default";
size?: "sm" | "default" | "lg" | "icon";
@@ -25,6 +26,7 @@ interface DocumentPreviewButtonProps {
export function DocumentPreviewButton({
documentId,
primaryVersion,
+ advancedExcelEnabled = false,
isProcessing = false,
variant = "ghost",
size = "icon",
@@ -44,7 +46,9 @@ export function DocumentPreviewButton({
// Support image documents
if (primaryVersion.type === "image") return true;
- // Don't support sheets, notion, videos, etc.
+ // Support Excel sheets with advanced mode enabled
+ if (primaryVersion.type === "sheet" && advancedExcelEnabled) return true;
+
return false;
};
diff --git a/pages/documents/[id]/index.tsx b/pages/documents/[id]/index.tsx
index 63134736..ab702142 100644
--- a/pages/documents/[id]/index.tsx
+++ b/pages/documents/[id]/index.tsx
@@ -167,6 +167,7 @@ export default function DocumentPage() {
key={"preview"}
documentId={prismaDocument.id}
primaryVersion={primaryVersion}
+ advancedExcelEnabled={prismaDocument.advancedExcelEnabled}
variant="outline"
size="default"
showTooltip={false}