@devries-cameron20 / t3code Mirror · read-only / commits / d5f2333173
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 25, 07:30 UTC

Show hidden thread status in sidebar (#1517)

Julius Marminge committed Mar 29, 2026 at 11:47 UTC d5f2333173f6b01e38d6488dd7a2f157b479195f
3 files changed +77 -28
apps/web/src/components/Sidebar.logic.test.ts
+4
@@ -429,6 +429,9 @@ describe("getVisibleThreadsForProject", () => {
429 ThreadId.makeUnsafe("thread-6"),
430 ThreadId.makeUnsafe("thread-8"),
431 ]);
432 + expect(result.hiddenThreads.map((thread) => thread.id)).toEqual([
433 + ThreadId.makeUnsafe("thread-7"),
434 + ]);
435 });
436
437 it("returns all threads when the list is expanded", () => {
@@ -449,6 +452,7 @@ describe("getVisibleThreadsForProject", () => {
452 expect(result.visibleThreads.map((thread) => thread.id)).toEqual(
453 threads.map((thread) => thread.id),
454 );
455 + expect(result.hiddenThreads).toEqual([]);
456 });
457 });
458
apps/web/src/components/Sidebar.logic.ts
+5
@@ -244,6 +244,7 @@ export function getVisibleThreadsForProject(input: {
244 previewLimit: number;
245 }): {
246 hasHiddenThreads: boolean;
247 + hiddenThreads: Thread[];
248 visibleThreads: Thread[];
249 } {
250 const { activeThreadId, isThreadListExpanded, previewLimit, threads } = input;
@@ -252,6 +253,7 @@ export function getVisibleThreadsForProject(input: {
253 if (!hasHiddenThreads || isThreadListExpanded) {
254 return {
255 hasHiddenThreads,
256 + hiddenThreads: [],
257 visibleThreads: [...threads],
258 };
259 }
@@ -260,6 +262,7 @@ export function getVisibleThreadsForProject(input: {
262 if (!activeThreadId || previewThreads.some((thread) => thread.id === activeThreadId)) {
263 return {
264 hasHiddenThreads: true,
265 + hiddenThreads: threads.slice(previewLimit),
266 visibleThreads: previewThreads,
267 };
268 }
@@ -268,6 +271,7 @@ export function getVisibleThreadsForProject(input: {
271 if (!activeThread) {
272 return {
273 hasHiddenThreads: true,
274 + hiddenThreads: threads.slice(previewLimit),
275 visibleThreads: previewThreads,
276 };
277 }
@@ -276,6 +280,7 @@ export function getVisibleThreadsForProject(input: {
280
281 return {
282 hasHiddenThreads: true,
283 + hiddenThreads: threads.filter((thread) => !visibleThreadIds.has(thread.id)),
284 visibleThreads: threads.filter((thread) => visibleThreadIds.has(thread.id)),
285 };
286 }
apps/web/src/components/Sidebar.tsx
+68 -28
@@ -151,6 +151,44 @@ interface PrStatusIndicator {
151
152 type ThreadPr = GitStatusResult["pr"];
153
154 +function ThreadStatusLabel({
155 + status,
156 + compact = false,
157 +}: {
158 + status: NonNullable<ReturnType<typeof resolveThreadStatusPill>>;
159 + compact?: boolean;
160 +}) {
161 + if (compact) {
162 + return (
163 + <span
164 + title={status.label}
165 + className={`inline-flex size-3.5 shrink-0 items-center justify-center ${status.colorClass}`}
166 + >
167 + <span
168 + className={`size-[9px] rounded-full ${status.dotClass} ${
169 + status.pulse ? "animate-pulse" : ""
170 + }`}
171 + />
172 + <span className="sr-only">{status.label}</span>
173 + </span>
174 + );
175 + }
176 +
177 + return (
178 + <span
179 + title={status.label}
180 + className={`inline-flex items-center gap-1 text-[10px] ${status.colorClass}`}
181 + >
182 + <span
183 + className={`h-1.5 w-1.5 rounded-full ${status.dotClass} ${
184 + status.pulse ? "animate-pulse" : ""
185 + }`}
186 + />
187 + <span className="hidden md:inline">{status.label}</span>
188 + </span>
189 + );
190 +}
191 +
192 function terminalStatusFromRunningIds(
193 runningTerminalIds: string[],
194 ): TerminalStatusIndicator | null {
@@ -1023,14 +1061,18 @@ export default function Sidebar() {
1061 visibleThreads.filter((thread) => thread.projectId === project.id),
1062 appSettings.sidebarThreadSortOrder,
1063 );
1026 - const projectStatus = resolveProjectStatusIndicator(
1027 - projectThreads.map((thread) =>
1064 + const threadStatuses = new Map(
1065 + projectThreads.map((thread) => [
1066 + thread.id,
1067 resolveThreadStatusPill({
1068 thread,
1069 hasPendingApprovals: derivePendingApprovals(thread.activities).length > 0,
1070 hasPendingUserInput: derivePendingUserInputs(thread.activities).length > 0,
1071 }),
1033 - ),
1072 + ]),
1073 + );
1074 + const projectStatus = resolveProjectStatusIndicator(
1075 + projectThreads.map((thread) => threadStatuses.get(thread.id) ?? null),
1076 );
1077 const activeThreadId = routeThreadId ?? undefined;
1078 const isThreadListExpanded = expandedThreadListsByProject.has(project.id);
@@ -1039,13 +1081,19 @@ export default function Sidebar() {
1081 ? (projectThreads.find((thread) => thread.id === activeThreadId) ?? null)
1082 : null;
1083 const shouldShowThreadPanel = project.expanded || pinnedCollapsedThread !== null;
1042 - const { hasHiddenThreads, visibleThreads: visibleProjectThreads } =
1043 - getVisibleThreadsForProject({
1044 - threads: projectThreads,
1045 - activeThreadId,
1046 - isThreadListExpanded,
1047 - previewLimit: THREAD_PREVIEW_LIMIT,
1048 - });
1084 + const {
1085 + hasHiddenThreads,
1086 + hiddenThreads,
1087 + visibleThreads: visibleProjectThreads,
1088 + } = getVisibleThreadsForProject({
1089 + threads: projectThreads,
1090 + activeThreadId,
1091 + isThreadListExpanded,
1092 + previewLimit: THREAD_PREVIEW_LIMIT,
1093 + });
1094 + const hiddenThreadStatus = resolveProjectStatusIndicator(
1095 + hiddenThreads.map((thread) => threadStatuses.get(thread.id) ?? null),
1096 + );
1097 const orderedProjectThreadIds = projectThreads.map((thread) => thread.id);
1098 const renderedThreads = pinnedCollapsedThread
1099 ? [pinnedCollapsedThread]
@@ -1053,10 +1101,12 @@ export default function Sidebar() {
1101
1102 return {
1103 hasHiddenThreads,
1104 + hiddenThreadStatus,
1105 orderedProjectThreadIds,
1106 project,
1107 projectStatus,
1108 projectThreads,
1109 + threadStatuses,
1110 renderedThreads,
1111 shouldShowThreadPanel,
1112 isThreadListExpanded,
@@ -1198,10 +1248,12 @@ export default function Sidebar() {
1248 ) {
1249 const {
1250 hasHiddenThreads,
1251 + hiddenThreadStatus,
1252 orderedProjectThreadIds,
1253 project,
1254 projectStatus,
1255 projectThreads,
1256 + threadStatuses,
1257 renderedThreads,
1258 shouldShowThreadPanel,
1259 isThreadListExpanded,
@@ -1213,11 +1265,7 @@ export default function Sidebar() {
1265 const jumpLabel = threadJumpLabelById.get(thread.id) ?? null;
1266 const isThreadRunning =
1267 thread.session?.status === "running" && thread.session.activeTurnId != null;
1216 - const threadStatus = resolveThreadStatusPill({
1217 - thread,
1218 - hasPendingApprovals: derivePendingApprovals(thread.activities).length > 0,
1219 - hasPendingUserInput: derivePendingUserInputs(thread.activities).length > 0,
1220 - });
1268 + const threadStatus = threadStatuses.get(thread.id) ?? null;
1269 const prStatus = prStatusIndicator(prByThreadId.get(thread.id) ?? null);
1270 const terminalStatus = terminalStatusFromRunningIds(
1271 selectThreadTerminalState(terminalStateByThreadId, thread.id).runningTerminalIds,
@@ -1291,18 +1339,7 @@ export default function Sidebar() {
1339 <TooltipPopup side="top">{prStatus.tooltip}</TooltipPopup>
1340 </Tooltip>
1341 )}
1294 - {threadStatus && (
1295 - <span
1296 - className={`inline-flex items-center gap-1 text-[10px] ${threadStatus.colorClass}`}
1297 - >
1298 - <span
1299 - className={`h-1.5 w-1.5 rounded-full ${threadStatus.dotClass} ${
1300 - threadStatus.pulse ? "animate-pulse" : ""
1301 - }`}
1302 - />
1303 - <span className="hidden md:inline">{threadStatus.label}</span>
1304 - </span>
1305 - )}
1342 + {threadStatus && <ThreadStatusLabel status={threadStatus} />}
1343 {renamingThreadId === thread.id ? (
1344 <input
1345 ref={(el) => {
@@ -1548,7 +1585,10 @@ export default function Sidebar() {
1585 expandThreadListForProject(project.id);
1586 }}
1587 >
1551 - <span>Show more</span>
1588 + <span className="flex min-w-0 flex-1 items-center gap-2">
1589 + {hiddenThreadStatus && <ThreadStatusLabel status={hiddenThreadStatus} compact />}
1590 + <span>Show more</span>
1591 + </span>
1592 </SidebarMenuSubButton>
1593 </SidebarMenuSubItem>
1594 )}