| author | |
| committer | |
| log | effaab94e36992ea9712c2a56d5ff602a3cead04 |
| tree | 11b71653a4466cb40e71f4ad634d8c924a05a949 |
| parent | e407f9bb090d0cec231df21ad30e9e13186d9518 |
| signature | Signed by PGP key B5690EEEBB952194 |
3 files changed, 41 insertions(+), 12 deletions(-)
apps/web/src/components/BranchToolbar.tsx+12-6| ... | ... | @@ -5,7 +5,6 @@ import { |
| 5 | 5 | FolderGit2Icon, |
| 6 | 6 | FolderGitIcon, |
| 7 | 7 | FolderIcon, |
| 8 | HistoryIcon, | |
| 9 | 8 | ScaleIcon, |
| 10 | 9 | } from "lucide-react"; |
| 11 | 10 | import { |
| ... | ... | @@ -41,6 +40,7 @@ import { |
| 41 | 40 | } from "./BranchToolbarBranchSelector"; |
| 42 | 41 | import { BranchToolbarEnvironmentSelector } from "./BranchToolbarEnvironmentSelector"; |
| 43 | 42 | import { BranchToolbarEnvModeSelector } from "./BranchToolbarEnvModeSelector"; |
| 43 | import { PreviousWorktreeItemContent } from "./PreviousWorktreeItemContent"; | |
| 44 | 44 | import { ComposerControl } from "./chat/ComposerControl"; |
| 45 | 45 | import { |
| 46 | 46 | Menu, |
| ... | ... | @@ -105,6 +105,7 @@ interface MobileRunContextSelectorProps { |
| 105 | 105 | activeWorktreePath: string | null; |
| 106 | 106 | onEnvModeChange: (mode: EnvMode) => void; |
| 107 | 107 | previousWorktreeLabel: string | null; |
| 108 | previousWorktreeBranch: string | null; | |
| 108 | 109 | onUsePreviousWorktree: () => void; |
| 109 | 110 | } |
| 110 | 111 | |
| ... | ... | @@ -123,6 +124,7 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({ |
| 123 | 124 | activeWorktreePath, |
| 124 | 125 | onEnvModeChange, |
| 125 | 126 | previousWorktreeLabel, |
| 127 | previousWorktreeBranch, | |
| 126 | 128 | onUsePreviousWorktree, |
| 127 | 129 | }: MobileRunContextSelectorProps) { |
| 128 | 130 | const composerFloatingLayerProps = useComposerMenuProps(); |
| ... | ... | @@ -217,7 +219,12 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({ |
| 217 | 219 | {triggerContent} |
| 218 | 220 | <ChevronDownIcon className="size-3 shrink-0 opacity-50" /> |
| 219 | 221 | </MenuTrigger> |
| 220 | <MenuPopup align="start" side="top" {...composerFloatingLayerProps}> | |
| 222 | <MenuPopup | |
| 223 | align="start" | |
| 224 | side="top" | |
| 225 | className={previousWorktreeLabel ? "w-[min(21rem,calc(100vw-2rem))]" : undefined} | |
| 226 | {...composerFloatingLayerProps} | |
| 227 | > | |
| 221 | 228 | {showEnvironmentPicker && availableEnvironments && onEnvironmentChange ? ( |
| 222 | 229 | <> |
| 223 | 230 | <MenuGroup> |
| ... | ... | @@ -295,10 +302,7 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({ |
| 295 | 302 | </MenuRadioItem> |
| 296 | 303 | {previousWorktreeLabel ? ( |
| 297 | 304 | <MenuRadioItem disabled={envModeLocked} value="previous-worktree" closeOnClick> |
| 298 | <span className="flex min-w-0 items-center gap-1.5"> | |
| 299 | <HistoryIcon className="size-3" /> | |
| 300 | <MiddleTruncate value={previousWorktreeLabel} /> | |
| 301 | </span> | |
| 305 | <PreviousWorktreeItemContent branch={previousWorktreeBranch} /> | |
| 302 | 306 | </MenuRadioItem> |
| 303 | 307 | ) : null} |
| 304 | 308 | </MenuRadioGroup> |
| ... | ... | @@ -630,6 +634,7 @@ export const BranchToolbar = memo(function BranchToolbar({ |
| 630 | 634 | activeWorktreePath={activeWorktreePath} |
| 631 | 635 | onEnvModeChange={onEnvModeChange} |
| 632 | 636 | previousWorktreeLabel={previousWorktreeLabel} |
| 637 | previousWorktreeBranch={previousWorktreeSeed?.branch ?? null} | |
| 633 | 638 | onUsePreviousWorktree={onUsePreviousWorktree} |
| 634 | 639 | /> |
| 635 | 640 | </div> |
| ... | ... | @@ -669,6 +674,7 @@ export const BranchToolbar = memo(function BranchToolbar({ |
| 669 | 674 | activeWorktreePath={activeWorktreePath} |
| 670 | 675 | onEnvModeChange={onEnvModeChange} |
| 671 | 676 | previousWorktreeLabel={previousWorktreeLabel} |
| 677 | previousWorktreeBranch={previousWorktreeSeed?.branch ?? null} | |
| 672 | 678 | onUsePreviousWorktree={onUsePreviousWorktree} |
| 673 | 679 | /> |
| 674 | 680 | ) : null} |
apps/web/src/components/BranchToolbarEnvModeSelector.tsx+10-6| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | import { FolderGit2Icon, FolderGitIcon, FolderIcon, HistoryIcon } from "lucide-react"; | |
| 1 | import { FolderGit2Icon, FolderGitIcon, FolderIcon } from "lucide-react"; | |
| 2 | 2 | import { memo, useMemo } from "react"; |
| 3 | 3 | |
| 4 | 4 | import { |
| ... | ... | @@ -8,6 +8,7 @@ import { |
| 8 | 8 | type EnvMode, |
| 9 | 9 | } from "./BranchToolbar.logic"; |
| 10 | 10 | import { useComposerMenuProps } from "./chat/composerEventScope"; |
| 11 | import { PreviousWorktreeItemContent } from "./PreviousWorktreeItemContent"; | |
| 11 | 12 | import { |
| 12 | 13 | Select, |
| 13 | 14 | SelectGroup, |
| ... | ... | @@ -28,6 +29,7 @@ interface BranchToolbarEnvModeSelectorProps { |
| 28 | 29 | activeWorktreePath: string | null; |
| 29 | 30 | onEnvModeChange: (mode: EnvMode) => void; |
| 30 | 31 | previousWorktreeLabel?: string | null; |
| 32 | previousWorktreeBranch?: string | null; | |
| 31 | 33 | onUsePreviousWorktree?: () => void; |
| 32 | 34 | } |
| 33 | 35 | |
| ... | ... | @@ -38,6 +40,7 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe |
| 38 | 40 | activeWorktreePath, |
| 39 | 41 | onEnvModeChange, |
| 40 | 42 | previousWorktreeLabel, |
| 43 | previousWorktreeBranch = null, | |
| 41 | 44 | onUsePreviousWorktree, |
| 42 | 45 | }: BranchToolbarEnvModeSelectorProps) { |
| 43 | 46 | const composerFloatingLayerProps = useComposerMenuProps(); |
| ... | ... | @@ -142,7 +145,11 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe |
| 142 | 145 | : resolveCurrentWorkspaceLabel(activeWorktreePath)} |
| 143 | 146 | </TooltipPopup> |
| 144 | 147 | </Tooltip> |
| 145 | <SelectPopup alignItemWithTrigger={false} {...composerFloatingLayerProps}> | |
| 148 | <SelectPopup | |
| 149 | alignItemWithTrigger={false} | |
| 150 | className={showPreviousWorktree ? "w-[min(21rem,calc(100vw-2rem))]" : undefined} | |
| 151 | {...composerFloatingLayerProps} | |
| 152 | > | |
| 146 | 153 | <SelectGroup> |
| 147 | 154 | <SelectGroupLabel>Workspace</SelectGroupLabel> |
| 148 | 155 | <SelectItem value="local"> |
| ... | ... | @@ -163,10 +170,7 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe |
| 163 | 170 | </SelectItem> |
| 164 | 171 | {showPreviousWorktree && previousWorktreeLabel ? ( |
| 165 | 172 | <SelectItem value={PREVIOUS_WORKTREE_SELECT_VALUE}> |
| 166 | <span className="inline-flex items-center gap-1.5"> | |
| 167 | <HistoryIcon className="size-3" /> | |
| 168 | {previousWorktreeLabel} | |
| 169 | </span> | |
| 173 | <PreviousWorktreeItemContent branch={previousWorktreeBranch} /> | |
| 170 | 174 | </SelectItem> |
| 171 | 175 | ) : null} |
| 172 | 176 | </SelectGroup> |
apps/web/src/components/PreviousWorktreeItemContent.tsx created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | import { HistoryIcon } from "lucide-react"; | |
| 2 | ||
| 3 | import { MiddleTruncate } from "./ui/middle-truncate"; | |
| 4 | ||
| 5 | export function PreviousWorktreeItemContent({ branch }: { branch: string | null }) { | |
| 6 | return ( | |
| 7 | <span className="flex min-w-0 items-start gap-1.5"> | |
| 8 | <HistoryIcon className="mt-1 size-3" /> | |
| 9 | <span className="flex min-w-0 flex-col"> | |
| 10 | <span>Previous worktree</span> | |
| 11 | {branch ? ( | |
| 12 | <span className="min-w-0 text-xs text-muted-foreground"> | |
| 13 | <MiddleTruncate value={branch} /> | |
| 14 | </span> | |
| 15 | ) : null} | |
| 16 | </span> | |
| 17 | </span> | |
| 18 | ); | |
| 19 | } |