Skip to content

Commit

Permalink
Unite the approach to including reservation status in pickup modal
Browse files Browse the repository at this point in the history
..and NoInterestAfter modal with the approach taken on the user
reservations page.
  • Loading branch information
Adamik10 committed Oct 9, 2024
1 parent 6853a6f commit e7859b2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/components/reservation/ReservationModalBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import configuration, { getConf } from "../../core/configuration";
import useReservableFromAnotherLibrary from "../../core/utils/useReservableFromAnotherLibrary";
import { usePatronData } from "../../core/utils/helpers/usePatronData";
import { Periods } from "./types";
import { RequestStatus } from "../../core/utils/types/request";

type ReservationModalProps = {
selectedManifestations: Manifestation[];
Expand Down Expand Up @@ -331,6 +332,7 @@ export const ReservationModalBody = ({
: selectedInterest
}
setSelectedInterest={setSelectedInterest}
reservationStatus={reservationStatus}
/>
)}

Expand Down
7 changes: 6 additions & 1 deletion src/components/reservation/UserListItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
import PickupModal from "./forms/PickupModal";
import NoInterestAfterModal from "./forms/NoInterestAfterModal";
import { Periods } from "./types";
import { RequestStatus } from "../../core/utils/types/request";

export interface UserListItemsProps {
patron: PatronV5;
Expand All @@ -32,6 +33,7 @@ export interface UserListItemsProps {
selectedInterest: number | null;
setSelectedInterest: (value: number) => void;
whitelistBranches: AgencyBranch[];
reservationStatus: RequestStatus;
}

const UserListItems: FC<UserListItemsProps> = ({
Expand All @@ -42,7 +44,8 @@ const UserListItems: FC<UserListItemsProps> = ({
selectBranchHandler,
selectedInterest,
setSelectedInterest,
whitelistBranches
whitelistBranches,
reservationStatus
}) => {
const t = useText();
const config = useConfig();
Expand Down Expand Up @@ -83,6 +86,7 @@ const UserListItems: FC<UserListItemsProps> = ({
selectedInterest ?? interestPeriods.defaultInterestPeriod.value
}
setSelectedInterest={setSelectedInterest}
reservationStatus={reservationStatus}
/>
</>
)}
Expand All @@ -99,6 +103,7 @@ const UserListItems: FC<UserListItemsProps> = ({
branches={whitelistBranches}
defaultBranch={selectedBranch ?? preferredPickupBranch}
selectBranchHandler={selectBranchHandler}
reservationStatus={reservationStatus}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface ModalReservationFormSelectProps<
saveCallback?: <TSaveValue extends FormSelectValue>(
value: TSaveValue
) => void;
reservationStatus?: RequestStatus;
reservationStatus: RequestStatus;
setReservationStatus?: (status: RequestStatus) => void;
}

Expand Down Expand Up @@ -129,6 +129,7 @@ const ModalReservationFormSelect = <TValue extends FormSelectValue>({
title={header.title}
description={header.description}
onSubmit={onSubmit}
disabledButton={reservationStatus === "pending"}
buttonLabel={
reservationStatus === "pending" ? t("loadingText") : undefined
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/reservation/forms/NoInterestAfterModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface NoInterestAfterModalProps {
selectedInterest: number;
setSelectedInterest: (value: number) => void;
saveCallback?: <TValue extends FormSelectValue>(value: TValue) => void;
reservationStatus?: RequestStatus;
reservationStatus: RequestStatus;
setReservationStatus?: (status: RequestStatus) => void;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/reservation/forms/PickupModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface PickupModalProps {
defaultBranch: string;
selectBranchHandler: (value: string) => void;
saveCallback?: <TValue extends FormSelectValue>(value: TValue) => void;
reservationStatus?: RequestStatus;
reservationStatus: RequestStatus;
setReservationStatus?: (status: RequestStatus) => void;
}

Expand Down

0 comments on commit e7859b2

Please sign in to comment.