@@ -5146,8 +5146,17 @@ export default function Sidebar() {
51465146 // falling back to the top project) — same resolution the command palette
51475147 // uses. The command palette already offers a "New thread in..." submenu
51485148 // for multi-project setups.
5149+ // With the list filtered to one project, a new thread belongs there: no picker.
5150+ const startThreadInScopedProject = useCallback ( ( ) => {
5151+ const projectRef = scopedProjectGroup ?. memberProjectRefs [ 0 ] ;
5152+ if ( ! projectRef ) return false ;
5153+ if ( isMobile ) setOpenMobile ( false ) ;
5154+ void handleNewThreadRef . current ( projectRef ) ;
5155+ return true ;
5156+ } , [ isMobile , scopedProjectGroup , setOpenMobile ] ) ;
51495157 const handleNewThreadClick = useCallback (
51505158 ( event ?: ReactMouseEvent ) => {
5159+ if ( startThreadInScopedProject ( ) ) return ;
51515160 // One project: nothing to pick, create immediately. Shift+click creates
51525161 // directly in the current project even with several projects, skipping
51535162 // the palette picker.
@@ -5164,7 +5173,7 @@ export default function Sidebar() {
51645173 if ( isMobile ) setOpenMobile ( false ) ;
51655174 openCommandPalette ( { open : "new-thread-in" } ) ;
51665175 } ,
5167- [ isMobile , newThreadContext , projectGroups . length , setOpenMobile ] ,
5176+ [ isMobile , newThreadContext , projectGroups . length , setOpenMobile , startThreadInScopedProject ] ,
51685177 ) ;
51695178
51705179 // The button mirrors chat.new: in multi-project setups both route through
@@ -5847,7 +5856,17 @@ export default function Sidebar() {
58475856 </ button >
58485857 </ >
58495858 ) : scopedProjectGroup ? (
5850- `No threads in ${ scopedProjectGroup . displayName } yet`
5859+ < >
5860+ < span > { `No threads in ${ scopedProjectGroup . displayName } yet` } </ span >
5861+ < button
5862+ type = "button"
5863+ onClick = { startThreadInScopedProject }
5864+ className = "inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-sidebar-border px-2.5 py-1 text-2xs font-medium text-sidebar-muted-foreground transition-colors hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
5865+ >
5866+ < PlusIcon className = "-mx-0.5 size-3" />
5867+ New thread
5868+ </ button >
5869+ </ >
58515870 ) : (
58525871 "No threads yet"
58535872 ) }
0 commit comments