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 { NativeStackNavigationOptions } from "@react-navigation/native-stack"; |
| 2 | import { msg } from "gt-react-native"; |
| 3 | import { Platform } from "react-native"; |
| 4 | |
| 5 | import { brandTitleOffset, CompactBrandTitle } from "../../../components/CompactBrandTitle"; |
| 6 | import { WorkspaceConnectionTitle } from "../../home/WorkspaceConnectionTitle"; |
| 7 | import { m, type MessageResolver } from "../../../i18n/messages"; |
| 8 | |
| 9 | function renderCompactBrandTitle() { |
| 10 | return <CompactBrandTitle allowFontScaling={Platform.OS === "ios"} />; |
| 11 | } |
| 12 | |
| 13 | export function getCompactBrandHeaderOptions( |
| 14 | fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"], |
| 15 | resolve: MessageResolver = m, |
| 16 | ): NativeStackNavigationOptions { |
| 17 | return { |
| 18 | headerTitle: renderCompactBrandTitle, |
| 19 | headerTitleStyle: fallbackTitleStyle, |
| 20 | title: resolve(msg("Threads", { $context: "screen title, list of chat threads" })), |
| 21 | unstable_headerLeftItems: undefined, |
| 22 | }; |
| 23 | } |
| 24 | |
| 25 | export function getConnectionAwareBrandHeaderOptions(opts: { |
| 26 | readonly headerWidth: number; |
| 27 | readonly trailingItemCount?: number; |
| 28 | readonly onOpenEnvironments: () => void; |
| 29 | readonly fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"]; |
| 30 | readonly resolve?: MessageResolver; |
| 31 | }): NativeStackNavigationOptions { |
| 32 | const maxWidth = Math.max(0, opts.headerWidth - 64 - 44 * (opts.trailingItemCount ?? 1)); |
| 33 | |
| 34 | return { |
| 35 | ...getCompactBrandHeaderOptions(opts.fallbackTitleStyle, opts.resolve), |
| 36 | headerTitle: () => ( |
| 37 | <WorkspaceConnectionTitle |
| 38 | brand={<CompactBrandTitle />} |
| 39 | maxWidth={maxWidth} |
| 40 | onPress={opts.onOpenEnvironments} |
| 41 | statusOffset={brandTitleOffset()} |
| 42 | /> |
| 43 | ), |
| 44 | }; |
| 45 | } |