mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 13:10:29 +00:00
fix(mobile): the chat watches its list once it exists, keeps its draft, and the desktop map opens as before
- useCollabChatData: the resize observer that keeps the chat at its newest message attaches when the list is drawn (after the messages load), not at mount when there is no list yet. The test renders the real list after load. - MCollabTab: the chat stays mounted, hidden, while a board fills the page on its own, so leaving two panes with Notes picked keeps the half typed message and the scroll position. The links card hugs its links on a wide window instead of a page-high empty card. - openingView: the floored opening zoom and the second fit for the map's own size apply only beside the pane in the touch shell; the desktop planner and the phone open at Leaflet's nearest level again.
This commit is contained in:
@@ -672,7 +672,6 @@ export const MapView = memo(function MapView({
|
||||
), [reservations, visibleConnectionIds, showTransitRoutes, selectedDayId, days, scopeConnectionsToDay])
|
||||
// Real road geometry for car/bus/taxi/bicycle bookings (straight line until it loads/if it fails).
|
||||
const transportRoutes = useTransportRoutes(visibleReservations)
|
||||
// Dynamic padding: account for sidebars + bottom inspector + day detail panel
|
||||
// The chrome overlaying the map (side panels, day detail). Kept as a plain box so both the
|
||||
// Leaflet fit options and the opening-camera maths can read the same numbers.
|
||||
// Followed rather than read once: a phone turned sideways and back crosses
|
||||
@@ -698,14 +697,12 @@ export const MapView = memo(function MapView({
|
||||
|
||||
const paddingOpts = useMemo(() => leafletPadding(paddingBox), [paddingBox])
|
||||
|
||||
// Open framed on the places rather than on the caller's default, so a trip in Japan shows
|
||||
// Japan straight away instead of the world view followed by a flight across the planet.
|
||||
// The initializer runs once, at mount — exactly when this should be decided; afterwards the
|
||||
// camera belongs to the user. `framed` is false when no place has coordinates (a new trip),
|
||||
// and then the caller's center/zoom stands.
|
||||
const [initialView] = useState(() =>
|
||||
openingView(dayPlaces.length > 0 ? dayPlaces : places, { padding: paddingBox, lngFrame, center, zoom }),
|
||||
)
|
||||
// Open framed on the places, not on the caller's default: a trip in Japan shows Japan at once instead
|
||||
// of the world and a flight across it. Decided once, at mount; afterwards the camera is the user's.
|
||||
// `framed` is false when no place has coordinates (a new trip), and then the caller's center/zoom stands.
|
||||
const [initialView] = useState(() => openingView(dayPlaces.length > 0 ? dayPlaces : places, {
|
||||
padding: paddingBox, lngFrame, center, zoom, paned: isMobile && isWide,
|
||||
}))
|
||||
const cameraSnapshotRef = useRef<{ center: [number, number]; zoom: number } | null>(null)
|
||||
const saveCameraSnapshot = useCallback((cameraCenter: [number, number], cameraZoom: number) => {
|
||||
cameraSnapshotRef.current = { center: cameraCenter, zoom: cameraZoom }
|
||||
|
||||
Reference in New Issue
Block a user