11import { type ProviderInstanceId } from "@t3tools/contracts" ;
22import { memo , useLayoutEffect , useMemo , useRef , useState } from "react" ;
3- import { Clock3Icon , SparklesIcon , StarIcon } from "lucide-react" ;
4- import { Gemini , GithubCopilotIcon } from "../Icons" ;
3+ import { SparklesIcon , StarIcon } from "lucide-react" ;
54import { ProviderInstanceIcon } from "./ProviderInstanceIcon" ;
65import { Tooltip , TooltipPopup , TooltipTrigger } from "../ui/tooltip" ;
76import { cn } from "~/lib/utils" ;
8- import type { ProviderInstanceEntry } from "../../providerInstances" ;
7+ import { isProviderInstancePickerReady , type ProviderInstanceEntry } from "../../providerInstances" ;
98
109/**
1110 * Build the hover tooltip for an instance button. Mirrors the old
@@ -14,17 +13,14 @@ import type { ProviderInstanceEntry } from "../../providerInstances";
1413 */
1514function describeUnavailableInstance ( entry : ProviderInstanceEntry ) : string {
1615 const label = entry . displayName ;
17- if ( entry . status === "ready" ) {
16+ if ( ! entry . enabled || entry . status === "disabled" ) {
17+ return `${ label } — Disabled in settings.` ;
18+ }
19+ if ( entry . status === "ready" && entry . isAvailable ) {
1820 return label ;
1921 }
2022 const kind =
21- entry . status === "error"
22- ? "Unavailable"
23- : entry . status === "warning"
24- ? "Limited"
25- : entry . status === "disabled"
26- ? "Disabled in settings"
27- : "Not ready" ;
23+ entry . status === "error" ? "Unavailable" : entry . status === "warning" ? "Limited" : "Not ready" ;
2824 const msg = entry . snapshot . message ?. trim ( ) ;
2925 return msg ? `${ label } — ${ kind } . ${ msg } ` : `${ label } — ${ kind } .` ;
3026}
@@ -34,7 +30,6 @@ const SELECTED_INDICATOR_CLASS =
3430const BADGE_BASE_CLASS =
3531 "pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm " ;
3632const NEW_BADGE_CLASS = `${ BADGE_BASE_CLASS } text-amber-600 dark:text-amber-300 ` ;
37- const SOON_BADGE_CLASS = `${ BADGE_BASE_CLASS } text-muted-foreground ` ;
3833
3934/** Opens toward the rail so the list stays readable (not over the model names). */
4035const PICKER_TOOLTIP_SIDE = "left" as const ;
@@ -53,8 +48,6 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
5348 instanceEntries : ReadonlyArray < ProviderInstanceEntry > ;
5449 /** Render the favorites rail entry. Hidden for locked-provider instance switching. */
5550 showFavorites ?: boolean ;
56- /** Render non-configured coming-soon provider entries. Hidden in scoped rails. */
57- showComingSoon ?: boolean ;
5851 /** Instance ids shown in the rail but unavailable for the current picker context. */
5952 disabledInstanceIds ?: ReadonlySet < ProviderInstanceId > ;
6053 getDisabledInstanceTooltip ?: ( entry : ProviderInstanceEntry ) => string ;
@@ -69,7 +62,6 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
6962 props . onSelectInstance ( instanceId ) ;
7063 } ;
7164 const showFavorites = props . showFavorites ?? true ;
72- const showComingSoon = props . showComingSoon ?? true ;
7365 const [ hoveredInstanceId , setHoveredInstanceId ] = useState < ProviderInstanceId | null > ( null ) ;
7466 const sidebarContentRef = useRef < HTMLDivElement > ( null ) ;
7567 const [ selectedIndicatorTop , setSelectedIndicatorTop ] = useState < number | null > ( null ) ;
@@ -159,7 +151,7 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
159151
160152 { /* Instance buttons (one per configured instance — built-in + custom) */ }
161153 { props . instanceEntries . map ( ( entry ) => {
162- const isUnavailable = ! entry . isAvailable || entry . status !== "ready" ;
154+ const isUnavailable = ! isProviderInstancePickerReady ( entry ) ;
163155 const isContextDisabled = props . disabledInstanceIds ?. has ( entry . instanceId ) ?? false ;
164156 const isDisabled = isUnavailable || isContextDisabled ;
165157 const isSelected = props . selectedInstanceId === entry . instanceId ;
@@ -251,76 +243,6 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
251243 </ div >
252244 ) ;
253245 } ) }
254-
255- { showComingSoon ? (
256- < >
257- { /* Gemini button (coming soon) */ }
258- < Tooltip >
259- < TooltipTrigger
260- render = {
261- < span className = "relative block w-full" >
262- < button
263- className = { cn (
264- "relative isolate flex w-full aspect-square items-center justify-center rounded-md opacity-50 cursor-not-allowed transition-colors hover:bg-transparent" ,
265- ) }
266- disabled
267- type = "button"
268- data-model-picker-provider = "gemini-coming-soon"
269- aria-label = "Gemini — coming soon"
270- >
271- < Gemini className = "size-5 text-muted-foreground/85" aria-hidden />
272- < span className = { SOON_BADGE_CLASS } aria-hidden >
273- < Clock3Icon className = "size-2" />
274- </ span >
275- </ button >
276- </ span >
277- }
278- />
279- < TooltipPopup
280- side = { PICKER_TOOLTIP_SIDE }
281- sideOffset = { PICKER_TOOLTIP_SIDE_OFFSET }
282- align = "center"
283- className = { PICKER_TOOLTIP_CLASS }
284- >
285- Gemini — Coming soon
286- </ TooltipPopup >
287- </ Tooltip >
288- { /* Github Copilot button (coming soon) */ }
289- < Tooltip >
290- < TooltipTrigger
291- render = {
292- < span className = "relative block w-full" >
293- < button
294- className = { cn (
295- "relative isolate flex w-full aspect-square items-center justify-center rounded-md opacity-50 cursor-not-allowed transition-colors hover:bg-transparent" ,
296- ) }
297- disabled
298- type = "button"
299- data-model-picker-provider = "github-copilot-coming-soon"
300- aria-label = "Github Copilot — coming soon"
301- >
302- < GithubCopilotIcon
303- className = "size-5 text-muted-foreground/85"
304- aria-hidden
305- />
306- < span className = { SOON_BADGE_CLASS } aria-hidden >
307- < Clock3Icon className = "size-2" />
308- </ span >
309- </ button >
310- </ span >
311- }
312- />
313- < TooltipPopup
314- side = { PICKER_TOOLTIP_SIDE }
315- sideOffset = { PICKER_TOOLTIP_SIDE_OFFSET }
316- align = "center"
317- className = { PICKER_TOOLTIP_CLASS }
318- >
319- Github Copilot — Coming soon
320- </ TooltipPopup >
321- </ Tooltip >
322- </ >
323- ) : null }
324246 </ div >
325247 </ div >
326248 </ div >
0 commit comments