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, 03:37 UTC
| 1 | import { StackActions, useNavigation } from "@react-navigation/native"; |
| 2 | import { Platform } from "react-native"; |
| 3 | |
| 4 | import { useSelectWorkspaceDetail } from "./workspace/useSelectWorkspaceDetail"; |
| 5 | import type { WorkspaceDetail, WorkspaceDetailSheet } from "./workspace/workspace-detail-selection"; |
| 6 | |
| 7 | /** |
| 8 | * Opens a thread or pull request from another page. Android shows one detail page at a time, so |
| 9 | * it selects the detail; iOS pushes it over the current page, so Back returns there. A `sheet` |
| 10 | * opens over the detail on Android and on its own over the current page on iOS. |
| 11 | */ |
| 12 | export function useOpenWorkspaceDetail() { |
| 13 | const navigation = useNavigation(); |
| 14 | const selectDetail = useSelectWorkspaceDetail(); |
| 15 | return (detail: WorkspaceDetail, sheet?: WorkspaceDetailSheet) => { |
| 16 | if (Platform.OS === "android") selectDetail(detail, sheet); |
| 17 | else if (sheet) navigation.navigate(sheet.name, sheet.params); |
| 18 | else navigation.dispatch(StackActions.push(detail.name, detail.params)); |
| 19 | }; |
| 20 | } |