The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Dialog from "../../components/ui/Dialog"; |
| 2 | import type { ServerProvider } from "@t3tools/contracts"; |
| 3 | import { CHATGPT_USAGE_URL, usesChatGptSharing } from "@t3tools/shared/usageLimits"; |
| 4 | import { T, useGT } from "gt-react-native"; |
| 5 | import { Pressable, View } from "react-native"; |
| 6 | import { tryOpenExternalUrl } from "../../lib/openExternalUrl"; |
| 7 | import { AppText as Text } from "../../components/ui/AppText"; |
| 8 | import { ProviderIcon } from "../../components/ProviderIcon"; |
| 9 | |
| 10 | export function ChatGptSharingStatus({ provider }: { provider: ServerProvider | null }) { |
| 11 | const gt = useGT(); |
| 12 | if (!usesChatGptSharing(provider)) return null; |
| 13 | return ( |
| 14 | <View className="flex-row items-center justify-between gap-3 px-3 py-1"> |
| 15 | <Pressable |
| 16 | accessibilityRole="button" |
| 17 | accessibilityLabel={gt("ChatGPT token sharing is active")} |
| 18 | className="min-h-11 flex-row items-center gap-2" |
| 19 | onPress={() => { |
| 20 | Dialog.alert( |
| 21 | gt("ChatGPT sharing is on"), |
| 22 | [ |
| 23 | provider?.auth.email, |
| 24 | gt( |
| 25 | "Eligible usage uses your ChatGPT plan. Credit settings and limits are managed in ChatGPT.", |
| 26 | ), |
| 27 | gt( |
| 28 | "Fast and Ultrafast are unavailable with this ChatGPT connection. Use an existing Codex CLI login for speed options your account supports.", |
| 29 | ), |
| 30 | ] |
| 31 | .filter(Boolean) |
| 32 | .join("\n\n"), |
| 33 | ); |
| 34 | }} |
| 35 | > |
| 36 | <ProviderIcon provider="codex" size={14} /> |
| 37 | <Text className="text-xs text-foreground-muted"> |
| 38 | <T>Using ChatGPT plan</T> |
| 39 | </Text> |
| 40 | </Pressable> |
| 41 | <Pressable |
| 42 | accessibilityRole="link" |
| 43 | className="min-h-11 justify-center" |
| 44 | onPress={() => void tryOpenExternalUrl(CHATGPT_USAGE_URL)} |
| 45 | > |
| 46 | <Text className="text-xs font-t3-medium text-primary"> |
| 47 | <T>Manage usage</T> |
| 48 | </Text> |
| 49 | </Pressable> |
| 50 | </View> |
| 51 | ); |
| 52 | } |