Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

804 B
Raw Blame
import { useAssistantStore } from '../../store/assistantStore';

/**
 * The ways into the assistant from inside a trip: "Ask" about a place, on the
 * desktop inspector and the phone's place sheet, opens it with the place as
 * the chat's context chip; the phone's Mehr tile just opens it. Offered only
 * while the assistant can run for this user, like every other way in.
 */
export function useAssistantAsk(tripId: number | null) {
  const available = useAssistantStore((s) => s.status?.available === true);
  const openWith = useAssistantStore((s) => s.openWith);
  const open = useAssistantStore((s) => s.open);
  return {
    available: available && tripId !== null,
    askAbout: (placeId: number) => {
      if (tripId !== null) openWith(tripId, { placeIds: [placeId] });
    },
    open,
  };
}