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

Refactor PhysicalListDetails to Align with Reservation Change Handling #574

Conversation

kasperbirch1
Copy link
Contributor

Link to issue

https://reload.atlassian.net/browse/DDFLSBP-192

Description

This pull request introduces a thorough refactoring of the PhysicalListDetails component with the prime objective of ensuring its functional alignment with the reservation flow.

Screenshot of the result

Skaermoptagelse.2023-10-03.kl.13.08.33.mov

Checklist

  • My complies with our coding guidelines.
  • My code passes our static analysis suite. If not then I have added a comment explaining why this change should be exempt from the code standards and process.
  • My code passes our continuous integration process. If not then I have added a comment explaining why this change should be exempt from the code standards and process.

Additional comments or questions

If you have any further comments or questions for the reviewer them please add them here.

@kasperbirch1 kasperbirch1 force-pushed the DDFLSBP-192-samlesag-ensretning-af-skift-af-interesseperiode-og-afhentningssted-pa-reserveringer branch 8 times, most recently from 0e6f2f7 to 9db99ff Compare October 10, 2023 12:18
This commit entails a series of refactoring initiatives within the `PhysicalListDetails` component to align its functionality with the reservation flow. The refactoring focuses on utilizing modal components, managing state directly for the selected branch and interest periods, and adding a streamlined useEffect hook for updating reservations.

- Implement `PickupModal` and `NoInterestAfterModal` to manage reservation changes, and replace inline dropdown logic.
- Introduce logic to manage whitelist branching.
- Clean up unused states and code.
- Utilize a simplified useEffect hook to handle reservation mutations.
- adding `subText` prop to the `ReservationFormListItem`
- Adding translations
- The 'ReservationFormListItem' component is no longer used due to new logic in `PhysicalListDetails`.
- `OptionsProps` has been moved to helpers, as its type is still required in other files.
Ensure translation texts are properly aligned across apps for consistency.
This component should no longer be needed because we have `ReservationFormListItem` and we no longer use `showSelect` logic inside `ListDetails`.
The useEffect that previously allowed for reservation mutation has now been replaced with a function saveChanges, which is called when the user presses the save button. This change was implemented to provide user feedback upon successful operation.

Since booking and modifying reservations share components, some new props have been added to ModalReservationFormSelect:
- `saveCallback` is called, if it exists. In this case, it is used for our change in reservation mutation.
- `reservationStatus` / `setReservationStatus` is a state that indicates the status of the reservation change.
Modify selector in response to recent changes in the `Message` component.
@kasperbirch1 kasperbirch1 force-pushed the DDFLSBP-192-samlesag-ensretning-af-skift-af-interesseperiode-og-afhentningssted-pa-reserveringer branch from 9db99ff to 1b06b9e Compare October 10, 2023 12:41
Add check to ensure that `deletePhysicalReservation` is only called if there is a physical material to be removed
Copy link
Contributor

@kasperg kasperg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM.

I have some things for you to consider before you merge.

src/components/reservation/UserListItems.tsx Show resolved Hide resolved
src/components/reservation/helper.ts Outdated Show resolved Hide resolved
src/components/list-details/list-details.tsx Outdated Show resolved Hide resolved
…the X button.

This is the same way we handle it when the user clicks the close button.
@kasperbirch1 kasperbirch1 merged commit b95da0b into danskernesdigitalebibliotek:develop Oct 17, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants