Open History to see the last commit
1import * as Dialog from "../../components/ui/Dialog";
2import type { ServerProvider } from "@t3tools/contracts";
3import { CHATGPT_USAGE_URL, usesChatGptSharing } from "@t3tools/shared/usageLimits";
4import { T, useGT } from "gt-react-native";
5import { Pressable, View } from "react-native";
6import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
7import { AppText as Text } from "../../components/ui/AppText";
8import { ProviderIcon } from "../../components/ProviderIcon";
9
10export 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}