Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reservation button fix #1335

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export function LocalizationInformation({
>{`${pickupBranch?.postalCode} ${pickupBranch?.city}`}</Text>
</div>
)}

{/* maybe move warning together with warning in order-modal. see bibdk2021-1927 */}
{!isLoadingBranches &&
pickupBranch &&
Expand Down
2 changes: 1 addition & 1 deletion src/components/hooks/useOrderPageInformations.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function useOrderPageInformation({
return inferAccessTypes(
periodicaForm,
pickupBranch,
workData?.work?.manifestations?.mostRelevant,
workData?.work?.manifestations?.all,
loanerInfo
);
}, [workData?.work, periodicaForm, pickupBranch]);
Expand Down
8 changes: 2 additions & 6 deletions src/components/hooks/useWorkAndSelectedPids.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ export function useGetManifestationsForOrderButton(workId, selectedPids) {
const workResponse = useData(workId && workFragments.buttonTxt({ workId }));

const allPids = useMemo(() => {
return workResponse?.data?.work?.manifestations?.mostRelevant?.flatMap(
return workResponse?.data?.work?.manifestations?.all?.flatMap(
(manifestation) => manifestation.pid
);
}, [
workId,
selectedPids,
workResponse?.data?.work?.manifestations?.mostRelevant,
]);
}, [workId, selectedPids, workResponse?.data?.work?.manifestations?.all]);

const manifestationsResponse = useData(
allPids &&
Expand Down
2 changes: 1 addition & 1 deletion src/components/work/overview/Overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function Overview({
className = "",
skeleton = false,
}) {
const manifestations = work?.manifestations?.mostRelevant;
const manifestations = work?.manifestations?.all;
const router = useRouter();

const { uniqueMaterialTypes, inUniqueMaterialTypes, flatPidsByType } =
Expand Down
2 changes: 1 addition & 1 deletion src/components/work/reservationbutton/ReservationButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const ReservationButton = ({
modal,
handleOrderFinished = undefined,
}) => {
const physicalCopy = checkPhysicalCopy([access?.[0]])?.[0]; //TODO why do we check all accesses if only one is used in the end?
const physicalCopy = checkPhysicalCopy(access)?.[0]; //TODO why do we check all accesses if only one is used in the end?
const digitalCopy = checkDigitalCopy([access?.[0]])?.[0]; //TODO why do we check all accesses if only one is used in the end?

const noSelectedManifestations = Boolean(isEmpty(access));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import useUser from "@/components/hooks/useUser";
* @returns {React.ReactElement|null}
*/
function OrderButtonTextBelow({ access, skeleton }) {
const physicalCopy = checkPhysicalCopy([access?.[0]])?.[0];
const physicalCopy = checkPhysicalCopy(access)?.[0];
const digitalCopy = checkDigitalCopy([access?.[0]])?.[0];
const isPeriodicaLike = getAreAccessesPeriodicaLike([access?.[0]])?.[0];

Expand Down
7 changes: 5 additions & 2 deletions src/lib/api/work.fragments.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ export function buttonTxt({ workId }) {
manifestations {
all {
pid
materialTypes {
...materialTypesFragment
}
}
mostRelevant {
pid
Expand Down Expand Up @@ -766,7 +769,7 @@ export function orderPageWorkWithManifestations({ workId }) {
}
workTypes
manifestations {
mostRelevant {
all {
...manifestationAccess
...manifestationDetailsForAccessFactory
}
Expand Down Expand Up @@ -807,7 +810,7 @@ export function overviewWork({ workId }) {
}
workTypes
manifestations {
mostRelevant {
all {
ownerWork {
workTypes
}
Expand Down