From 5b1cd37d6557dc8568fe99aecef62344c0015eda Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Wed, 20 Nov 2024 11:36:41 +0100 Subject: [PATCH] Render `ReaderModal` only when required This ensures that the `ReaderModal` is loaded only when necessary, similar to how the `MaterialButtonReaderTeaser` is rendered. --- src/apps/material/material.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/apps/material/material.tsx b/src/apps/material/material.tsx index ba9a7e2750..2bc173941a 100644 --- a/src/apps/material/material.tsx +++ b/src/apps/material/material.tsx @@ -40,6 +40,7 @@ import { import MaterialDisclosure from "./MaterialDisclosure"; import ReservationFindOnShelfModals from "./ReservationFindOnShelfModals"; import ReaderModal from "../../components/material/Reader-modal/ReaderModal"; +import { hasReaderTeaser } from "../../components/reader-player/helper"; export interface MaterialProps { wid: WorkId; @@ -195,9 +196,11 @@ const Material: React.FC = ({ wid }) => { setSelectedPeriodical={setSelectedPeriodical} /> )} - + {hasReaderTeaser(selectedManifestations) && ( + + )} {/* Since we cannot trust the editions for global manifestations */}