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

main
ts 17 lines 902 Bytes
Raw
1 import { useAtomValue } from "@effect/atom-react";
2 import type { EnvironmentId } from "@t3tools/contracts";
3
4 import { environmentServerConfigsAtom, serverEnvironment } from "../../state/server";
5 import { canShareWithGuest } from "./guestShareAvailability";
6
7 /**
8 * Whether this environment offers "Share with guest": the user may create links there, and its
9 * Guest links beta is on (Settings > Labs). The server refuses links while the beta is off.
10 * Guests arrive through T3 Connect, so a policy that turns Connect off hides sharing too.
11 */
12 export function useCanShareWithGuest(environmentId: EnvironmentId | null): boolean {
13 const permitted = useAtomValue(serverEnvironment.createGuestShare.permissionAtom(environmentId));
14 return useAtomValue(environmentServerConfigsAtom, (configs) =>
15 canShareWithGuest(permitted, environmentId === null ? undefined : configs.get(environmentId)),
16 );
17 }