@@ -46,6 +46,7 @@ import * as Option from "effect/Option";
4646import {
4747 ArrowLeftIcon ,
4848 ChartNoAxesColumnIcon ,
49+ CheckIcon ,
4950 ChevronRightIcon ,
5051 CornerLeftUpIcon ,
5152 FileSearchIcon ,
@@ -1793,30 +1794,11 @@ function OpenCommandPaletteDialog(props: {
17931794 startAddProjectSourceSelection ,
17941795 ] ) ;
17951796
1796- // New project goes straight to the name step when only one environment offers it.
1797+ // New project starts on this device (options list it first); the name step
1798+ // lists the other machines when there is a choice.
17971799 const openNewProjectFlow = ( ) => {
1798- const onlyOption =
1799- newProjectEnvironmentOptions . length === 1 ? newProjectEnvironmentOptions [ 0 ] : null ;
1800- if ( onlyOption ) {
1801- startNewProject ( onlyOption . environmentId ) ;
1802- return ;
1803- }
1804- pushPaletteView ( {
1805- addonIcon : < FolderGit2Icon className = { ADDON_ICON_CLASS } /> ,
1806- groups : [
1807- {
1808- value : "new-project-environments" ,
1809- label : "Environments" ,
1810- items : newProjectEnvironmentOptions . map ( ( option ) =>
1811- buildEnvironmentItem (
1812- option ,
1813- `action:new-project:environment:${ option . environmentId } ` ,
1814- startNewProject ,
1815- ) ,
1816- ) ,
1817- } ,
1818- ] ,
1819- } ) ;
1800+ const firstOption = newProjectEnvironmentOptions [ 0 ] ;
1801+ if ( firstOption ) startNewProject ( firstOption . environmentId ) ;
18201802 } ;
18211803
18221804 useLayoutEffect ( ( ) => {
@@ -2790,6 +2772,39 @@ function OpenCommandPaletteDialog(props: {
27902772 popView ( ) ;
27912773 if ( ! openedFromSources ) startAddProjectSourceSelection ( environmentId ) ;
27922774 } ;
2775+ // Switching machines keeps the typed name; the GitHub option follows the
2776+ // machine because source control discovery reads addProjectEnvironmentId.
2777+ const switchNewProjectEnvironment = ( environmentId : EnvironmentId ) => {
2778+ setNewProjectFlow ( { environmentId } ) ;
2779+ setAddProjectEnvironmentId ( environmentId ) ;
2780+ } ;
2781+ const newProjectEnvironmentLabel =
2782+ newProjectFlow !== null && newProjectEnvironmentOptions . length > 1
2783+ ? ( newProjectEnvironmentOptions . find (
2784+ ( option ) => option . environmentId === newProjectFlow . environmentId ,
2785+ ) ?. label ?? null )
2786+ : null ;
2787+ const newProjectMachineGroup : CommandPaletteView [ "groups" ] [ number ] | null =
2788+ newProjectEnvironmentLabel === null || newProjectFlow === null
2789+ ? null
2790+ : {
2791+ value : "new-project-machines" ,
2792+ label : "Environments" ,
2793+ items : newProjectEnvironmentOptions . map ( ( option ) => ( {
2794+ ...buildEnvironmentItem (
2795+ option ,
2796+ `new-project:environment:${ option . environmentId } ` ,
2797+ switchNewProjectEnvironment ,
2798+ ) ,
2799+ ...( option . environmentId === newProjectFlow . environmentId
2800+ ? {
2801+ titleTrailingContent : (
2802+ < CheckIcon className = "ms-auto size-4 shrink-0 text-muted-foreground/70" />
2803+ ) ,
2804+ }
2805+ : { } ) ,
2806+ } ) ) ,
2807+ } ;
27932808 const newProjectExistingGroup : CommandPaletteView [ "groups" ] [ number ] | null =
27942809 newProjectFlow === null
27952810 ? null
@@ -2848,9 +2863,11 @@ function OpenCommandPaletteDialog(props: {
28482863
28492864 let displayedGroups : CommandPaletteView [ "groups" ] = filteredGroups ;
28502865 if ( newProjectFlow !== null ) {
2851- displayedGroups = newProjectExistingGroup
2852- ? [ ...newProjectOptionGroups , newProjectExistingGroup ]
2853- : newProjectOptionGroups ;
2866+ displayedGroups = [
2867+ ...( newProjectMachineGroup ? [ newProjectMachineGroup ] : [ ] ) ,
2868+ ...newProjectOptionGroups ,
2869+ ...( newProjectExistingGroup ? [ newProjectExistingGroup ] : [ ] ) ,
2870+ ] ;
28542871 } else if ( addProjectCloneFlow ?. step === "repository" ) {
28552872 displayedGroups = [ ] ;
28562873 } else if ( addProjectCloneFlow ?. step === "confirm" ) {
@@ -3319,6 +3336,7 @@ function OpenCommandPaletteDialog(props: {
33193336 { newProjectName . length > 0
33203337 ? `Creates ${ newProjectPathPreview } `
33213338 : `Goes in ${ newProjectsRoot } ` }
3339+ { newProjectEnvironmentLabel === null ? null : ` on ${ newProjectEnvironmentLabel } ` }
33223340 </ span >
33233341 </ span >
33243342 </ div >
0 commit comments