Skip to content

Commit 3b67088

Browse files
feat(web): with the sidebar filtered to a project, New thread starts there
The empty list of a filtered project offers the same button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ad782f1 commit 3b67088

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)