Skip to content

Commit 06d05b7

Browse files
flambohclaude
andcommitted
fix(web): name the environment Providers edits in the settings scope
Providers edits one environment, but with "All environments" selected the scope sentence read "across All environments" while changes landed on the representative environment only. On Providers it now names that environment and drops the "All environments" option. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ec28eef commit 06d05b7

1 file changed

Lines changed: 27 additions & 11 deletions

File tree

‎apps/web/src/components/settings/SettingsScopeSentence.tsx‎

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ interface SettingsScopeMenuProps {
4141
readonly groups: readonly SidebarProjectSnapshot[];
4242
readonly environments: readonly EnvironmentPresentation[];
4343
readonly onChange: (next: SettingsScopeSearch) => void;
44+
readonly singleEnvironmentId?: string | undefined;
4445
}
4546

4647
/**
@@ -54,11 +55,14 @@ export function SettingsScopeSentence() {
5455
const pathname = useLocation({ select: (location) => location.pathname });
5556
const { environments } = useEnvironments();
5657
if (scope === null || SETTINGS_DEVICE_ONLY_PATHS.has(pathname)) return null;
58+
const singleEnvironmentId =
59+
pathname === "/settings/providers" ? scope.environment?.environmentId : undefined;
5760
const props: SettingsScopeMenuProps = {
5861
value: scope.search,
5962
groups: scope.groups,
6063
environments,
6164
onChange: scope.selectScope,
65+
singleEnvironmentId,
6266
};
6367
return (
6468
<p className="flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 px-3 text-base text-muted-foreground sm:px-4">
@@ -70,7 +74,9 @@ export function SettingsScopeSentence() {
7074
<span className="flex min-w-0 items-center gap-1.5">
7175
<span className="shrink-0">
7276
{/* A legacy checkout link names one environment without `machine`. */}
73-
{scope.search.machine || scope.scope.kind === "checkout" ? "on" : "across"}
77+
{scope.search.machine || scope.scope.kind === "checkout" || singleEnvironmentId
78+
? "on"
79+
: "across"}
7480
</span>
7581
<EnvironmentScopeMenu {...props} />
7682
</span>
@@ -105,11 +111,17 @@ function ScopeMenu({
105111
);
106112
}
107113

108-
function EnvironmentScopeMenu({ value, groups, environments, onChange }: SettingsScopeMenuProps) {
114+
function EnvironmentScopeMenu({
115+
value,
116+
groups,
117+
environments,
118+
onChange,
119+
singleEnvironmentId,
120+
}: SettingsScopeMenuProps) {
109121
const resolved = resolveSettingsScope(value, groups, environments);
110122
const environmentValue = environmentAxisValue(
111123
value,
112-
resolved.kind === "checkout" ? resolved.environmentId : null,
124+
resolved.kind === "checkout" ? resolved.environmentId : singleEnvironmentId,
113125
);
114126
const selected = environments.find(
115127
(environment) => environment.environmentId === environmentValue,
@@ -140,14 +152,18 @@ function EnvironmentScopeMenu({ value, groups, environments, onChange }: Setting
140152
if (typeof next === "string") onChange(selectEnvironmentAxis(value, next));
141153
}}
142154
>
143-
<MenuRadioItem value={ALL_ENVIRONMENTS_VALUE}>
144-
<span className="flex min-w-0 items-center gap-2">
145-
<LayersIcon aria-hidden className="size-3.5" />
146-
<span className="min-w-0 flex-1 truncate">All environments</span>
147-
<MenuRadioItemIndicator />
148-
</span>
149-
</MenuRadioItem>
150-
<MenuSeparator />
155+
{singleEnvironmentId ? null : (
156+
<>
157+
<MenuRadioItem value={ALL_ENVIRONMENTS_VALUE}>
158+
<span className="flex min-w-0 items-center gap-2">
159+
<LayersIcon aria-hidden className="size-3.5" />
160+
<span className="min-w-0 flex-1 truncate">All environments</span>
161+
<MenuRadioItemIndicator />
162+
</span>
163+
</MenuRadioItem>
164+
<MenuSeparator />
165+
</>
166+
)}
151167
{environments.map((environment) => (
152168
<MenuRadioItem key={environment.environmentId} value={environment.environmentId}>
153169
<span className="flex min-w-0 items-center gap-2">

0 commit comments

Comments
 (0)