Skip to content

Commit fc2b5de

Browse files
fix(web): a project filter that hides every active thread says so and offers Show all projects (#35426)
1 parent 63d5c6d commit fc2b5de

1 file changed

Lines changed: 45 additions & 31 deletions

File tree

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

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3285,6 +3285,51 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
32853285
</p>
32863286
)
32873287
) : null}
3288+
{/* A scope can hide every active thread; say so even when its project still has settled ones. */}
3289+
{!isSearchingThreads &&
3290+
!hasProjectFolders &&
3291+
visibleDraftSessionCount === 0 &&
3292+
pinnedThreads.length +
3293+
activeThreads.length +
3294+
workingThreads.length +
3295+
snoozedThreads.length ===
3296+
0 &&
3297+
(settledCount === 0 || scopedProjectGroups.length > 0) ? (
3298+
<div className="flex flex-col items-center gap-2 px-2 py-6 text-center text-xs text-muted-foreground/60">
3299+
{projects.length === 0 ? (
3300+
<>
3301+
<span>No projects yet</span>
3302+
<button
3303+
type="button"
3304+
onClick={openAddProjectCommandPalette}
3305+
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"
3306+
>
3307+
<PlusIcon className="-mx-0.5 size-3" />
3308+
Add project
3309+
</button>
3310+
</>
3311+
) : scopedProjectGroups.length > 0 ? (
3312+
<>
3313+
<span>
3314+
{`No ${settledCount > 0 ? "active threads" : "threads"} in ${
3315+
scopedProjectGroups.length > 1
3316+
? "these projects"
3317+
: scopedProjectGroups[0]!.displayName
3318+
}${settledCount > 0 ? "" : " yet"}`}
3319+
</span>
3320+
<button
3321+
type="button"
3322+
onClick={() => setProjectScopeKeys([])}
3323+
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"
3324+
>
3325+
Show all projects
3326+
</button>
3327+
</>
3328+
) : (
3329+
"No threads yet"
3330+
)}
3331+
</div>
3332+
) : null}
32883333
{!isSearchingThreads ? (
32893334
<TooltipProvider
32903335
key="sidebar-thread-tooltips-150"
@@ -3621,37 +3666,6 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
36213666
</DndContext>
36223667
</TooltipProvider>
36233668
) : null}
3624-
{!isSearchingThreads &&
3625-
!hasProjectFolders &&
3626-
visibleDraftSessionCount === 0 &&
3627-
pinnedThreads.length +
3628-
activeThreads.length +
3629-
workingThreads.length +
3630-
snoozedThreads.length +
3631-
settledCount ===
3632-
0 ? (
3633-
<div className="flex flex-col items-center gap-2 px-2 py-6 text-center text-xs text-muted-foreground/60">
3634-
{projects.length === 0 ? (
3635-
<>
3636-
<span>No projects yet</span>
3637-
<button
3638-
type="button"
3639-
onClick={openAddProjectCommandPalette}
3640-
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"
3641-
>
3642-
<PlusIcon className="-mx-0.5 size-3" />
3643-
Add project
3644-
</button>
3645-
</>
3646-
) : scopedProjectGroups.length > 1 ? (
3647-
"No threads in these projects yet"
3648-
) : scopedProjectGroups[0] ? (
3649-
`No threads in ${scopedProjectGroups[0].displayName} yet`
3650-
) : (
3651-
"No threads yet"
3652-
)}
3653-
</div>
3654-
) : null}
36553669
</SidebarGroup>
36563670
</SidebarContent>
36573671
<SidebarChromeFooter />

0 commit comments

Comments
 (0)