Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

linkedThreadRoute.ts

22 lines780 Bytes

1import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
2​
3export type LinkedThreadRouteParams = {
4 readonly viaEnvironmentId: string;
5 readonly environmentId: string;
6 readonly threadId: string;
7 readonly label: string;
8 readonly title?: string;
9};
10​
11/** The route params that open a linked environment's thread read-only. */
12export const linkedThreadRouteParams = (
13 thread: { readonly environmentId: EnvironmentId; readonly threadId: ThreadId },
14 linked: { readonly viaEnvironmentId: EnvironmentId; readonly label: string },
15 title: string | null,
16): LinkedThreadRouteParams => ({
17 viaEnvironmentId: linked.viaEnvironmentId,
18 environmentId: thread.environmentId,
19 threadId: thread.threadId,
20 label: linked.label,
21 ...(title === null ? {} : { title }),
22});