Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
feat(sidebar): worktree indicator on session rows (#3057)
Icarus Wingsd9f59be7044a
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsxindex 38d7c3629..0d6b4b6d1 100644--- a/apps/web/src/components/Sidebar.tsx+++ b/apps/web/src/components/Sidebar.tsx@@ -17,6 +17,7 @@ import {resolveThreadPr,terminalStatusFromRunningIds,ThreadStatusLabel,+ ThreadWorktreeIndicator,} from "./ThreadStatusIndicators";import { ProjectFavicon } from "./ProjectFavicon";import { useAtomValue } from "@effect/atom-react";@@ -743,6 +744,7 @@ export const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThr</TooltipPopup></Tooltip>)}+ <ThreadWorktreeIndicator thread={thread} />{terminalStatus && (<Tooltip><TooltipTriggerdiff --git a/apps/web/src/components/ThreadStatusIndicators.test.tsx b/apps/web/src/components/ThreadStatusIndicators.test.tsxnew file mode 100644index 000000000..868bd2cd9--- /dev/null+++ b/apps/web/src/components/ThreadStatusIndicators.test.tsx@@ -0,0 +1,39 @@+import { ThreadId } from "@t3tools/contracts";+import { renderToStaticMarkup } from "react-dom/server";+import { describe, expect, it } from "vite-plus/test";++import { ThreadWorktreeIndicator } from "./ThreadStatusIndicators";++describe("ThreadWorktreeIndicator", () => {+ it("renders the worktree folder and branch in an accessible label", () => {+ const markup = renderToStaticMarkup(+ <ThreadWorktreeIndicator+ thread={{+ id: ThreadId.make("thread-1"),+ branch: "feature/sidebar-indicator",+ worktreePath: "/tmp/worktrees/sidebar-indicator",+ }}+ />,+ );++ expect(markup).toContain('role="img"');+ expect(markup).toContain(+ 'aria-label="Worktree: sidebar-indicator (feature/sidebar-indicator)"',+ );+ expect(markup).toContain('data-testid="thread-worktree-thread-1"');+ });++ it.each([null, "", " "])("renders nothing for an absent worktree path", (worktreePath) => {+ const markup = renderToStaticMarkup(+ <ThreadWorktreeIndicator+ thread={{+ id: ThreadId.make("thread-1"),+ branch: "main",+ worktreePath,+ }}+ />,+ );++ expect(markup).toBe("");+ });+});diff --git a/apps/web/src/components/ThreadStatusIndicators.tsx b/apps/web/src/components/ThreadStatusIndicators.tsxindex 8eac1fa41..3e85920d1 100644--- a/apps/web/src/components/ThreadStatusIndicators.tsx+++ b/apps/web/src/components/ThreadStatusIndicators.tsx@@ -4,7 +4,7 @@ import {scopeThreadRef,} from "@t3tools/client-runtime/environment";import type { VcsStatusResult } from "@t3tools/contracts";-import { CloudIcon, GitPullRequestIcon, TerminalIcon } from "lucide-react";+import { CloudIcon, FolderGit2Icon, GitPullRequestIcon, TerminalIcon } from "lucide-react";import { useMemo } from "react";import { useEnvironment, usePrimaryEnvironmentId } from "../state/environments";import { useProject } from "../state/entities";@@ -15,6 +15,7 @@ import { useUiStateStore } from "../uiStateStore";import { resolveChangeRequestPresentation } from "../sourceControlPresentation";import { resolveThreadStatusPill, type ThreadStatusPill } from "./Sidebar.logic";import type { SidebarThreadSummary } from "../types";+import { formatWorktreePathForDisplay } from "../worktreeCleanup";import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";export interface PrStatusIndicator {@@ -94,6 +95,40 @@ export function terminalStatusFromRunningIds(};}+export function ThreadWorktreeIndicator({+ thread,+}: {+ thread: Pick<SidebarThreadSummary, "id" | "branch" | "worktreePath">;+}) {+ const worktreePath = thread.worktreePath?.trim();+ if (!worktreePath) {+ return null;+ }++ const displayPath = formatWorktreePathForDisplay(worktreePath);+ const tooltip = thread.branch+ ? `Worktree: ${displayPath} (${thread.branch})`+ : `Worktree: ${displayPath}`;++ return (+ <Tooltip>+ <TooltipTrigger+ render={+ <span+ role="img"+ aria-label={tooltip}+ data-testid={`thread-worktree-${thread.id}`}+ className="inline-flex items-center justify-center"+ />+ }+ >+ <FolderGit2Icon className="size-3 text-muted-foreground/40" />+ </TooltipTrigger>+ <TooltipPopup side="top">{tooltip}</TooltipPopup>+ </Tooltip>+ );+}+export function ThreadStatusLabel({status,compact = false,