Skip to content

Commit

Permalink
Render ReaderModal only when required
Browse files Browse the repository at this point in the history
This ensures that the `ReaderModal` is loaded only when necessary, similar to how the `MaterialButtonReaderTeaser` is rendered.
  • Loading branch information
kasperbirch1 committed Nov 20, 2024
1 parent 256b15d commit 5b1cd37
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/apps/material/material.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -195,9 +196,11 @@ const Material: React.FC<MaterialProps> = ({ wid }) => {
setSelectedPeriodical={setSelectedPeriodical}
/>
)}
<ReaderModal
identifier={getManifestationIsbn(selectedManifestations[0])}
/>
{hasReaderTeaser(selectedManifestations) && (
<ReaderModal
identifier={getManifestationIsbn(selectedManifestations[0])}
/>
)}
</MaterialHeader>
<MaterialDescription pid={pid} work={work} />
{/* Since we cannot trust the editions for global manifestations */}
Expand Down

0 comments on commit 5b1cd37

Please sign in to comment.