Refine create-more worktree flow

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
brennanb2025
2026-06-23 15:23:03 -07:00
co-authored by Orca
parent 8b3aea84d4
commit 04e7352a75
8 changed files with 31 additions and 27 deletions
@@ -95,7 +95,7 @@ type NewWorkspaceComposerCardProps = {
canReuseSelectedBranch: boolean
reuseSelectedBranch: boolean
onReuseSelectedBranchChange: (next: boolean) => void
/** Shows the footer "create another after this" toggle — worktree targets only. */
/** Shows the footer "Create more" switch — worktree targets only. */
showCreateMultiple?: boolean
createMultiple?: boolean
onCreateMultipleChange?: (next: boolean) => void
@@ -817,7 +817,10 @@ export default function NewWorkspaceComposerCard({
/>
</div>
<div>
{/* Why: Advanced is a disclosure header, so keep it visually grouped
with the content or footer below it while preserving normal spacing
from the Agent field above. */}
<div className="!mb-2">
<Button
type="button"
variant="ghost"
@@ -835,6 +838,7 @@ export default function NewWorkspaceComposerCard({
<div
className={cn(
'grid overflow-hidden transition-[grid-template-rows] duration-200 ease-out',
!advancedOpen && '!mt-2',
advancedOpen ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'
)}
aria-hidden={!advancedOpen}
@@ -1057,35 +1061,31 @@ export default function NewWorkspaceComposerCard({
)}
>
{showCreateMultiple ? (
<label className="group flex w-fit cursor-pointer items-center gap-2 text-xs text-foreground">
<button
type="button"
role="switch"
aria-checked={createMultiple}
onClick={() => onCreateMultipleChange?.(!createMultiple)}
className="group flex w-fit cursor-pointer items-center gap-2 rounded-md text-xs text-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
>
<span
aria-hidden
className={cn(
'flex size-4 items-center justify-center rounded-[3px] border shadow-sm transition',
createMultiple
? 'border-emerald-500/60 bg-emerald-500 text-white'
: 'border-foreground/20 bg-background dark:border-white/20 dark:bg-muted/10'
'relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors',
createMultiple ? 'bg-foreground' : 'bg-muted-foreground/30'
)}
>
<Check
<span
className={cn(
'size-3 transition-opacity',
createMultiple ? 'opacity-100' : 'opacity-0'
'pointer-events-none block size-3.5 rounded-full bg-background shadow-sm transition-transform',
createMultiple ? 'translate-x-4' : 'translate-x-0.5'
)}
/>
</span>
<input
type="checkbox"
checked={createMultiple}
onChange={(event) => onCreateMultipleChange?.(event.target.checked)}
className="sr-only"
/>
<span>
{translate(
'auto.components.NewWorkspaceComposerCard.createMultiple',
'Create another after this'
)}
{translate('auto.components.NewWorkspaceComposerCard.createMultiple', 'Create more')}
</span>
</label>
</button>
) : null}
<Button
onClick={() => void onCreate()}
+2 -1
View File
@@ -3568,7 +3568,8 @@ export function useComposerState(options: UseComposerStateOptions): UseComposerS
note: trimmedNote,
startupPlan,
quickPrompt,
quickTelemetry
quickTelemetry,
...(createMultiple ? { suppressTerminalFocusOnCompletion: true } : {})
}
// Why: git fetch + `git worktree add` can take 10–15s; holding the modal
+1 -1
View File
@@ -1049,7 +1049,7 @@
"NewWorkspaceComposerCard": {
"reuseExistingBranch": "Reuse branch",
"reuseExistingBranchHint": "Check out the existing branch instead of creating a new one from it.",
"createMultiple": "Create another after this",
"createMultiple": "Create more",
"cbb47ee0dc": "Only available for local Git projects.",
"d861de981b": "Sparse checkout",
"090cfedeb4": "Write a note",
+1 -1
View File
@@ -1103,7 +1103,7 @@
"notePasteTooLarge": "Paste is too large for the note field.",
"reuseExistingBranch": "Reuse branch",
"reuseExistingBranchHint": "Check out the existing branch instead of creating a new one from it.",
"createMultiple": "Create another after this"
"createMultiple": "Create more"
},
"NewWorkspaceComposerModal": {
"fa90f739a5": "Elija el proyecto, el nombre del espacio de trabajo y el agente antes de crear el espacio de trabajo."
+1 -1
View File
@@ -1103,7 +1103,7 @@
"notePasteTooLarge": "Paste is too large for the note field.",
"reuseExistingBranch": "Reuse branch",
"reuseExistingBranchHint": "Check out the existing branch instead of creating a new one from it.",
"createMultiple": "Create another after this"
"createMultiple": "Create more"
},
"NewWorkspaceComposerModal": {
"fa90f739a5": "ワークスペースを作成する前に、プロジェクト、ワークスペース名、および agent を選択します。"
+1 -1
View File
@@ -1103,7 +1103,7 @@
"notePasteTooLarge": "메모 필드에 붙여넣을 내용이 너무 큽니다.",
"reuseExistingBranch": "Reuse branch",
"reuseExistingBranchHint": "Check out the existing branch instead of creating a new one from it.",
"createMultiple": "Create another after this"
"createMultiple": "Create more"
},
"NewWorkspaceComposerModal": {
"fa90f739a5": "워크스페이스를 만들기 전에 프로젝트, 워크스페이스 이름, agent를 선택하세요."
@@ -71,6 +71,9 @@ export type WorktreeCreationRequest = {
startupPlan: AgentStartupPlan | null
quickPrompt: string
quickTelemetry: AgentStartedTelemetry | null
/** When the composer stays open for sequential creates, completion must not
* steal focus from the next workspace name field. */
suppressTerminalFocusOnCompletion?: boolean
}
/** Renderer-only, session-ephemeral record of an in-flight (or failed) worktree
@@ -196,7 +196,7 @@ async function executeWorktreeCreation(
startup: request.startupPlan
})
}
if (stillActive) {
if (stillActive && !request.suppressTerminalFocusOnCompletion) {
queueNewWorkspaceTerminalFocus(worktree.id, activation)
}