The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { usesChatGptSharing } from "@t3tools/shared/usageLimits"; |
| 2 | import type { ServerProvider } from "@t3tools/contracts"; |
| 3 | import { T, useGT } from "gt-react"; |
| 4 | import { useId } from "react"; |
| 5 | import { OpenAI } from "../Icons"; |
| 6 | import { ChatGptUsageButton } from "../settings/ChatGptUsageButton"; |
| 7 | import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; |
| 8 | |
| 9 | export function ChatGptSharingControl({ provider }: { provider: ServerProvider | null }) { |
| 10 | const speedNoticeId = useId(); |
| 11 | const gt = useGT(); |
| 12 | const speedNotice = gt( |
| 13 | "Fast and Ultrafast are unavailable with this ChatGPT connection. Use an existing Codex CLI login for speed options your account supports.", |
| 14 | ); |
| 15 | if (!usesChatGptSharing(provider)) return null; |
| 16 | return ( |
| 17 | <div className="flex items-center justify-between gap-4 border-t px-3 py-2"> |
| 18 | <Tooltip> |
| 19 | <TooltipTrigger |
| 20 | render={ |
| 21 | <span |
| 22 | aria-describedby={speedNoticeId} |
| 23 | tabIndex={0} |
| 24 | className="flex items-center gap-2 rounded-sm text-xs text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring" |
| 25 | /> |
| 26 | } |
| 27 | > |
| 28 | <OpenAI className="size-3.5" aria-hidden="true" /> |
| 29 | <T>Using ChatGPT plan</T> |
| 30 | </TooltipTrigger> |
| 31 | <span id={speedNoticeId} className="sr-only"> |
| 32 | {speedNotice} |
| 33 | </span> |
| 34 | <TooltipPopup side="top">{speedNotice}</TooltipPopup> |
| 35 | </Tooltip> |
| 36 | <ChatGptUsageButton size="xs" /> |
| 37 | </div> |
| 38 | ); |
| 39 | } |