Files
TREK/client/src/components/Map/AssistantMapLeaflet.tsx
T
Maurice 26df56d76c feat(assistant): one AI tile for assistant, parsing and MCP, a planner-aware chat
The three AI addons share one tile in the integration column; a dialog holds
the connection, the assistant's limits and AI parsing, which now reads with
the assistant's connection unless an install keeps its own. Existing parsing
configs stay where they are and keep winning.

The chat sees the map on screen, offers next questions under an answer,
shows its live step in the window head, previews waiting changes inside the
day list, checks whether a day still works, folds a multi-day plan into a
week grid, keeps per-trip notes and can estimate costs. An empty or cut-off
answer gets one push instead of ending silently, and the assistant's own
step and size limits are raised.
2026-10-21 22:29:57 +02:00

37 lines
1.5 KiB
TypeScript

import type { ViewportPadding } from '../../utils/mapViewport';
import { useAssistantMarkerClasses } from './assistantCamera';
import { AssistantCameraController } from './AssistantCameraController';
import { AssistantGhostLayer } from './AssistantGhostLayer';
import { useReportViewLeaflet } from './assistantViewport';
import type { AssistantMapProps } from './mapViewContract';
interface AssistantMapLeafletProps {
assistant: AssistantMapProps;
/** The planner's padding for its panels, for the camera's fits. */
padding: ViewportPadding;
/** The element of a place's pin, when it has one on the map now. */
markerEl: (placeId: number) => HTMLElement | null;
}
/**
* Everything the assistant does on the Leaflet map, mounted inside the map
* container as one child, so MapView only hands its props on: the ghosts,
* the camera, the pop and pulse on the real pins, and the part of the map
* the assistant is told is on screen.
*/
export function AssistantMapLeaflet({ assistant, padding, markerEl }: AssistantMapLeafletProps) {
useAssistantMarkerClasses(markerEl, assistant.poppedPlaceIds, assistant.assistantPulsePlaceId);
useReportViewLeaflet();
return (
<>
<AssistantGhostLayer
ghosts={assistant.assistantGhosts}
hoveredId={assistant.assistantHoveredId}
onHover={assistant.onAssistantGhostHover}
onClick={assistant.onAssistantGhostClick}
/>
<AssistantCameraController camera={assistant.assistantCamera} padding={padding} />
</>
);
}