feat: add PdfPreviewModal component and integrate into DocumentsTab for centralized PDF viewing

This commit is contained in:
estifanos
2026-08-19 08:48:50 +00:00
parent 2978690669
commit 4d87d41e55
3 changed files with 56 additions and 11 deletions

View File

@@ -34,6 +34,7 @@ import {
type DocumentRequirement,
} from "@ema-platform/api";
import { notifications } from "@mantine/notifications";
import { PdfPreviewModal } from "@ema-platform/ui";
interface DocumentsTabProps {
applicationId: string;
@@ -441,8 +442,20 @@ export function DocumentsTab({
);
})}
<PdfPreviewModal
opened={Boolean(preview) && isPdf}
onClose={() => setPreview(null)}
url={previewFile?.url ?? ""}
title={
preview
? localized(requirementByKey.get(preview.documentKey)?.name) ||
preview.documentKey
: ""
}
/>
<Drawer
opened={Boolean(preview)}
opened={Boolean(preview) && !isPdf}
onClose={() => setPreview(null)}
position="right"
size="xl"
@@ -458,16 +471,7 @@ export function DocumentsTab({
returnFocus
>
{previewFile?.url ? (
isPdf ? (
<iframe
src={previewFile.url}
title={
preview?.documentKey ??
t("review.documents.previewFallback", "document")
}
style={{ width: "100%", height: "80vh", border: "none" }}
/>
) : isImage ? (
isImage ? (
<img
src={previewFile.url}
alt={