The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { Keyboard } from "react-native"; |
| 2 | |
| 3 | import { useAdaptiveWorkspaceLayout } from "../adaptive-workspace-context"; |
| 4 | import { useWorkspaceTabs } from "./WorkspaceTabsContext"; |
| 5 | import type { WorkspaceTab } from "./workspace-tabs-state"; |
| 6 | |
| 7 | /** Opens a workspace tab, Settings included, from a tab bar, rail, toolbar or command. */ |
| 8 | export function useSelectWorkspaceTab() { |
| 9 | const dispatch = useWorkspaceTabs()?.dispatch; |
| 10 | const { openWorkspaceTab } = useAdaptiveWorkspaceLayout(); |
| 11 | return (tab: WorkspaceTab | "settings") => { |
| 12 | Keyboard.dismiss(); |
| 13 | openWorkspaceTab(tab); |
| 14 | if (tab !== "settings") dispatch?.({ type: "select", tab }); |
| 15 | }; |
| 16 | } |