@@ -20,6 +20,7 @@ import {
2020 resolveEnvModeLabel ,
2121 resolveEffectiveEnvMode ,
2222 resolveLockedWorkspaceLabel ,
23+ shouldShowEnvironmentIndicator ,
2324} from "./BranchToolbar.logic" ;
2425import { BranchToolbarBranchSelector } from "./BranchToolbarBranchSelector" ;
2526import { BranchToolbarEnvironmentSelector } from "./BranchToolbarEnvironmentSelector" ;
@@ -60,6 +61,7 @@ interface MobileRunContextSelectorProps {
6061 environmentId : EnvironmentId ;
6162 availableEnvironments : readonly EnvironmentOption [ ] | undefined ;
6263 showEnvironmentPicker : boolean ;
64+ showEnvironmentIndicator : boolean ;
6365 onEnvironmentChange : ( ( environmentId : EnvironmentId ) => void ) | undefined ;
6466 effectiveEnvMode : EnvMode ;
6567 activeWorktreePath : string | null ;
@@ -72,6 +74,7 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({
7274 environmentId,
7375 availableEnvironments,
7476 showEnvironmentPicker,
77+ showEnvironmentIndicator,
7578 onEnvironmentChange,
7679 effectiveEnvMode,
7780 activeWorktreePath,
@@ -94,7 +97,7 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({
9497 : resolveCurrentWorkspaceLabel ( activeWorktreePath ) ;
9598 const isLocked = envLocked || envModeLocked ;
9699 const EnvironmentIcon = activeEnvironment ?. isPrimary ? MonitorIcon : CloudIcon ;
97- const icon = showEnvironmentPicker ? (
100+ const icon = showEnvironmentIndicator ? (
98101 // Button's base styles apply `-mx-0.5` to descendant SVGs, which eats 4px
99102 // out of whatever gap we set. mx-0! cancels that so gap-0.5 reads as 2px.
100103 < span className = "inline-flex shrink-0 items-center gap-0.5" >
@@ -108,7 +111,7 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({
108111 < >
109112 { icon }
110113 < span className = "min-w-0 truncate" >
111- { showEnvironmentPicker ? ( activeEnvironment ?. label ?? "Run on" ) : workspaceLabel }
114+ { showEnvironmentIndicator ? ( activeEnvironment ?. label ?? "Run on" ) : workspaceLabel }
112115 </ span >
113116 </ >
114117 ) ;
@@ -234,6 +237,12 @@ export const BranchToolbar = memo(function BranchToolbar({
234237 const showEnvironmentPicker = Boolean (
235238 availableEnvironments && availableEnvironments . length > 1 && onEnvironmentChange ,
236239 ) ;
240+ const activeEnvironmentOption =
241+ availableEnvironments ?. find ( ( env ) => env . environmentId === environmentId ) ?? null ;
242+ const showEnvironmentIndicator = shouldShowEnvironmentIndicator ( {
243+ activeEnvironment : activeEnvironmentOption ,
244+ canPickEnvironment : showEnvironmentPicker ,
245+ } ) ;
237246 const isMobile = useIsMobile ( ) ;
238247
239248 if ( ! hasActiveThread || ! activeProject ) return null ;
@@ -247,20 +256,21 @@ export const BranchToolbar = memo(function BranchToolbar({
247256 environmentId = { environmentId }
248257 availableEnvironments = { availableEnvironments }
249258 showEnvironmentPicker = { showEnvironmentPicker }
259+ showEnvironmentIndicator = { showEnvironmentIndicator }
250260 onEnvironmentChange = { onEnvironmentChange }
251261 effectiveEnvMode = { effectiveEnvMode }
252262 activeWorktreePath = { activeWorktreePath }
253263 onEnvModeChange = { onEnvModeChange }
254264 />
255265 ) : (
256266 < div className = "flex min-w-0 shrink-0 items-center gap-1" >
257- { showEnvironmentPicker && availableEnvironments && onEnvironmentChange && (
267+ { showEnvironmentIndicator && availableEnvironments && (
258268 < >
259269 < BranchToolbarEnvironmentSelector
260270 envLocked = { envLocked }
261271 environmentId = { environmentId }
262272 availableEnvironments = { availableEnvironments }
263- onEnvironmentChange = { onEnvironmentChange }
273+ { ... ( showEnvironmentPicker && onEnvironmentChange ? { onEnvironmentChange } : { } ) }
264274 />
265275 < Separator orientation = "vertical" className = "mx-0.5 h-3.5!" />
266276 </ >
0 commit comments