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

ChatGptSharingControl.tsx

37 lines1.4 KB

1import { usesChatGptSharing } from "@t3tools/shared/usageLimits";
2import type { ServerProvider } from "@t3tools/contracts";
3import { useId } from "react";
4import { OpenAI } from "../Icons";
5import { ChatGptUsageButton } from "../settings/ChatGptUsageButton";
6import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
7​
8const speedNotice =
9 "Fast and Ultrafast are unavailable with this ChatGPT connection. Use an existing Codex CLI login for speed options your account supports.";
10​
11export function ChatGptSharingControl({ provider }: { provider: ServerProvider | null }) {
12 const speedNoticeId = useId();
13 if (!usesChatGptSharing(provider)) return null;
14 return (
15 <div className="flex items-center justify-between gap-4 border-t px-3 py-2">
16 <Tooltip>
17 <TooltipTrigger
18 render={
19 <span
20 aria-describedby={speedNoticeId}
21 tabIndex={0}
22 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"
23 />
24 }
25 >
26 <OpenAI className="size-3.5" aria-hidden="true" />
27 Using ChatGPT plan
28 </TooltipTrigger>
29 <span id={speedNoticeId} className="sr-only">
30 {speedNotice}
31 </span>
32 <TooltipPopup side="top">{speedNotice}</TooltipPopup>
33 </Tooltip>
34 <ChatGptUsageButton size="xs" />
35 </div>
36 );