mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-02 00:14:23 +00:00
feat: add office document fixtures to demo Files and a word-document icon (doc/docx/odt/rtf)
This commit is contained in:
@@ -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 <TerminalIcon className={`${cls} text-red-500`} />;
|
||||
if (isSpreadsheetFile(name)) return <FileSpreadsheet className={`${cls} text-green-600`} />;
|
||||
if (isPresentationFile(name)) return <Presentation className={`${cls} text-orange-600`} />;
|
||||
if (isWordDocumentFile(name)) return <FileText className={`${cls} text-blue-600`} />;
|
||||
if (isFontFile(name)) return <TypeIcon className={`${cls} text-indigo-500`} />;
|
||||
if (isDatabaseFile(name)) return <Database className={`${cls} text-slate-500`} />;
|
||||
if (isPdfFile(name)) return <FileText className={`${cls} text-red-600`} />;
|
||||
|
||||
@@ -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),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user