@@ -25,7 +25,7 @@ import {
2525 type AddProjectRemoteSourceReadiness ,
2626} from "@t3tools/client-runtime/operations/projects" ;
2727import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients" ;
28- import { connectionStatusText , connectionStatusTitle } from "@t3tools/client-runtime/connection" ;
28+ import { connectionStatusText } from "@t3tools/client-runtime/connection" ;
2929import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search" ;
3030import { resolveThreadReferenceCopyTarget } from "@t3tools/shared/threadReference" ;
3131import {
@@ -887,20 +887,6 @@ function OpenCommandPaletteDialog(props: {
887887 groups : projectGroups ,
888888 preferredProjectRef : contextualProjectRef ,
889889 } ) ;
890- const isEnvironmentReachable = ( environmentId : EnvironmentId ) =>
891- environments . some (
892- ( environment ) =>
893- environment . environmentId === environmentId && environment . connection . phase === "connected" ,
894- ) ;
895- const threadPickerProjects = buildSidebarProjectPickerEntries ( {
896- groups : projectGroups ,
897- preferredProjectRef : contextualProjectRef ,
898- expandCheckouts : true ,
899- isEnvironmentReachable,
900- } ) . map ( ( { group, targetProject } ) => ( {
901- ...targetProject ,
902- displayName : group . displayName ,
903- } ) ) ;
904890 const pickerProjects = projectPickerEntries . map ( ( { group, targetProject } ) => ( {
905891 ...targetProject ,
906892 displayName : group . displayName ,
@@ -1177,16 +1163,18 @@ function OpenCommandPaletteDialog(props: {
11771163 isScratchProject ( project , scratchWorkspaceRootFor ( project . environmentId ) ) ;
11781164 const projectItems = enumerateCommandPaletteItems (
11791165 buildProjectActionItems ( {
1180- projects : threadPickerProjects . filter ( ( project ) => ! isScratch ( project ) ) ,
1166+ projects : pickerProjects . filter ( ( project ) => ! isScratch ( project ) ) ,
11811167 valuePrefix : "new-thread-in" ,
1182- disabled : ( project ) => ! isEnvironmentReachable ( project . environmentId ) ,
1183- searchTerms : ( project ) => [
1184- projectEnvironmentLocationById . get ( project . environmentId ) ?. label ?? "Remote" ,
1185- ] ,
1168+ searchTerms : ( project ) => {
1169+ const group = projectGroupByTargetKey . get ( `${ project . environmentId } :${ project . id } ` ) ;
1170+ const location = projectEnvironmentLocationById . get ( project . environmentId ) ;
1171+ return [
1172+ ...( group ?. memberProjects . flatMap ( ( member ) => [ member . title , member . workspaceRoot ] ) ??
1173+ [ ] ) ,
1174+ ...( location ? [ location . label ] : [ ] ) ,
1175+ ] ;
1176+ } ,
11861177 renderDescription : ( project ) => {
1187- const environment = environments . find (
1188- ( candidate ) => candidate . environmentId === project . environmentId ,
1189- ) ;
11901178 const location = projectEnvironmentLocationById . get ( project . environmentId ) ?? {
11911179 kind : "remote" ,
11921180 label : "Remote" ,
@@ -1206,29 +1194,30 @@ function OpenCommandPaletteDialog(props: {
12061194 </ span >
12071195 < CommandPaletteMetaDot />
12081196 < span className = "truncate" > { project . workspaceRoot } </ span >
1209- { isEnvironmentReachable ( project . environmentId ) ? null : (
1210- < >
1211- < CommandPaletteMetaDot />
1212- < span className = "shrink-0" >
1213- { environment ? connectionStatusTitle ( environment . connection ) : "Unavailable" }
1214- </ span >
1215- </ >
1216- ) }
12171197 </ span >
12181198 ) ;
12191199 } ,
12201200 icon : projectFaviconIcon ,
12211201 runProject : async ( project ) => {
1222- await handleNewThread ( scopeProjectRef ( project . environmentId , project . id ) , {
1223- environmentSelection : "manual" ,
1224- } ) ;
1202+ const group = projectGroupByTargetKey . get ( `${ project . environmentId } :${ project . id } ` ) ;
1203+ const contextualRefBelongsToGroup =
1204+ contextualProjectRef !== null &&
1205+ group ?. memberProjectRefs . some (
1206+ ( projectRef ) =>
1207+ projectRef . environmentId === contextualProjectRef . environmentId &&
1208+ projectRef . projectId === contextualProjectRef . projectId ,
1209+ ) ;
1210+ await handleNewThread (
1211+ contextualRefBelongsToGroup
1212+ ? contextualProjectRef
1213+ : scopeProjectRef ( project . environmentId , project . id ) ,
1214+ ) ;
12251215 } ,
12261216 } ) ,
12271217 ) ;
12281218 if ( scratchTargetEnvironmentId === null ) return projectItems ;
12291219
1230- const noProjectIndex =
1231- threadPickerProjects [ 0 ] !== undefined && isScratch ( threadPickerProjects [ 0 ] ) ? 0 : 1 ;
1220+ const noProjectIndex = pickerProjects [ 0 ] !== undefined && isScratch ( pickerProjects [ 0 ] ) ? 0 : 1 ;
12321221 return [
12331222 ...projectItems . slice ( 0 , noProjectIndex ) ,
12341223 {
@@ -1631,7 +1620,7 @@ function OpenCommandPaletteDialog(props: {
16311620 title : "New thread in..." ,
16321621 icon : < SquarePenIcon className = { ITEM_ICON_CLASS } /> ,
16331622 addonIcon : < SquarePenIcon className = { ADDON_ICON_CLASS } /> ,
1634- groups : [ { value : "new-thread-in " , label : "Projects" , items : projectThreadItems } ] ,
1623+ groups : [ { value : "projects " , label : "Projects" , items : projectThreadItems } ] ,
16351624 } ) ;
16361625 }
16371626
@@ -1978,7 +1967,7 @@ function OpenCommandPaletteDialog(props: {
19781967 case "new-thread-in" :
19791968 pushPaletteView ( {
19801969 addonIcon : < SquarePenIcon className = { ADDON_ICON_CLASS } /> ,
1981- groups : [ { value : "new-thread-in " , label : "Projects" , items : projectThreadItems } ] ,
1970+ groups : [ { value : "projects " , label : "Projects" , items : projectThreadItems } ] ,
19821971 } ) ;
19831972 return ;
19841973 case "change-theme" :
@@ -2125,9 +2114,7 @@ function OpenCommandPaletteDialog(props: {
21252114 ? changeThemeItem . groups
21262115 : currentView ?. groups [ 0 ] ?. value === "appearance"
21272116 ? changeAppearanceItem . groups
2128- : currentView ?. groups [ 0 ] ?. value === "new-thread-in"
2129- ? [ { value : "new-thread-in" , label : "Projects" , items : projectThreadItems } ]
2130- : ( currentView ?. groups ?? rootGroups ) ;
2117+ : ( currentView ?. groups ?? rootGroups ) ;
21312118
21322119 const filteredGroups = filterCommandPaletteGroups ( {
21332120 activeGroups,
0 commit comments