Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat: ChatGPT Business usage limits offer a copyable admin request #23361

Mergedjuliusmarmingemerged 3 commits intomain fromrefs/pull/23361/headmerged by juliusmarminge View on GitHub

Showing 13 changed files with 93 additions and 4 deletions (loading 10).

x
0 of 13 viewed, 13 left
69 additions and 0 deletionsapps/mobile/src/features/threads/ChatGptUsageLimitNotice.tsxAdded
View file
@@ -0,0 +1,69 @@
+import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
+import {
+ CHATGPT_USAGE_LIMIT_CODE,
+ CHATGPT_USAGE_URL,
+ CHATGPT_WORKSPACE_ADMIN_REQUEST,
+ CHATGPT_WORKSPACE_USAGE_LIMIT_CODE,
+} from "@t3tools/shared/usageLimits";
+import * as Clipboard from "expo-clipboard";
+import { useState } from "react";
+import { Linking, View } from "react-native";
+import { ProviderIcon } from "../../components/ProviderIcon";
+import { AppText as Text } from "../../components/ui/AppText";
+import { Button } from "../../components/ui/Button";
+​
+export function ChatGptUsageLimitNotice({ thread }: { thread: EnvironmentThreadShell }) {
+ const [status, setStatus] = useState<"copied" | "copy-failed" | "open-failed" | null>(null);
+ const code = thread.runtime?.lastErrorCode;
+ const workspaceLimit = code === CHATGPT_WORKSPACE_USAGE_LIMIT_CODE;
+ if (thread.runtime?.status !== "failed" || (!workspaceLimit && code !== CHATGPT_USAGE_LIMIT_CODE))
+ return null;
+ return (
+ <View
+ accessibilityRole="alert"
+ className="mx-3 mb-2 gap-2 rounded-xl border border-border-subtle bg-screen p-3"
+ >
+ <View className="flex-row items-center gap-2">
+ <ProviderIcon provider="codex" size={16} />
+ <Text className="text-sm font-t3-medium text-foreground">ChatGPT usage limit reached</Text>
+ </View>
+ <Text className="text-xs text-foreground-muted">