Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ChatGptSharingStatus.tsx

40 lines1.6 KB

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 ]
23 .filter(Boolean)
24 .join("\n\n"),
25 );
26 }}
27 >
28 <ProviderIcon provider="codex" size={14} />
29 <Text className="text-xs text-foreground-muted">Using ChatGPT plan</Text>
30 </Pressable>
31 <Pressable
32 accessibilityRole="link"
33 className="min-h-11 justify-center"
34 onPress={() => void Linking.openURL(CHATGPT_USAGE_URL).catch(() => undefined)}
35 >
36 <Text className="text-xs font-t3-medium text-primary">Manage usage</Text>
37 </Pressable>
38 </View>
39 );