GRO-1793: Dynamic portal time slots (replace hardcoded) #23

Merged
The Dogfather merged 3 commits from feature/gro-1165c-dynamic-timeslots into dev 2026-05-26 12:56:26 +00:00
Member

Summary

  • Replaced hardcoded time slot arrays in portal BookingFlow and RescheduleFlow with dynamic fetch from /api/book/availability
  • Loading and error states shown while fetching; "No available slots" when API returns empty
  • Both flows now use the same availability endpoint as the public booking wizard

Changes

  • src/portal/sections/Appointments.tsx: Removed hardcoded availableTimes arrays; added useEffect that fetches /api/book/availability?date= on date change in both components
  • src/tests/Appointments.test.tsx: Added test suite for RescheduleFlow dynamic slot fetching

Test plan

  • Unit tests for RescheduleFlow dynamic slot fetching
  • QA verify portal BookingFlow shows dynamic time slots
  • QA verify portal RescheduleFlow shows dynamic time slots
  • Verify time slots match public booking wizard for same date

cc @cpfarhood

## Summary - Replaced hardcoded time slot arrays in portal BookingFlow and RescheduleFlow with dynamic fetch from /api/book/availability - Loading and error states shown while fetching; "No available slots" when API returns empty - Both flows now use the same availability endpoint as the public booking wizard ## Changes - src/portal/sections/Appointments.tsx: Removed hardcoded availableTimes arrays; added useEffect that fetches /api/book/availability?date=<selectedDate> on date change in both components - src/__tests__/Appointments.test.tsx: Added test suite for RescheduleFlow dynamic slot fetching ## Test plan - [x] Unit tests for RescheduleFlow dynamic slot fetching - [ ] QA verify portal BookingFlow shows dynamic time slots - [ ] QA verify portal RescheduleFlow shows dynamic time slots - [ ] Verify time slots match public booking wizard for same date cc @cpfarhood
The Dogfather added 1 commit 2026-05-26 12:24:02 +00:00
Replace hardcoded time slots with dynamic API availability
CI / Lint & Typecheck (pull_request) Failing after 15s
CI / Test (pull_request) Failing after 17s
CI / Build & Push Docker Image (pull_request) Has been skipped
d78c859c2b
Both BookingFlow and RescheduleFlow in Appointments.tsx now fetch
from /api/book/availability when a date is selected, matching the
public booking wizard behavior. Loading and error states shown.

- Removed hardcoded availableTimes arrays from both flows
- Added useEffect that fetches availability on date change
- Shows "Checking availability…" while loading
- Shows error message on fetch failure
- Shows "No available slots" when API returns empty

Added tests for RescheduleFlow dynamic slot fetching covering:
loading, fetched slots, error, empty, API params, and re-fetch on
date change.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Flea Flicker added 1 commit 2026-05-26 12:25:56 +00:00
GRO-1793: Update UAT_PLAYBOOK.md §5.12b — new dynamic time slots tests
CI / Test (pull_request) Failing after 22s
CI / Lint & Typecheck (pull_request) Failing after 28s
CI / Build & Push Docker Image (pull_request) Has been skipped
a873369a9b
Added TC-WEB-5.12.5 through TC-WEB-5.12.11 covering BookingFlow and
RescheduleFlow dynamic slot fetching, loading state, error state, and
empty state scenarios.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Lint Roller requested changes 2026-05-26 12:28:57 +00:00
Dismissed
Lint Roller left a comment
Member

CI failures blocking merge

Two issues found in CI run #1819 that must be fixed before this PR can be approved.

1. Lint error — unused act import

File: src/__tests__/Appointments.test.tsx line 2:46

error  'act' is defined but never used  @typescript-eslint/no-unused-vars

Remove act from the import on line 2.

2. Test failures — date input missing label (6 tests)

All 6 RescheduleFlow dynamic time slots tests fail with:

TestingLibraryElementError: Unable to find a label with the text of: /date/i

The tests use screen.getByLabelText(/date/i) but the <input type="date"> in RescheduleFlow has no associated <label> or aria-label attribute.

Fix: Add aria-label="Select date" (or equivalent) to the date input in RescheduleFlow in src/portal/sections/Appointments.tsx. This also improves accessibility. Alternatively, update the tests to query by a selector that matches the actual rendered markup, but adding the label to the component is preferred since it reflects the intended accessible behaviour.

Please fix both issues and push to the same branch — CI must pass before this PR can proceed.

## CI failures blocking merge Two issues found in CI run [#1819](/groombook/web/actions/runs/1819) that must be fixed before this PR can be approved. ### 1. Lint error — unused `act` import **File:** `src/__tests__/Appointments.test.tsx` line 2:46 ``` error 'act' is defined but never used @typescript-eslint/no-unused-vars ``` Remove `act` from the import on line 2. ### 2. Test failures — date input missing label (6 tests) All 6 `RescheduleFlow dynamic time slots` tests fail with: ``` TestingLibraryElementError: Unable to find a label with the text of: /date/i ``` The tests use `screen.getByLabelText(/date/i)` but the `<input type="date">` in `RescheduleFlow` has no associated `<label>` or `aria-label` attribute. **Fix:** Add `aria-label="Select date"` (or equivalent) to the date input in `RescheduleFlow` in `src/portal/sections/Appointments.tsx`. This also improves accessibility. Alternatively, update the tests to query by a selector that matches the actual rendered markup, but adding the label to the component is preferred since it reflects the intended accessible behaviour. Please fix both issues and push to the same branch — CI must pass before this PR can proceed.
Flea Flicker added 1 commit 2026-05-26 12:49:04 +00:00
fix(GRO-1793): remove unused act import and add aria-label to date inputs
CI / Test (pull_request) Successful in 14s
CI / Lint & Typecheck (pull_request) Successful in 23s
CI / Build & Push Docker Image (pull_request) Successful in 34s
26cdd69a49
QA review pointed out:
- Lint error: 'act' imported but never used in test file
- 6 test failures: date input lacked accessible label

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Lint Roller approved these changes 2026-05-26 12:52:32 +00:00
Lint Roller left a comment
Member

QA Review: PASS

All acceptance criteria verified:

  • No hardcoded time arrays remain in Appointments.tsx
  • Both BookingFlow and RescheduleFlow fetch from /api/book/availability dynamically
  • Loading state ("Checking availability…") shown while fetching
  • Error state ("Failed to load time slots") shown on fetch failure
  • Empty state ("No available slots on this date") shown when API returns []
  • Tests added: RescheduleFlow dynamic slots (loading/fetch/error/empty/re-fetch/call-URL cases)
  • UAT_PLAYBOOK.md updated with TC-WEB-5.12.5 through TC-WEB-5.12.11
  • cc @cpfarhood present in PR body

CI: All checks green (lint, typecheck, test, build).

## QA Review: PASS All acceptance criteria verified: - No hardcoded time arrays remain in Appointments.tsx - Both BookingFlow and RescheduleFlow fetch from `/api/book/availability` dynamically - Loading state ("Checking availability…") shown while fetching - Error state ("Failed to load time slots") shown on fetch failure - Empty state ("No available slots on this date") shown when API returns [] - Tests added: RescheduleFlow dynamic slots (loading/fetch/error/empty/re-fetch/call-URL cases) - UAT_PLAYBOOK.md updated with TC-WEB-5.12.5 through TC-WEB-5.12.11 - `cc @cpfarhood` present in PR body CI: All checks green (lint, typecheck, test, build).
Author
Member

CTO Review: Approved

Code is correct and consistent with the existing fetch pattern in Book.tsx. Good additions: explicit error state, loading indicator, and aria-labels for accessibility.

Minor notes for future improvement (not blocking):

  • Neither this nor Book.tsx checks r.ok before parsing — a server error returning JSON would silently show no slots instead of the error state. Worth a follow-up.
  • No AbortController cleanup on date changes — matches existing pattern but could cause stale-slot flicker on rapid changes.

All acceptance criteria met. Merging to dev.

## CTO Review: Approved Code is correct and consistent with the existing fetch pattern in `Book.tsx`. Good additions: explicit error state, loading indicator, and `aria-label`s for accessibility. **Minor notes for future improvement (not blocking):** - Neither this nor `Book.tsx` checks `r.ok` before parsing — a server error returning JSON would silently show no slots instead of the error state. Worth a follow-up. - No `AbortController` cleanup on date changes — matches existing pattern but could cause stale-slot flicker on rapid changes. All acceptance criteria met. Merging to `dev`.
The Dogfather merged commit 88ba9915c6 into dev 2026-05-26 12:56:26 +00:00
The Dogfather deleted branch feature/gro-1165c-dynamic-timeslots 2026-05-26 12:56:26 +00:00
Sign in to join this conversation.