@@ -1026,52 +1026,39 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
10261026 ] }
10271027 onChange = { ( value ) => {
10281028 if ( value === "settingsButtonClicked" ) {
1029- // Handle special actions
1030- vscode . postMessage ( {
1031- type : "loadApiConfiguration" ,
1032- text : value ,
1033- } )
1029+ vscode . postMessage ( { type : "loadApiConfiguration" , text : value } )
10341030 } else {
1035- // Use the ID directly with our new message type
1036- vscode . postMessage ( {
1037- type : "loadApiConfigurationById" ,
1038- text : value ,
1039- } )
1031+ vscode . postMessage ( { type : "loadApiConfigurationById" , text : value } )
10401032 }
10411033 } }
10421034 contentClassName = "max-h-[300px] overflow-y-auto"
10431035 triggerClassName = "w-full text-ellipsis overflow-hidden"
1044- renderItem = { ( option ) => {
1045- if ( option . type !== DropdownOptionType . ITEM ) {
1046- return option . label
1036+ renderItem = { ( { type , value , label , pinned } ) => {
1037+ if ( type !== DropdownOptionType . ITEM ) {
1038+ return label
10471039 }
10481040
1049- // Get the config from listApiConfigMeta by ID
1050- const config = listApiConfigMeta ?. find ( ( c ) => c . id === option . value )
1041+ const config = listApiConfigMeta ?. find ( ( c ) => c . id === value )
10511042 const isCurrentConfig = config ?. name === currentApiConfigName
10521043
10531044 return (
1054- < div className = "flex items-center justify-between w-full" >
1055- < span > { option . label } </ span >
1056- < div
1057- className = { cn (
1058- "ml-2 p-1 rounded-sm cursor-pointer hover:bg-[rgba(255,255,255,0.1)]" ,
1059- option . pinned
1060- ? "text-vscode-focusBorder"
1061- : "text-vscode-descriptionForeground opacity-50 hover:opacity-100" ,
1062- ) }
1063- onClick = { ( e ) => {
1064- e . stopPropagation ( )
1065- togglePinnedApiConfig ( option . value )
1066- vscode . postMessage ( {
1067- type : "toggleApiConfigPin" ,
1068- text : option . value , // Send ID as text
1069- } )
1070- } }
1071- title = { option . pinned ? t ( "chat:unpin" ) : t ( "chat:pin" ) } >
1072- < Pin className = "size-3" />
1045+ < div className = "flex items-center justify-between gap-2 w-full" >
1046+ < div className = { cn ( { "font-medium" : isCurrentConfig } ) } > { label } </ div >
1047+ < div className = "flex items-center gap-1" >
1048+ < Button
1049+ variant = "ghost"
1050+ size = "icon"
1051+ title = { pinned ? t ( "chat:unpin" ) : t ( "chat:pin" ) }
1052+ onClick = { ( e ) => {
1053+ e . stopPropagation ( )
1054+ togglePinnedApiConfig ( value )
1055+ vscode . postMessage ( { type : "toggleApiConfigPin" , text : value } )
1056+ } }
1057+ className = { cn ( "w-5 h-5" , { "bg-accent" : pinned } ) } >
1058+ < Pin className = "size-3 p-0.5 opacity-50" />
1059+ </ Button >
1060+ { isCurrentConfig && < Check className = "size-3" /> }
10731061 </ div >
1074- { isCurrentConfig && < Check className = "size-4 p-0.5 ml-1" /> }
10751062 </ div >
10761063 )
10771064 } }
0 commit comments