)}
);
}
/** Finds the route the peek is open on in this trip's chat; nothing while it is closed or the route is gone. */
function PeekFinder() {
const { tripId } = useAssistantView();
const toolCallId = useAssistantStore((s) => (s.routePeek?.tripId === tripId ? s.routePeek.toolCallId : null));
const messages = useAssistantStore((s) => chatOf(s, tripId).messages);
const route = useMemo(() => (toolCallId ? peekRoute(messages, toolCallId) : null), [messages, toolCallId]);
return route ? : null;
}
interface RoutePeekProps {
tripId: number;
onOpen: NonNullable;
onFocusDay: NonNullable;
onRevealMap: NonNullable;
}
/**
* The phone's peek at a route over the map, while the chat stands aside:
* opened by "On map" on a route card or a tap on a route line. It shows the
* route as its card does in brief (name, grade, figures) and its height
* profile with the readout under it, a finger scrubbing along it while the
* map's pin follows; the ways of an answer as their marks, 44 px targets, a
* tap choosing one as the card's choice does; and a close button. The map
* stays usable around it, and the chat's pill below brings the chat back.
*/
export default function RoutePeek({ tripId, onOpen, onFocusDay, onRevealMap }: RoutePeekProps) {
const view = useMemo(
() => ({ tripId, variant: 'fullscreen', density: 'compact', onOpen, onFocusDay, onRevealMap }),
[tripId, onOpen, onFocusDay, onRevealMap]
);
return (
);
}