mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 21:11:14 +00:00
feat(planner): planner panels widen as far as the window allows and follow the drag without lag
The side panels stopped at a fixed 520 px, which left a wide screen with a narrow day plan. Each panel may now take whatever the window leaves once the map keeps at least 35% of it (never under 360 px), the day plan keeping its width first when the window shrinks. While a handle is held the width transition is off, so the panel no longer trails behind the map and its buttons.
This commit is contained in:
@@ -76,7 +76,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
TRANSPORT_TYPES, TRIP_TABS, activeTab, setActiveTab, handleTabChange,
|
||||
leftWidth, rightWidth,
|
||||
leftHidden, rightHidden, toggleLeft, toggleRight,
|
||||
startResizeLeft, startResizeRight, nudgeLeft, nudgeRight, resizeMin, resizeMax,
|
||||
startResizeLeft, startResizeRight, nudgeLeft, nudgeRight, resizing, resizeMin, resizeMaxLeft, resizeMaxRight,
|
||||
selectedPlaceId, selectedAssignmentId, setSelectedPlaceId, selectAssignment,
|
||||
showDayDetail, setShowDayDetail, dayDetailCollapsed, setDayDetailCollapsed,
|
||||
stayPickerDayId, setStayPickerDayId,
|
||||
@@ -294,7 +294,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
boxShadow: leftHidden ? 'none' : 'var(--sidebar-shadow)',
|
||||
borderRadius: 16,
|
||||
overflow: 'hidden', display: 'flex', flexDirection: 'column',
|
||||
transition: 'width 0.25s ease',
|
||||
transition: resizing ? 'none' : 'width 0.25s ease',
|
||||
opacity: leftHidden ? 0 : 1,
|
||||
}}>
|
||||
{enabledAddons.roadtrip && (
|
||||
@@ -402,7 +402,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
/>
|
||||
)}
|
||||
{!leftHidden && (
|
||||
<PanelResizeHandle side="left" width={leftWidth} min={resizeMin} max={resizeMax} onStart={startResizeLeft} onNudge={nudgeLeft} />
|
||||
<PanelResizeHandle side="left" width={leftWidth} min={resizeMin} max={resizeMaxLeft} onStart={startResizeLeft} onNudge={nudgeLeft} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -418,11 +418,11 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
boxShadow: rightHidden ? 'none' : 'var(--sidebar-shadow)',
|
||||
borderRadius: 16,
|
||||
overflow: 'hidden', display: 'flex', flexDirection: 'column',
|
||||
transition: 'width 0.25s ease',
|
||||
transition: resizing ? 'none' : 'width 0.25s ease',
|
||||
opacity: rightHidden ? 0 : 1,
|
||||
}}>
|
||||
{!rightHidden && (
|
||||
<PanelResizeHandle side="right" width={rightWidth} min={resizeMin} max={resizeMax} onStart={startResizeRight} onNudge={nudgeRight} />
|
||||
<PanelResizeHandle side="right" width={rightWidth} min={resizeMin} max={resizeMaxRight} onStart={startResizeRight} onNudge={nudgeRight} />
|
||||
)}
|
||||
<div style={{ flex: 1, overflow: 'hidden', display: 'flex', flexDirection: 'column' }}>
|
||||
{roadtripActive ? (
|
||||
@@ -633,9 +633,9 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
background: 'var(--sidebar-bg)', backdropFilter: 'blur(24px) saturate(180%)',
|
||||
WebkitBackdropFilter: 'blur(24px) saturate(180%)', boxShadow: leftHidden ? 'none' : 'var(--sidebar-shadow)',
|
||||
borderRadius: 16, overflow: 'hidden', display: 'flex', flexDirection: 'column',
|
||||
transition: 'width 0.25s ease', opacity: leftHidden ? 0 : 1,
|
||||
transition: resizing ? 'none' : 'width 0.25s ease', opacity: leftHidden ? 0 : 1,
|
||||
}}>
|
||||
{!leftHidden && <PanelResizeHandle side="left" width={leftWidth} min={resizeMin} max={resizeMax} onStart={startResizeLeft} onNudge={nudgeLeft} />}
|
||||
{!leftHidden && <PanelResizeHandle side="left" width={leftWidth} min={resizeMin} max={resizeMaxLeft} onStart={startResizeLeft} onNudge={nudgeLeft} />}
|
||||
<LazyPanel id="tour-planner-rail"><TourWorkspaceRail workspace={pageState} canEdit={canPlaceEdit} canAssign={canDayEdit} /></LazyPanel>
|
||||
</div>
|
||||
</div>
|
||||
@@ -654,7 +654,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
style={{
|
||||
width: rightHidden ? 0 : rightWidth,
|
||||
opacity: rightHidden ? 0 : 1,
|
||||
transition: 'width 0.25s ease, opacity 0.25s ease',
|
||||
transition: resizing ? 'opacity 0.25s ease' : 'width 0.25s ease, opacity 0.25s ease',
|
||||
background: 'var(--sidebar-bg)',
|
||||
backdropFilter: 'blur(24px) saturate(180%)',
|
||||
WebkitBackdropFilter: 'blur(24px) saturate(180%)',
|
||||
@@ -662,7 +662,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
}}
|
||||
>
|
||||
{!rightHidden && (
|
||||
<PanelResizeHandle side="right" width={rightWidth} min={resizeMin} max={resizeMax} onStart={startResizeRight} onNudge={nudgeRight} />
|
||||
<PanelResizeHandle side="right" width={rightWidth} min={resizeMin} max={resizeMaxRight} onStart={startResizeRight} onNudge={nudgeRight} />
|
||||
)}
|
||||
{!rightHidden && (
|
||||
<LazyPanel id="tour-planner-tours">
|
||||
|
||||
@@ -174,8 +174,10 @@ function layoutState(): HookState {
|
||||
startResizeRight: vi.fn(),
|
||||
nudgeLeft: vi.fn(),
|
||||
nudgeRight: vi.fn(),
|
||||
resizing: false,
|
||||
resizeMin: 200,
|
||||
resizeMax: 520,
|
||||
resizeMaxLeft: 520,
|
||||
resizeMaxRight: 520,
|
||||
selectedPlaceId: null,
|
||||
selectedAssignmentId: null,
|
||||
setSelectedPlaceId: vi.fn(),
|
||||
|
||||
@@ -260,7 +260,7 @@ describe('TripPlannerPage — shell', () => {
|
||||
{ leftHidden: true, rightHidden: false, visibleSide: 'right', leftInset: 0, rightInset: 300 },
|
||||
])('UI-R2: the 768-1023px panel state shows only its selected rail ($visibleSide)', ({ leftHidden, rightHidden, visibleSide, leftInset, rightInset }) => {
|
||||
const { container } = renderToursPage({ narrowPanels: true,
|
||||
leftHidden, rightHidden, leftWidth: 300, rightWidth: 300, resizeMax: 300 })
|
||||
leftHidden, rightHidden, leftWidth: 300, rightWidth: 300, resizeMaxLeft: 300, resizeMaxRight: 300 })
|
||||
const handles = container.querySelectorAll<HTMLElement>('div[role="separator"]')
|
||||
expect(handles).toHaveLength(1)
|
||||
expect(handles[0]).toHaveAttribute('data-resize', visibleSide)
|
||||
|
||||
@@ -310,7 +310,7 @@ export function useTripPlanner() {
|
||||
const {
|
||||
leftWidth, rightWidth, leftCollapsed, rightCollapsed, setLeftCollapsed, setRightCollapsed,
|
||||
leftHidden, rightHidden, toggleLeft, toggleRight, narrow: narrowPanels,
|
||||
startResizeLeft, startResizeRight, nudgeLeft, nudgeRight, resizeMin, resizeMax,
|
||||
startResizeLeft, startResizeRight, nudgeLeft, nudgeRight, resizing, resizeMin, resizeMaxLeft, resizeMaxRight,
|
||||
} = useResizablePanels()
|
||||
const { selectedPlaceId, selectedAssignmentId, setSelectedPlaceId, selectAssignment } = usePlaceSelection()
|
||||
const toursEnabled = useAddonStore(state => state.isEnabled('tours'))
|
||||
@@ -747,7 +747,7 @@ export function useTripPlanner() {
|
||||
TRANSPORT_TYPES, TRIP_TABS, activeTab, setActiveTab, handleTabChange, tabLink,
|
||||
leftWidth, rightWidth, leftCollapsed, rightCollapsed, setLeftCollapsed, setRightCollapsed,
|
||||
leftHidden, rightHidden, toggleLeft, toggleRight, narrowPanels,
|
||||
startResizeLeft, startResizeRight, nudgeLeft, nudgeRight, resizeMin, resizeMax,
|
||||
startResizeLeft, startResizeRight, nudgeLeft, nudgeRight, resizing, resizeMin, resizeMaxLeft, resizeMaxRight,
|
||||
selectedPlaceId, selectedAssignmentId, setSelectedPlaceId, selectAssignment,
|
||||
toursEnabled, toursMode, setToursMode, tours, toursLoading, tourDataReady, tourPlaceIds,
|
||||
reloadTourPlaceIds, invalidateTourPlaceIds, upsertTour, selectedTour, tourStageStops,
|
||||
|
||||
Reference in New Issue
Block a user