mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-27 15:17:30 +00:00
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { useSearchParams } from 'react-router';
|
|
|
|
import { useBookingDeepLink } from './deepLinks/useBookingDeepLink';
|
|
import { useRoadtripDeepLink } from './deepLinks/useRoadtripDeepLink';
|
|
import { useTourDeepLink } from './deepLinks/useTourDeepLink';
|
|
import { useAssistantTabLink } from './useAssistantDeepLink';
|
|
import type { useTourWorkspace } from './useTourWorkspace';
|
|
import type { useTripPlanner } from './useTripPlanner';
|
|
|
|
interface AssistantEntityLinkOptions {
|
|
planner: ReturnType<typeof useTripPlanner>;
|
|
workspace: ReturnType<typeof useTourWorkspace>;
|
|
}
|
|
|
|
/**
|
|
* The links the chat opens the planner with while it is already on screen:
|
|
* another tab of the trip (`?tab=`), and what each part of TREK opens in its
|
|
* own tab (a tour, a booking, a stop of the road trip). Each is taken once
|
|
* and then leaves the URL.
|
|
*/
|
|
export function useAssistantEntityLinks({ planner, workspace }: AssistantEntityLinkOptions): void {
|
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
useAssistantTabLink({
|
|
searchParams,
|
|
setSearchParams,
|
|
activeTab: planner.activeTab,
|
|
selectTab: planner.handleTabChange,
|
|
});
|
|
const links = { planner, workspace, searchParams, setSearchParams };
|
|
useTourDeepLink(links);
|
|
useBookingDeepLink(links);
|
|
useRoadtripDeepLink(links);
|
|
}
|