diff --git a/components/files/file-browser.tsx b/components/files/file-browser.tsx index ff2bc5a90..b31495e3c 100644 --- a/components/files/file-browser.tsx +++ b/components/files/file-browser.tsx @@ -197,6 +197,12 @@ function isPresentationFile(name: string): boolean { return PRESENTATION_EXTENSIONS.has(ext); } +const WORD_DOCUMENT_EXTENSIONS = new Set(["doc", "docx", "odt", "rtf"]); +function isWordDocumentFile(name: string): boolean { + const ext = name.split(".").pop()?.toLowerCase() || ""; + return WORD_DOCUMENT_EXTENSIONS.has(ext); +} + const FONT_EXTENSIONS = new Set(["ttf", "otf", "woff", "woff2", "eot"]); function isFontFile(name: string): boolean { const ext = name.split(".").pop()?.toLowerCase() || ""; @@ -224,6 +230,7 @@ function getFileIconByName(name: string, size: "sm" | "lg") { if (isExecutableFile(name)) return ; if (isSpreadsheetFile(name)) return ; if (isPresentationFile(name)) return ; + if (isWordDocumentFile(name)) return ; if (isFontFile(name)) return ; if (isDatabaseFile(name)) return ; if (isPdfFile(name)) return ; diff --git a/lib/demo/fixtures/files.ts b/lib/demo/fixtures/files.ts index 59720d154..63a285224 100644 --- a/lib/demo/fixtures/files.ts +++ b/lib/demo/fixtures/files.ts @@ -57,6 +57,48 @@ export function createDemoFileNodes(): FileNode[] { modified: demoDate(-1), }, + // Office documents (openable in a WOPI editor when one is configured, #425) + { + id: 'demo-file-project-proposal', + parentId: 'demo-file-documents', + name: 'project-proposal.odt', + type: 'application/vnd.oasis.opendocument.text', + blobId: 'demo-blob-file-7', + size: 24576, + created: demoDate(-12), + modified: demoDate(-4), + }, + { + id: 'demo-file-contract-draft', + parentId: 'demo-file-documents', + name: 'contract-draft.docx', + type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + blobId: 'demo-blob-file-8', + size: 38912, + created: demoDate(-9), + modified: demoDate(-2), + }, + { + id: 'demo-file-team-timesheet', + parentId: 'demo-file-documents', + name: 'team-timesheet.ods', + type: 'application/vnd.oasis.opendocument.spreadsheet', + blobId: 'demo-blob-file-9', + size: 17408, + created: demoDate(-6), + modified: demoDate(-1), + }, + { + id: 'demo-file-roadmap-presentation', + parentId: 'demo-file-documents', + name: 'roadmap-presentation.odp', + type: 'application/vnd.oasis.opendocument.presentation', + blobId: 'demo-blob-file-10', + size: 245760, + created: demoDate(-16), + modified: demoDate(-8), + }, + // Photos contents { id: 'demo-file-vacation', @@ -79,7 +121,7 @@ export function createDemoFileNodes(): FileNode[] { modified: demoDate(-21), }, - // Root-level file + // Root-level files { id: 'demo-file-budget', parentId: null, @@ -90,5 +132,15 @@ export function createDemoFileNodes(): FileNode[] { created: demoDate(-5), modified: demoDate(-1), }, + { + id: 'demo-file-launch-deck', + parentId: null, + name: 'product-launch.pptx', + type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + blobId: 'demo-blob-file-11', + size: 512000, + created: demoDate(-4), + modified: demoDate(-3), + }, ]; }