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: replace worktree toggle with discoverable Select dropdown (#1001)
Zortos36473f7de6f3
diff --git a/apps/web/src/components/BranchToolbar.tsx b/apps/web/src/components/BranchToolbar.tsxindex b2c60b242..e0ffa05c2 100644--- a/apps/web/src/components/BranchToolbar.tsx+++ b/apps/web/src/components/BranchToolbar.tsx@@ -1,4 +1,5 @@import type { ThreadId } from "@t3tools/contracts";+import { FolderIcon, GitForkIcon } from "lucide-react";import { useCallback } from "react";import { newCommandId } from "../lib/utils";@@ -11,8 +12,14 @@ import {resolveEffectiveEnvMode,} from "./BranchToolbar.logic";import { BranchToolbarBranchSelector } from "./BranchToolbarBranchSelector";+import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "./ui/select";import { Button } from "./ui/button";+const envModeItems = [+ { value: "local", label: "Local" },+ { value: "worktree", label: "New worktree" },+] as const;+interface BranchToolbarProps {threadId: ThreadId;onEnvModeChange: (mode: EnvMode) => void;@@ -104,23 +111,50 @@ export default function BranchToolbar({return (<div className="mx-auto flex w-full max-w-3xl items-center justify-between px-5 pb-3 pt-1">- <div className="flex items-center gap-2">- {envLocked || activeWorktreePath ? (- <span className="border border-transparent px-[calc(--spacing(2)-1px)] text-sm font-medium text-muted-foreground/70 sm:text-xs">- {activeWorktreePath ? "Worktree" : "Local"}- </span>- ) : (- <Button- type="button"- variant="ghost"- className="text-muted-foreground/70 hover:text-foreground/80"- size="xs"- onClick={() => onEnvModeChange(effectiveEnvMode === "local" ? "worktree" : "local")}- >- {effectiveEnvMode === "worktree" ? "New worktree" : "Local"}- </Button>- )}- </div>+ {envLocked || activeWorktreePath ? (+ <span className="inline-flex items-center gap-1 border border-transparent px-[calc(--spacing(3)-1px)] text-sm font-medium text-muted-foreground/70 sm:text-xs">+ {activeWorktreePath ? (+ <>+ <GitForkIcon className="size-3" />+ Worktree+ </>+ ) : (+ <>+ <FolderIcon className="size-3" />+ Local+ </>+ )}+ </span>+ ) : (+ <Select+ value={effectiveEnvMode}+ onValueChange={(value) => onEnvModeChange(value as EnvMode)}+ items={envModeItems}+ >+ <SelectTrigger variant="ghost" size="xs" className="font-medium">+ {effectiveEnvMode === "worktree" ? (+ <GitForkIcon className="size-3" />+ ) : (+ <FolderIcon className="size-3" />+ )}+ <SelectValue />+ </SelectTrigger>+ <SelectPopup>+ <SelectItem value="local">+ <span className="inline-flex items-center gap-1.5">+ <FolderIcon className="size-3" />+ Local+ </span>+ </SelectItem>+ <SelectItem value="worktree">+ <span className="inline-flex items-center gap-1.5">+ <GitForkIcon className="size-3" />+ New worktree+ </span>+ </SelectItem>+ </SelectPopup>+ </Select>+ )}<BranchToolbarBranchSelectoractiveProjectCwd={activeProject.cwd}diff --git a/apps/web/src/components/ui/select.tsx b/apps/web/src/components/ui/select.tsxindex d3c30ae0e..e90b41582 100644--- a/apps/web/src/components/ui/select.tsx+++ b/apps/web/src/components/ui/select.tsx@@ -29,6 +29,7 @@ const selectTriggerVariants = cva(default: "min-h-9 px-[calc(--spacing(3)-1px)] sm:min-h-8",lg: "min-h-10 px-[calc(--spacing(3)-1px)] sm:min-h-9",sm: "min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7",+ xs: "h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5",},},},