feat(web): boring sidebar groups threads into project folders #21039
Mergedt3dotgg(GitHub profile, opens in a new tab)merged 7 commits into
main fromrefs/pull/21039/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- apps/web/src/components/settings/SettingsPanels.tsx line 603Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -734,5 +728,4 @@734728 environmentIdentificationMode: DEFAULT_UNIFIED_SETTINGS.environmentIdentificationMode,735729 glassOpacity: DEFAULT_UNIFIED_SETTINGS.glassOpacity,736730 panelAnimationDurationMs: DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs,737- sidebarThreadPreviewCount: DEFAULT_UNIFIED_SETTINGS.sidebarThreadPreviewCount,738731 sidebarProjectGroupingMode: DEFAULT_UNIFIED_SETTINGS.sidebarProjectGroupingMode,apps/web/src/components/settings/settingsSearch.ts line 988OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -844,10 +846,11 @@844846 },845847 {846848 id: "review-guides",847- title: "Review guides (beta)",848- to: "/settings/source-control",849+ title: "Review guides",850+ to: "/settings/beta",849851 searchTerms: ["pull request pr guided review guide tour beta experimental"],850852 environmentOnly: true,853+ scope: "environment-defaults",851854 },852855 {853856 id: "review-guide-model",
- apps/web/src/components/settings/settingsSearch.ts line 858OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -844,12 +846,13 @@844846 },845847 {846848 id: "review-guides",847- title: "Review guides (beta)",848- to: "/settings/source-control",849+ title: "Review guides",850+ to: "/settings/beta",849851 searchTerms: ["pull request pr guided review guide tour beta experimental"],850852 environmentOnly: true,853+ scope: "environment-defaults",851854 },852855 {853856 id: "review-guide-model",854857 title: "Review guide model",855- to: "/settings/source-control",858+ to: "/settings/beta",apps/web/src/components/Sidebar.tsx line 553OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -520,10 +541,13 @@520541 const visibleWorkingThreads = workingShelfExpanded521542 ? workingThreads522543 : routeThreadOnly(workingThreads, routeThreadKey);523- const orderedThreads = [524- ...pinnedThreads,525- ...activeThreads,526- ...visibleWorkingThreads,527- ...visibleSnoozedThreads,528- ...renderedSettledThreads,529- ];544+ const projectFolders =545+ folderGroups === null546+ ? null547+ : groupSidebarThreadsByProject({548+ groups: folderGroups,549+ inbox: activeThreads,550+ settled: settledThreads,551+ }).map((folder) => {552+ const projectKey = folder.group.projectKey;553+ const collapsed = projectExpandedById[projectKey] === false;apps/web/src/components/Sidebar.tsx lines 1433 to 1440OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -1292,0 +1420,21 @@1420+ </span>1421+ {folderDot ? (1422+ <span1423+ aria-hidden1424+ className={cn("size-1.5 shrink-0 rounded-full", FOLDER_DOT_CLASS_NAME[folderDot])}1425+ />1426+ ) : null}1427+ {collapsed && hiddenInbox.length > 0 ? (1428+ <span className="shrink-0 text-xs text-secondary-label tabular-nums">1429+ {hiddenInbox.length}1430+ </span>1431+ ) : null}1432+ </button>1433+ <button1434+ type="button"1435+ aria-label={`New thread in ${group.displayName}`}1436+ onClick={() => props.onNewThread(group)}1437+ className="absolute inset-y-0 right-1 my-auto inline-flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity outline-none hover:text-foreground focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring group-hover/project-folder:opacity-100 pointer-coarse:opacity-100"1438+ >1439+ <SquarePenIcon aria-hidden className="size-3.5" />1440+ </button>
- apps/web/src/components/Sidebar.tsx line 571OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -538,10 +559,13 @@538559 const visibleWorkingThreads = workingShelfExpanded539560 ? workingThreads540561 : routeThreadOnly(workingThreads, routeRowThreadKey);541- const orderedThreads = [542- ...pinnedThreads,543- ...activeThreads,544- ...visibleWorkingThreads,545- ...visibleSnoozedThreads,546- ...renderedSettledThreads,547- ];562+ const projectFolders =563+ folderGroups === null564+ ? null565+ : groupSidebarThreadsByProject({566+ groups: folderGroups,567+ inbox: activeThreads,568+ settled: settledThreads,569+ }).map((folder) => {570+ const projectKey = folder.group.projectKey;571+ const collapsed = projectExpandedById[projectKey] === false;apps/web/src/components/Sidebar.tsx lines 590 to 590OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -547,0 +570,21 @@570+ const projectKey = folder.group.projectKey;571+ const collapsed = projectExpandedById[projectKey] === false;572+ const settledCount = folderSettledCounts.get(projectKey);573+ const shownSettled =574+ collapsed || settledCount === undefined575+ ? routeThreadOnly(folder.settled, routeRowThreadKey)576+ : [577+ ...folder.settled.slice(0, settledCount),578+ ...routeThreadOnly(folder.settled.slice(settledCount), routeRowThreadKey),579+ ];580+ return {581+ group: folder.group,582+ collapsed,583+ inbox: collapsed ? routeThreadOnly(folder.inbox, routeRowThreadKey) : folder.inbox,584+ // Collapsed folders still hint at what they hold.585+ hiddenInbox: collapsed ? folder.inbox : EMPTY_THREADS,586+ settled: shownSettled,587+ settledExpanded: !collapsed && settledCount !== undefined,588+ settledTotal: folder.settled.length,589+ hiddenSettledCount:590+ settledCount === undefined ? 0 : Math.max(folder.settled.length - settledCount, 0),
- apps/web/src/components/Sidebar.tsx lines 489 to 492OutdatedResolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -463,3 +474,19 @@463474 const visibleWorkingThreads = workingShelfExpanded464475 ? workingThreads465476 : routeThreadOnly(workingThreads, routeRowThreadKey);477+ const projectFolders =478+ folderGroups === null479+ ? null480+ : groupSidebarThreadsByProject(folderGroups, activeThreads).map((folder) => {481+ const collapsed = !resolveProjectExpanded(482+ projectExpandedById,483+ sidebarFolderExpansionKeys(folder.group),484+ );485+ return {486+ group: folder.group,487+ collapsed,488+ // A closed folder still shows the open thread, and hints at the rest.489+ threads: collapsed490+ ? routeThreadOnly(folder.threads, routeRowThreadKey)491+ : folder.threads,492+ hiddenThreads: collapsed ? folder.threads : EMPTY_THREADS,apps/web/src/components/Sidebar.tsx lines 1198 to 1221Resolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -1113,0 +1153,21 @@1153+ void handleNewThread(scopeProjectRef(group.environmentId, group.id));1154+ });1155+ const handleProjectFolderContextMenu = useStableCallback(1156+ (group: SidebarProjectSnapshot, position: { x: number; y: number }) => {1157+ const api = readLocalApi();1158+ if (!api) return;1159+ void (async () => {1160+ const clicked = await api.contextMenu.show(1161+ [1162+ { id: "new-thread", label: "New thread" },1163+ { id: "copy-path", label: "Copy path" },1164+ { id: "project-settings", label: "Project settings", icon: "settings" },1165+ ],1166+ position,1167+ );1168+ if (clicked === "new-thread") startThreadInProjectFolder(group);1169+ if (clicked === "copy-path") {1170+ copyPathToClipboard(group.workspaceRoot, { path: group.workspaceRoot });1171+ }1172+ if (clicked === "project-settings") openProjectSettings(group);1173+ })();apps/web/src/components/sidebar/SidebarProjectFolderHeader.tsx lines 83 to 87Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +52,21 @@52+ >53+ <button54+ type="button"55+ aria-expanded={!collapsed}56+ onClick={() => props.onToggle(group)}57+ onContextMenu={(event) => {58+ event.preventDefault();59+ props.onContextMenu(group, { x: event.clientX, y: event.clientY });60+ }}61+ className="flex h-8 w-full cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-left outline-none hover:bg-sidebar-row-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"62+ >63+ <ProjectFavicon project={group} className="size-4 shrink-0" />64+ <span className="min-w-0 flex-1 truncate text-sm font-medium text-sidebar-foreground/90">65+ {group.displayName}66+ </span>67+ {dot ? (68+ <span69+ aria-hidden70+ className={cn("size-1.5 shrink-0 rounded-full", FOLDER_DOT_CLASS_NAME[dot])}71+ />72+ ) : null}
- apps/web/src/components/Sidebar.tsx lines 413 to 415Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -400,5 +408,8 @@400408 threads,401409 delegatedUnderParent,402410 routeRowThreadKey,411+ folderGroups,403412 } = input;404- const workingShelfEnabled = useClientSettings((s) => s.sidebarWorkingShelfEnabled);413+ // Folders already separate the work, so boring mode has no Working shelf.414+ const workingShelfEnabled =415+ useClientSettings((s) => s.sidebarWorkingShelfEnabled) && folderGroups === null;
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.



macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed