Skip to content

Commit 93b7303

Browse files
committed
fix(connections): give auto balance its own name and icon
1 parent f3c6825 commit 93b7303

4 files changed

Lines changed: 32 additions & 14 deletions

File tree

‎apps/web/src/components/BranchToolbar.tsx‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
FolderGitIcon,
77
FolderIcon,
88
HistoryIcon,
9+
ScaleIcon,
910
} from "lucide-react";
1011
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
1112

@@ -120,10 +121,14 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({
120121
// Button's base styles apply `-mx-0.5` to descendant SVGs, which eats 4px
121122
// out of whatever gap we set. mx-0! cancels that so gap-0.5 reads as 2px.
122123
<span className="inline-flex shrink-0 items-center gap-0.5">
123-
<EnvironmentMachineIcon
124-
kind={activeEnvironment?.machine ?? "server"}
125-
className="size-3 shrink-0 mx-0!"
126-
/>
124+
{autoEnvironmentLabel ? (
125+
<ScaleIcon className="size-3 shrink-0 mx-0!" aria-hidden="true" />
126+
) : (
127+
<EnvironmentMachineIcon
128+
kind={activeEnvironment?.machine ?? "server"}
129+
className="size-3 shrink-0 mx-0!"
130+
/>
131+
)}
127132
<WorkspaceIcon className="size-3 shrink-0 mx-0!" />
128133
</span>
129134
) : (
@@ -189,7 +194,12 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({
189194
if (autoEnvironmentLabel) onAutoEnvironment?.();
190195
}}
191196
>
192-
{autoEnvironmentLabel ?? "Balance load"}
197+
<span className="flex min-w-0 items-center gap-1.5">
198+
<ScaleIcon className="size-3" aria-hidden="true" />
199+
<span className="min-w-0 truncate">
200+
{autoEnvironmentLabel ?? "Auto balance"}
201+
</span>
202+
</span>
193203
</MenuRadioItem>
194204
)}
195205
{availableEnvironments.map((env) => (

‎apps/web/src/components/BranchToolbarEnvironmentSelector.tsx‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { EnvironmentId } from "@t3tools/contracts";
2+
import { ScaleIcon } from "lucide-react";
23
import { memo, useMemo } from "react";
34

45
import type { EnvironmentOption } from "./BranchToolbar.logic";
@@ -40,7 +41,7 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
4041
const environmentItems = useMemo(
4142
() => [
4243
...(onAutoEnvironment
43-
? [{ value: "auto", label: autoEnvironmentLabel ?? "Balance load" }]
44+
? [{ value: "auto", label: autoEnvironmentLabel ?? "Auto balance" }]
4445
: []),
4546
...availableEnvironments.map((env) => ({
4647
value: env.environmentId,
@@ -96,10 +97,14 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
9697
aria-label="Run on"
9798
data-composer-context-control
9899
>
99-
<EnvironmentMachineIcon
100-
kind={activeEnvironment?.machine ?? "server"}
101-
className="size-3 shrink-0"
102-
/>
100+
{autoEnvironmentLabel ? (
101+
<ScaleIcon className="size-3 shrink-0" aria-hidden="true" />
102+
) : (
103+
<EnvironmentMachineIcon
104+
kind={activeEnvironment?.machine ?? "server"}
105+
className="size-3 shrink-0"
106+
/>
107+
)}
103108
<span
104109
data-composer-label
105110
className="min-w-0 max-w-[240px] group-data-[compact]/composer-context:max-w-0"
@@ -122,7 +127,10 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
122127
if (autoEnvironmentLabel) onAutoEnvironment?.();
123128
}}
124129
>
125-
{autoEnvironmentLabel ?? "Balance load"}
130+
<span className="inline-flex items-center gap-1.5">
131+
<ScaleIcon className="size-3" aria-hidden="true" />
132+
{autoEnvironmentLabel ?? "Auto balance"}
133+
</span>
126134
</SelectItem>
127135
)}
128136
{availableEnvironments.map((env) => (

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3237,10 +3237,10 @@ export default function ChatView(props: ChatViewProps) {
32373237
]);
32383238
const autoEnvironmentLabel = automaticEnvironment
32393239
? draftThread?.loadBalancedEnvironmentId
3240-
? "Balancing load · " + (activeEnvironmentOption?.label ?? "Selected machine")
3240+
? "Auto balance"
32413241
: loadBalancing.pending
32423242
? "Checking machines…"
3243-
: "Balance unavailable · choose a machine"
3243+
: "Auto balance unavailable"
32443244
: undefined;
32453245

32463246
// Handle environment change for draft threads. When the user picks a

‎docs/user/remote-access.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Higher preference values favor a machine when it has CPU and memory available; 0
6969
reserves it for manual selection. Preferences are saved separately in each client.
7070

7171
The composer checks eligible machines when choosing a draft's environment, then keeps
72-
that choice stable. Choose **Balance load** again to check current resources, or choose
72+
that choice stable. Choose **Auto balance** again to check current resources, or choose
7373
a specific machine to override it. Choosing a branch or worktree also keeps the draft
7474
on that machine. Existing threads stay where they started. If resource checks are
7575
unavailable or all eligible machines are full, choose a machine manually to continue.

0 commit comments

Comments
 (0)