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

Fix reservation unit state #1025

Merged
merged 13 commits into from
Apr 12, 2024
Merged

Fix reservation unit state #1025

merged 13 commits into from
Apr 12, 2024

Conversation

vincit-matu
Copy link
Contributor

🛠️ Changelog

  • Refactors the reservation unit page to use a single state (form)
  • Single search now carries over the selected date, time, and duration to the reservation unit page (TODO)

🧪 Test plan

  • Check that date, time and/or duration persists from the search page to the reservation unit page
  • The reservation unit page controls (== input fields in quick reservation, the calendar, and the calendar controls) are in sync so changing one affects the others

🎫 Tickets

  • TILA-2883, TILA-3042

@joonatank joonatank self-requested a review March 13, 2024 10:21
@vincit-matu vincit-matu force-pushed the fix-reservation-unit-state branch 2 times, most recently from 5a1e9c2 to 8b60498 Compare March 20, 2024 19:48
@vincit-matu vincit-matu force-pushed the fix-reservation-unit-state branch 4 times, most recently from 6312e44 to 1d6c5ac Compare March 21, 2024 05:23
apps/ui/components/reservation/SubventionSuffix.tsx Outdated Show resolved Hide resolved
apps/ui/components/common/ControlledSelect.tsx Outdated Show resolved Hide resolved
apps/ui/components/common/ControlledDateInput.tsx Outdated Show resolved Hide resolved
apps/ui/modules/reservation.ts Outdated Show resolved Hide resolved
apps/ui/pages/reservation-unit/[id].tsx Outdated Show resolved Hide resolved
apps/ui/pages/reservation-unit/[id].tsx Outdated Show resolved Hide resolved
apps/ui/pages/reservation-unit/[id].tsx Outdated Show resolved Hide resolved
apps/ui/pages/reservation-unit/[id].tsx Outdated Show resolved Hide resolved
apps/ui/pages/reservation-unit/[id].tsx Outdated Show resolved Hide resolved
@vincit-matu vincit-matu force-pushed the fix-reservation-unit-state branch 3 times, most recently from c1d874f to b03313d Compare March 28, 2024 14:42
Copy link
Contributor

@joonatank joonatank left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@vincit-matu vincit-matu marked this pull request as ready for review April 10, 2024 22:03
- "asInt" is misleading, since it's desired effect is to ensure that the return value consists of numbers (like "0" instead of "free") - but we are still returning a string and not anything typed number (like "asInt" would suggest).
- "reservationUnitIsReservable" differentiates it from the reservability for a single slot (= a result of an isSlotReservable() operation, whereas this is isReservationUnitReservable).
- remove as much logic as possible from quick reservation and calendar controls
- move over some utility functions from quick reservation to utils.ts, even if they aren't in use elsewhere
@vincit-matu vincit-matu force-pushed the fix-reservation-unit-state branch 2 times, most recently from fe24721 to cf4ee48 Compare April 12, 2024 09:12
Comment on lines +507 to +511
const initialFieldValues = {
date:
searchDate && searchUIDate && isValidDate(searchUIDate)
? searchDate
: toUIDate(new Date(todaysTimeSpans[0]?.startDatetime ?? "")),
Copy link
Contributor

Choose a reason for hiding this comment

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

Date format? here it's in UI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's supposed to be in UI format in the form/state.. searchDate is in UI format too..

apps/ui/components/reservation/EditStep0.tsx Outdated Show resolved Hide resolved
apps/ui/modules/reservationUnit.ts Show resolved Hide resolved
apps/ui/modules/reservationUnit.ts Show resolved Hide resolved
@vincit-matu vincit-matu merged commit 87931d8 into main Apr 12, 2024
6 checks passed
@vincit-matu vincit-matu deleted the fix-reservation-unit-state branch April 12, 2024 12:47
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.

2 participants