playful
This commit is contained in:
@@ -51,7 +51,7 @@ const DocumentViewerPanel = ({
|
||||
{ label: 'Updated at', value: formatDateTime(document.updated_at) },
|
||||
{
|
||||
label: 'Filename',
|
||||
value: document.archive_path || document.filename || '—',
|
||||
value: document.filename,
|
||||
},
|
||||
{
|
||||
label: 'Original filename',
|
||||
@@ -68,19 +68,18 @@ const DocumentViewerPanel = ({
|
||||
];
|
||||
}, [document]);
|
||||
|
||||
const contentType = (document?.content_type || '').toLowerCase();
|
||||
const previewContent = useMemo(() => {
|
||||
if (!previewEntry?.url) {
|
||||
if (!document || !previewEntry?.url) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const title = document?.title || document?.original_name || 'Document';
|
||||
const contentType = (document.content_type || '').toLowerCase();
|
||||
|
||||
if (contentType.startsWith('image/')) {
|
||||
return (
|
||||
<img
|
||||
src={previewEntry.url}
|
||||
alt={`Preview of ${title}`}
|
||||
alt={`Preview of ${document.title}`}
|
||||
className="document-viewer__object document-viewer__object--image"
|
||||
draggable={false}
|
||||
/>
|
||||
@@ -90,11 +89,11 @@ const DocumentViewerPanel = ({
|
||||
return (
|
||||
<iframe
|
||||
src={previewEntry.url}
|
||||
title={`Preview of ${title}`}
|
||||
title={`Preview of ${document.title}`}
|
||||
className="document-viewer__object"
|
||||
/>
|
||||
);
|
||||
}, [previewEntry?.url, contentType, document?.title, document?.original_name]);
|
||||
}, [previewEntry?.url, document]);
|
||||
|
||||
const metadataPayload = useMemo(() => {
|
||||
if (!document || !document.metadata || Object.keys(document.metadata).length === 0) {
|
||||
@@ -411,10 +410,10 @@ export const createDocumentViewerSurface = ({
|
||||
.filter((segment) => segment && segment.id && segment.name)
|
||||
.map((segment) => ({ id: segment.id, name: segment.name }))
|
||||
: [];
|
||||
const documentLabel = document.title || document.original_name || 'Document';
|
||||
|
||||
breadcrumbs = [
|
||||
...normalizedSegments,
|
||||
{ id: document.id || 'current-document', name: documentLabel },
|
||||
{ id: document.id, name: document.title },
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user