@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 24 lines 884 Bytes
Raw
1 import type { ScopedThreadRef } from "@t3tools/contracts";
2 import { useParams } from "@tanstack/react-router";
3
4 import {
5 resolveThreadRouteRef,
6 resolveThreadRouteTarget,
7 type ThreadRouteTarget,
8 } from "../threadRoutes";
9
10 function useThreadRouteIds() {
11 const environmentId = useParams({ strict: false, select: (params) => params.environmentId });
12 const threadId = useParams({ strict: false, select: (params) => params.threadId });
13 return { environmentId, threadId };
14 }
15
16 export function useThreadRouteTarget(): ThreadRouteTarget | null {
17 const { environmentId, threadId } = useThreadRouteIds();
18 const draftId = useParams({ strict: false, select: (params) => params.draftId });
19 return resolveThreadRouteTarget({ environmentId, threadId, draftId });
20 }
21
22 export function useThreadRouteRef(): ScopedThreadRef | null {
23 return resolveThreadRouteRef(useThreadRouteIds());
24 }