-
Notifications
You must be signed in to change notification settings - Fork 27
🤖 refactor: simplify workspace creation and title generation #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ab9ad36
🤖 fix: title gen regression - runtime saving and UI layout
ammar-agent 9731da3
🤖 refactor: unify ChatInput with variant pattern
ammar-agent 1d8bbb0
🤖 fix: add full-height flex wrapper for creation variant
656584d
refactor: centralize draft workspace settings persistence
60e3f5f
fix: prevent auto-focus during streaming
74e6fc9
refactor: use props. instead of destructuring in CreationControls
776b73b
style: reduce padding on select and text input controls
fe6c986
refactor: eliminate coupling and unnecessary patterns
6f8722e
refactor: centralize storage scope ID generation
be6b9cc
style: simplify runtime mode labels
70a5533
refactor: remove displayName concept from workspaces
231584c
style: fix prettier formatting
0047171
fix: persist SSH mode even without host
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import React from "react"; | ||
|
|
||
| interface CreationCenterContentProps { | ||
| projectName: string; | ||
| isSending: boolean; | ||
| } | ||
|
|
||
| /** | ||
| * Center content displayed during workspace creation | ||
| * Shows either a loading spinner or welcome message | ||
| */ | ||
| export function CreationCenterContent({ projectName, isSending }: CreationCenterContentProps) { | ||
| return ( | ||
| <div className="flex flex-1 items-center justify-center"> | ||
| {isSending ? ( | ||
| <div className="text-center"> | ||
| <div className="bg-accent mb-3 inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent"></div> | ||
| <p className="text-muted text-sm">Creating workspace...</p> | ||
| </div> | ||
| ) : ( | ||
| <div className="max-w-2xl px-8 text-center"> | ||
| <h1 className="text-foreground mb-4 text-2xl font-semibold">{projectName}</h1> | ||
| <p className="text-muted text-sm leading-relaxed"> | ||
| Describe what you want to build. A new workspace will be created with an automatically | ||
| generated branch name. Configure runtime and model options below. | ||
| </p> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import React from "react"; | ||
| import { RUNTIME_MODE, type RuntimeMode } from "@/types/runtime"; | ||
| import { TooltipWrapper, Tooltip } from "../Tooltip"; | ||
| import { Select } from "../Select"; | ||
|
|
||
| interface CreationControlsProps { | ||
| branches: string[]; | ||
| trunkBranch: string; | ||
| onTrunkBranchChange: (branch: string) => void; | ||
| runtimeMode: RuntimeMode; | ||
| sshHost: string; | ||
| onRuntimeChange: (mode: RuntimeMode, host: string) => void; | ||
| disabled: boolean; | ||
| } | ||
|
|
||
| /** | ||
| * Additional controls shown only during workspace creation | ||
| * - Trunk branch selector (which branch to fork from) | ||
| * - Runtime mode (local vs SSH) | ||
| */ | ||
| export function CreationControls(props: CreationControlsProps) { | ||
| return ( | ||
| <div className="flex flex-wrap items-center gap-x-3 gap-y-2"> | ||
| {/* Trunk Branch Selector */} | ||
| {props.branches.length > 0 && ( | ||
| <div className="flex items-center gap-1" data-component="TrunkBranchGroup"> | ||
| <label htmlFor="trunk-branch" className="text-muted text-xs"> | ||
| From: | ||
| </label> | ||
| <Select | ||
| id="trunk-branch" | ||
| value={props.trunkBranch} | ||
| options={props.branches} | ||
| onChange={props.onTrunkBranchChange} | ||
| disabled={props.disabled} | ||
| className="max-w-[120px]" | ||
| /> | ||
| </div> | ||
| )} | ||
|
|
||
| {/* Runtime Selector */} | ||
| <div className="flex items-center gap-1" data-component="RuntimeSelectorGroup"> | ||
| <label className="text-muted text-xs">Runtime:</label> | ||
| <Select | ||
| value={props.runtimeMode} | ||
| options={[ | ||
| { value: RUNTIME_MODE.LOCAL, label: "Local" }, | ||
| { value: RUNTIME_MODE.SSH, label: "SSH" }, | ||
| ]} | ||
| onChange={(newMode) => { | ||
| const mode = newMode as RuntimeMode; | ||
| props.onRuntimeChange(mode, mode === RUNTIME_MODE.LOCAL ? "" : props.sshHost); | ||
| }} | ||
| disabled={props.disabled} | ||
| aria-label="Runtime mode" | ||
| /> | ||
| {props.runtimeMode === RUNTIME_MODE.SSH && ( | ||
| <input | ||
| type="text" | ||
| value={props.sshHost} | ||
| onChange={(e) => props.onRuntimeChange(RUNTIME_MODE.SSH, e.target.value)} | ||
| placeholder="user@host" | ||
| disabled={props.disabled} | ||
| className="bg-separator text-foreground border-border-medium focus:border-accent w-32 rounded border px-1 py-0.5 text-xs focus:outline-none disabled:opacity-50" | ||
| /> | ||
| )} | ||
| <TooltipWrapper inline> | ||
| <span className="text-muted cursor-help text-xs">?</span> | ||
| <Tooltip className="tooltip" align="center" width="wide"> | ||
| <strong>Runtime:</strong> | ||
| <br /> | ||
| • Local: git worktree in ~/.cmux/src | ||
| <br />• SSH: remote clone in ~/cmux on SSH host | ||
| </Tooltip> | ||
| </TooltipWrapper> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.