fix(client): the trip form's review and the slow-open splash, and the tests that followed

Inside the trip settings, Escape and the backdrop no longer close the dialog
while the date question is up, and the embedded form does not load the
members it does not show. Every trip open is timed afresh for the splash.
The tests follow the cover image card, the danger button, the delayed splash
and the open and download mocks.
This commit is contained in:
Maurice
2026-11-13 12:57:57 +01:00
parent 71cc97822a
commit 9cbf31da27
16 changed files with 731 additions and 484 deletions
+4 -3
View File
@@ -301,7 +301,7 @@ describe('TripPlannerPage', () => {
});
describe('FE-PAGE-PLANNER-002: Loading state shown while loadTrip in progress', () => {
it('shows loading animation when isLoading is true', () => {
it('shows loading animation when isLoading is true', async () => {
seedStore(useTripStore, {
trip: null,
isLoading: true,
@@ -315,8 +315,9 @@ describe('TripPlannerPage', () => {
renderPlannerPage(99);
// Loading state: shows the trip-open loading splash
expect(screen.getByTestId('trip-loading-splash')).toBeInTheDocument();
// A quick open shows nothing but the page's ground; a slow one gets the splash.
expect(screen.queryByTestId('trip-loading-splash')).not.toBeInTheDocument();
expect(await screen.findByTestId('trip-loading-splash', {}, { timeout: 2000 })).toBeInTheDocument();
});
});
+1 -1
View File
@@ -63,7 +63,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
// selection, CRUD handlers with undo, map filters, splash) lives in the hook.
const pageState = useTripPlannerPage()
const {
tripId, navigate, toast, t, language, placesPhotosEnabled,
tripId, navigate, t, language, placesPhotosEnabled,
trip, days, places, assignments, packingItems, todoItems, categories, reservations, budgetItems, files,
selectedDayId, isLoading, tripActions, can, canUploadFiles,
pushUndo, undo, canUndo, lastActionLabel, handleUndo,
@@ -206,7 +206,6 @@ function dialogState(): HookState {
setShowTripForm: vi.fn(),
showMembersModal: false,
setShowMembersModal: vi.fn(),
editTripFromSettings: vi.fn(),
showReservationModal: false,
setShowReservationModal: vi.fn(),
editingReservation: null,
@@ -361,7 +361,7 @@ export function useTripPlanner() {
// The dialog state that only passes through to the shells.
const {
showPlaceForm, prefillCoords, reservationModalDayId, setReservationModalDayId,
showTripForm, setShowTripForm, showMembersModal, setShowMembersModal, editTripFromSettings, showReservationModal,
showTripForm, setShowTripForm, showMembersModal, setShowMembersModal, showReservationModal,
showBookingImport, setShowBookingImport, bookingImportKind, setBookingImportKind, bookingImportAvailable,
airTrailAvailable, showAirTrailImport, setShowAirTrailImport, bookingForAssignmentId, setBookingForAssignmentId,
showTransportModal, transportModalDayId, transportModalAutomated, setTransportModalAutomated,
@@ -710,6 +710,12 @@ export function useTripPlanner() {
// loads within TRIP_SPLASH_AFTER_MS opens straight away, with no splash and no
// minimum on screen.
const [slowOpen, setSlowOpen] = useState(false)
// Every open is timed afresh: a trip opened after a slow one starts without the splash too.
const [wasLoading, setWasLoading] = useState(isLoading)
if (wasLoading !== isLoading) {
setWasLoading(isLoading)
if (isLoading) setSlowOpen(false)
}
useEffect(() => {
if (!isLoading) return
const timer = setTimeout(() => setSlowOpen(true), TRIP_SPLASH_AFTER_MS)
@@ -758,7 +764,7 @@ export function useTripPlanner() {
highlightedAlternative, setHighlightedAlternative,
moveRoadtripStopToDay,
dropPoiOnRoute,
showTripForm, setShowTripForm, showMembersModal, setShowMembersModal, editTripFromSettings,
showTripForm, setShowTripForm, showMembersModal, setShowMembersModal,
showReservationModal, setShowReservationModal, editingReservation, setEditingReservation,
showBookingImport, setShowBookingImport, bookingImportKind, setBookingImportKind, bookingImportAvailable,
airTrailAvailable, showAirTrailImport, setShowAirTrailImport,