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, 04:45 UTC
| 1 | import type { NavigationState } from "@react-navigation/native"; |
| 2 | import { pullRequestListKey } from "./pullRequestList"; |
| 3 | |
| 4 | export function selectedPullRequestKey(state: Pick<NavigationState, "routes" | "index">) { |
| 5 | for (let index = state.index; index >= 0; index--) { |
| 6 | const route = state.routes[index]; |
| 7 | if (!route) continue; |
| 8 | if (route.name === "Home" || route.name.startsWith("Thread")) return null; |
| 9 | if (!route.name.startsWith("PullRequest")) continue; |
| 10 | const params = route.params; |
| 11 | if ( |
| 12 | params && |
| 13 | "environmentId" in params && |
| 14 | "host" in params && |
| 15 | "repository" in params && |
| 16 | "number" in params && |
| 17 | typeof params.environmentId === "string" && |
| 18 | typeof params.host === "string" && |
| 19 | typeof params.repository === "string" && |
| 20 | typeof params.number === "number" |
| 21 | ) { |
| 22 | return `${params.environmentId}:${pullRequestListKey({ |
| 23 | host: params.host, |
| 24 | repository: params.repository, |
| 25 | number: params.number, |
| 26 | })}`; |
| 27 | } |
| 28 | if (route.name === "PullRequest") return null; |
| 29 | } |
| 30 | return null; |
| 31 | } |