This commit is contained in:
2025-11-16 21:08:07 +01:00
parent 4b9f74d5a8
commit 1f2c62241c
6 changed files with 82 additions and 142 deletions
+14 -5
View File
@@ -39,6 +39,11 @@ interface DocumentLike {
version_number?: number;
version?: { content_type?: string | null } | null;
} | null;
previewEntry?: {
url: string;
alt?: string;
contentType?: string | null;
} | null;
[key: string]: unknown;
}
@@ -53,10 +58,8 @@ interface DocumentViewerPanelProps extends DocumentSummarySectionProps {
document: DocumentLike | null;
previewEntry?: {
url?: string;
canGoPrev?: boolean;
canGoNext?: boolean;
goPrev?: () => void;
goNext?: () => void;
contentType?: string | null;
filename?: string | null;
} | null;
hydrateDocument?: (doc: DocumentLike | null) => DocumentLike | null;
ensureAssetUrl?: (docId: string | number, asset: AssetLike, options?: { start?: number; limit?: number }) => Promise<unknown>;
@@ -490,10 +493,16 @@ const DocumentViewerPanel: React.FC<DocumentViewerPanelProps> = ({
document?.title || 'Document preview'
);
const overlayDocument = useMemo(() => (
document && zoomDisplay?.url
? { ...document, previewEntry: zoomDisplay }
: document
), [document, zoomDisplay]);
const overlay = (
<PreviewZoomOverlay
open={Boolean(zoomOverlayOpen && zoomDisplay)}
display={zoomDisplay}
document={overlayDocument}
onClose={handleZoomClose}
/>
);