From deb8189fcfdf5b651bb9e02d6c9d7af076f7546a Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Mon, 15 Jan 2024 08:33:01 +0100 Subject: [PATCH 1/5] Change the 'Reserve' button text to the standard and move the notice about material ordered from other libraries to the `MaterialAvailabilityTextParagraph`. This will give the user a more streamlined experience while still notifying the user that the material is ordered from another library. --- src/apps/material/material.dev.tsx | 2 +- .../MaterialAvailabilityText.tsx | 13 +++++++++++++ .../MaterialButtonReservableFromAnotherLibrary.tsx | 6 ++---- src/components/reservation/ReservationModalBody.tsx | 12 ++++++++---- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/apps/material/material.dev.tsx b/src/apps/material/material.dev.tsx index 7fed849b7d..33f6c8e234 100644 --- a/src/apps/material/material.dev.tsx +++ b/src/apps/material/material.dev.tsx @@ -86,7 +86,7 @@ export default { }, reservableFromAnotherLibraryText: { name: "Reservable on another library", - defaultValue: "Reservable on another library", + defaultValue: "Ordered from another library.", control: { type: "text" } }, findOnBookshelfText: { diff --git a/src/components/material/MaterialAvailabilityText/MaterialAvailabilityText.tsx b/src/components/material/MaterialAvailabilityText/MaterialAvailabilityText.tsx index aae18fb572..6858690857 100644 --- a/src/components/material/MaterialAvailabilityText/MaterialAvailabilityText.tsx +++ b/src/components/material/MaterialAvailabilityText/MaterialAvailabilityText.tsx @@ -10,17 +10,30 @@ import { Manifestation } from "../../../core/utils/types/entities"; import { hasCorrectAccessType } from "../material-buttons/helper"; import MaterialAvailabilityTextOnline from "./online/MaterialAvailabilityTextOnline"; import MaterialAvailabilityTextPhysical from "./physical/MaterialAvailabilityTextPhysical"; +import useReservableFromAnotherLibrary from "../../../core/utils/useReservableFromAnotherLibrary"; +import MaterialAvailabilityTextParagraph from "./generic/MaterialAvailabilityTextParagraph"; +import { useText } from "../../../core/utils/text"; interface Props { manifestations: Manifestation[]; } const MaterialAvailabilityText: React.FC = ({ manifestations }) => { + const t = useText(); const materialType = head(getMaterialTypes(manifestations)); const isbns = getAllIdentifiers(manifestations); + const reservablePidsFromAnotherLibrary = + useReservableFromAnotherLibrary(manifestations); if (hasCorrectAccessType(AccessTypeCode.Physical, manifestations)) { const pids = getAllPids(manifestations); + if (reservablePidsFromAnotherLibrary.length) { + return ( + + {t("reservableFromAnotherLibraryText")} + + ); + } return ; } diff --git a/src/components/material/material-buttons/physical/MaterialButtonReservableFromAnotherLibrary.tsx b/src/components/material/material-buttons/physical/MaterialButtonReservableFromAnotherLibrary.tsx index 97241373b6..7d6174474f 100644 --- a/src/components/material/material-buttons/physical/MaterialButtonReservableFromAnotherLibrary.tsx +++ b/src/components/material/material-buttons/physical/MaterialButtonReservableFromAnotherLibrary.tsx @@ -40,10 +40,8 @@ const MaterialButtonReservableFromAnotherLibrary: FC< dataCy={dataCy} label={ size === "small" - ? t("reservableFromAnotherLibraryText") - : `${t( - "reservableFromAnotherLibraryText" - )} ${manifestationMaterialType}` + ? t("reserveText") + : `${t("reserveText")} ${manifestationMaterialType}` } buttonType="none" variant="filled" diff --git a/src/components/reservation/ReservationModalBody.tsx b/src/components/reservation/ReservationModalBody.tsx index e725869010..8296cb563d 100644 --- a/src/components/reservation/ReservationModalBody.tsx +++ b/src/components/reservation/ReservationModalBody.tsx @@ -251,10 +251,14 @@ export const ReservationModalBody = ({
- + {reservablePidsFromAnotherLibrary?.length ? ( + t("reservableFromAnotherLibraryText") + ) : ( + + )}