diff --git a/apps/mobile/src/features/projects/AddProjectScreen.tsx b/apps/mobile/src/features/projects/AddProjectScreen.tsx index 84a2938785de5e867e8f1ecd78269cebb6da8631..5b38cfa7bdd87f87a6f43524d956828f665e80ff 100644 --- a/apps/mobile/src/features/projects/AddProjectScreen.tsx +++ b/apps/mobile/src/features/projects/AddProjectScreen.tsx @@ -405,7 +405,10 @@ function useEnvironmentOptions(): ReadonlyArray { supportsCloneTracking: config?.environment.capabilities.projectCloneTracking === true, }; }); - return Arr.sort(options, environmentOptionOrder); + return Arr.sort( + options.filter((environment) => canCreateProjectInEnvironment(environment.connectionState)), + environmentOptionOrder, + ); }, [connectedEnvironments, savedConnectionsById, serverConfigByEnvironmentId]); } diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index 0825c5cb92ccb2e4000af7362e75c1dddb5409b1..1c3fe81ac63a64876a22944db0f6f37b310b11dc 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -963,21 +963,23 @@ function OpenCommandPaletteDialog(props: { ); const addProjectEnvironmentOptions = useMemo(() => { - const options = environments.map((environment): AddProjectEnvironmentOption => { - const isPrimary = environment.entry.target._tag === "PrimaryConnectionTarget"; - return { - environmentId: environment.environmentId, - label: resolveEnvironmentOptionLabel({ - isPrimary, + const options = environments + .filter((environment) => canCreateProjectInEnvironment(environment.connection.phase)) + .map((environment): AddProjectEnvironmentOption => { + const isPrimary = environment.entry.target._tag === "PrimaryConnectionTarget"; + return { environmentId: environment.environmentId, - runtimeLabel: environment.label, - }), - isPrimary, - machine: resolveEnvironmentMachineKind(environment.serverConfig), - isConnected: canCreateProjectInEnvironment(environment.connection.phase), - status: connectionStatusText(environment.connection), - }; - }); + label: resolveEnvironmentOptionLabel({ + isPrimary, + environmentId: environment.environmentId, + runtimeLabel: environment.label, + }), + isPrimary, + machine: resolveEnvironmentMachineKind(environment.serverConfig), + isConnected: canCreateProjectInEnvironment(environment.connection.phase), + status: connectionStatusText(environment.connection), + }; + }); options.sort((left, right) => { if (left.isPrimary !== right.isPrimary) { @@ -1658,7 +1660,7 @@ function OpenCommandPaletteDialog(props: { ); const openAddProjectFlow = useCallback(() => { - // With no environment at all there is nothing to browse, so the only + // With no connected environment there is nothing to browse, so the only // useful next step is connecting one. if (addProjectEnvironmentOptions.length === 0) { setOpen(false);