This commit is contained in:
2025-11-22 14:43:05 +01:00
parent 5498cf4342
commit 530218a4b8
9 changed files with 38 additions and 40 deletions
+7 -7
View File
@@ -32,20 +32,20 @@ import { usePanelResizeBindings } from '../app/PanelManagerContext';
interface DocumentLike {
id?: string | number;
title?: string;
content_type?: string | null;
mime_type?: string | null;
issued_at?: string | null;
folder_id?: string | null;
correspondents?: Array<{ id?: string | number; name?: string }>;
current_version?: {
version_number?: number;
download?: { url?: string | null; expires_at?: number } | null;
version?: { content_type?: string | null } | null;
mime_type?: string | null;
filename?: string | null;
} | null;
documentLink?: {
url: string;
alt?: string;
contentType?: string | null;
mimeType?: string | null;
} | null;
[key: string]: unknown;
}
@@ -268,11 +268,11 @@ const DocumentViewerPanel: React.FC<DocumentViewerPanelProps> = ({
if (!href) {
return null;
}
const contentType = document.content_type || null;
const mimeType = document.mime_type;
const filename = document.current_version?.filename || document.filename || document.title || null;
return {
url: href,
contentType,
mimeType,
filename,
};
}, [document, resolveApiPath]);
@@ -363,11 +363,11 @@ const DocumentViewerPanel: React.FC<DocumentViewerPanelProps> = ({
if (!resolvedDocumentLink?.url || !document) {
return null;
}
const normalizedContentType = document.content_type || null;
const normalizedMimeType = document.mime_type;
return {
url: resolvedDocumentLink.url,
alt: document.title,
contentType: normalizedContentType || undefined,
mimeType: normalizedMimeType,
};
}, [document, resolvedDocumentLink?.url]);