feat: Add document download link component, refactor download URL resolution with expiration checks

This commit is contained in:
2025-12-04 23:38:17 +01:00
parent 22e39420bb
commit 86b9ac2ab6
8 changed files with 72 additions and 70 deletions
+3 -2
View File
@@ -2,6 +2,7 @@ import { useCallback, useMemo, useRef } from 'react';
import type { JSX } from 'react';
import DocumentInfoPanel from './components/DocumentInfoPanel';
import UnifiedDocumentViewer from './UnifiedDocumentViewer';
import { resolveDocumentDownloadHref } from '../documents/documentActions';
import type { Document } from '../types/documents';
@@ -56,13 +57,13 @@ const DocumentViewerLayout = ({
const renderViewportPane = useCallback(() => (
<div className="document-viewer__viewport" ref={viewportRef}>
{!document?.current_version?.download?.url ? (
{!resolveDocumentDownloadHref(document) ? (
<div className="document-viewer__message">{previewLoadingMessage}</div>
) : (
previewContent
)}
</div>
), [previewContent, document?.current_version?.download?.url, previewLoadingMessage, viewportRef]);
), [previewContent, document, previewLoadingMessage, viewportRef]);
const viewportPane = renderViewportPane();