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
+3 -3
View File
@@ -24,7 +24,7 @@ export interface SummaryDocument {
title?: string | null;
original_name?: string | null;
filename?: string | null;
content_type?: string | null;
mime_type?: string | null;
folder_id?: string | null;
folder_name?: string;
current_version?: DocumentVersion | null;
@@ -72,7 +72,7 @@ export interface MetadataDocumentLike {
updated_at?: string | null;
filename?: string | null;
original_name?: string | null;
content_type?: string | null;
mime_type?: string | null;
metadata?: DocumentMetadataPayload | null;
current_version?: { checksum?: string | null } | null;
}
@@ -105,7 +105,7 @@ export const describeDocumentSummary = (document?: SummaryDocument | null, optio
{ key: 'updated', label: 'Updated at', value: formatDateLabel(doc.updated_at) },
{ key: 'folder', label: 'Folder', value: folderLabel, kind: 'folder' },
{ key: 'size', label: 'Size', value: sizeLabel },
{ key: 'content-type', label: 'Content type', value: doc.content_type || 'Unknown' },
{ key: 'mime-type', label: 'MIME type', value: doc.mime_type || 'Unknown' },
{ key: 'pages', label: 'Pages', value: pageCountLabel },
{ key: 'filename', label: 'Filename', value: doc.filename },
{ key: 'original-filename', label: 'Original filename', value: doc.original_name },
@@ -5,7 +5,7 @@ type Identifier = string | number;
interface DocumentLinkLike {
url?: string | null;
contentType?: string | null;
mimeType?: string | null;
}
export interface Breadcrumb {
@@ -38,7 +38,7 @@ interface DocumentsPanelProps extends DocumentsPanelInnerProps {
const defaultGetDocumentAsset = (_doc?: unknown, _type?: string) => null;
export type DocumentLinkLike = { url?: string | null; contentType?: string | null };
export type DocumentLinkLike = { url?: string | null; mimeType?: string | null };
const DocumentsPanelInner: React.FC<DocumentsPanelInnerProps> = ({
headerLeading = null,
@@ -257,7 +257,7 @@ const DocumentsPanelInner: React.FC<DocumentsPanelInnerProps> = ({
const isDeskView = viewMode === 'desk';
type Identifier = string | number;
type ZoomSource = { url: string; alt?: string | null; contentType?: string | null };
type ZoomSource = { url: string; alt?: string | null; mimeType?: string | null };
const [previewDocId, setPreviewDocId] = useState<Identifier | null>(null);
@@ -290,9 +290,7 @@ const DocumentsPanelInner: React.FC<DocumentsPanelInnerProps> = ({
cancelled = true;
};
}
const docContentType = previewDoc.content_type;
const versionContentType = previewDoc.current_version?.content_type;
const contentFallback = docContentType || versionContentType || null;
const documentMimeType = previewDoc.mime_type;
const applyEntry = (entry?: DocumentLinkLike | null) => {
if (!entry?.url) {
@@ -302,7 +300,7 @@ const DocumentsPanelInner: React.FC<DocumentsPanelInnerProps> = ({
setPreviewZoomSource({
url: entry.url,
alt: previewDoc.title,
contentType: entry.contentType || contentFallback || undefined,
mimeType: documentMimeType,
});
};