feat: Add document download link component, refactor download URL resolution with expiration checks
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user