The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { useGT } from "gt-react-native"; |
| 2 | |
| 3 | import { usePaneRole } from "../../components/ui/Pane"; |
| 4 | import { useAdaptiveWorkspaceLayout, useWorkspacePaneState } from "./adaptive-workspace-context"; |
| 5 | |
| 6 | /** The content pane's sidebar button, or null where there's no sidebar beside it to toggle. */ |
| 7 | export function useSidebarToggle() { |
| 8 | const gt = useGT(); |
| 9 | const role = usePaneRole(); |
| 10 | const { layout, togglePrimarySidebar } = useAdaptiveWorkspaceLayout(); |
| 11 | const { panes, sidebarToggleable } = useWorkspacePaneState(); |
| 12 | if (role !== "content" || !sidebarToggleable) return null; |
| 13 | const maximizes = panes.primarySidebarVisible && layout.variant !== "medium"; |
| 14 | return { |
| 15 | visible: panes.primarySidebarVisible, |
| 16 | accessibilityLabel: panes.primarySidebarVisible |
| 17 | ? maximizes |
| 18 | ? gt("Maximize content") |
| 19 | : gt("Hide sidebar") |
| 20 | : gt("Show sidebar"), |
| 21 | icon: maximizes ? "arrow.up.left.and.arrow.down.right" : "sidebar.left", |
| 22 | onPress: togglePrimarySidebar, |
| 23 | } as const; |
| 24 | } |