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 { Linking, Pressable, View } from "react-native";
5import { AppText as Text } from "../../components/ui/AppText";
6import { ProviderIcon } from "../../components/ProviderIcon";
7
8export function ChatGptSharingStatus({ provider }: { provider: ServerProvider | null }) {
9 if (!usesChatGptSharing(provider)) return null;
10 return (
11 <View className="flex-row items-center justify-between gap-3 px-3 py-1">
12 <Pressable
13 accessibilityRole="button"
14 accessibilityLabel="ChatGPT token sharing is active"
15 className="min-h-11 flex-row items-center gap-2"
16 onPress={() => {
17 Dialog.alert(
18 "ChatGPT sharing is on",
19 [
20 provider?.auth.email,
21 "Eligible usage uses your ChatGPT plan. Credit settings and limits are managed in ChatGPT.",
22 "Fast and Ultrafast are unavailable with this ChatGPT connection. Use an existing Codex CLI login for speed options your account supports.",
23 ]
24 .filter(Boolean)
25 .join("\n\n"),
26 );
27 }}
28 >
29 <ProviderIcon provider="codex" size={14} />
30 <Text className="text-xs text-foreground-muted">Using ChatGPT plan</Text>
31 </Pressable>
32 <Pressable
33 accessibilityRole="link"
34 className="min-h-11 justify-center"
35 onPress={() => void Linking.openURL(CHATGPT_USAGE_URL).catch(() => undefined)}
36 >
37 <Text className="text-xs font-t3-medium text-primary">Manage usage</Text>
38 </Pressable>
39 </View>
40 );
41}