From da37f3618d8d58a77fa610c5471b6f406714afdb Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 9 Oct 2026 14:56:15 +0200 Subject: [PATCH] refactor(planner): share the left panel tab and the selected place props in the trip planner page The plan view and the tour planner view each drew the left panel's tab in full, and the place inspector and the tour dialog each listed the same props twice, once beside the panels and once in the phone-width sheet. LeftPanelTab, a small presentational component at the bottom of TripPlannerPage.tsx, now draws the tab for both views. It stays in the page file so the physical left and right offsets keep being counted there. The tour planner's tab passes `announced`, which keeps its aria-expanded and its focus ring; the plan view's tab still has neither. The page body now builds selectedPlaceProps (what the inspector and the tour dialog both take), placeInspectorProps and tourDetailProps once and spreads them. What differs stays at each call site: the desktop inspector's onOpenBooking and panel widths, the sheet's edit and delete closing the sheet, the desktop tour dialog's non-modal focus return and widths, and canEdit and canAssign on every tour dialog. --- .../TripPlannerPage.leftPanelTab.test.tsx | 48 ++++++ client/src/pages/TripPlannerPage.tsx | 156 +++++++----------- 2 files changed, 111 insertions(+), 93 deletions(-) create mode 100644 client/src/pages/TripPlannerPage.leftPanelTab.test.tsx diff --git a/client/src/pages/TripPlannerPage.leftPanelTab.test.tsx b/client/src/pages/TripPlannerPage.leftPanelTab.test.tsx new file mode 100644 index 000000000..0e7806e9d --- /dev/null +++ b/client/src/pages/TripPlannerPage.leftPanelTab.test.tsx @@ -0,0 +1,48 @@ +import { fireEvent, screen } from '@testing-library/react'; +import { describe, expect, it, vi } from 'vitest'; + +import { render } from '../../tests/helpers/render'; +import { LeftPanelTab } from './TripPlannerPage'; + +// FE-PAGE-PLANNER-LEFTTAB-001 to FE-PAGE-PLANNER-LEFTTAB-004 + +describe('LeftPanelTab', () => { + it('FE-PAGE-PLANNER-LEFTTAB-001: an open panel shows a flap on its edge that collapses it', () => { + const onToggle = vi.fn(); + render(