Skip to content

Commit edddca6

Browse files
PixPMusicclaude
andcommitted
feat(web): rename Connect hosts from Settings → Connections
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0762f5f commit edddca6

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,48 @@ function savedBackendStatus(environment: EnvironmentPresentation): {
14831483
}
14841484
}
14851485

1486+
/**
1487+
* Renames a Connect host for every client. Manual connections keep the label
1488+
* saved on this device, so only Connect rows offer this.
1489+
*/
1490+
function RemoteHostNameField({ environment }: { readonly environment: EnvironmentPresentation }) {
1491+
const environmentId = environment.environmentId;
1492+
const updateSettings = useAtomCommand(serverEnvironment.updateSettings, "Update host name");
1493+
const canUpdateSettings = useAtomValue(
1494+
serverEnvironment.updateSettings.permissionAtom(environmentId),
1495+
);
1496+
const connected = environment.connection.phase === "connected";
1497+
const supported = environment.serverConfig?.environment.capabilities.environmentLabel === true;
1498+
return (
1499+
<div className="mt-2 flex flex-col gap-1.5 border-t border-border/50 py-2">
1500+
<DraftInput
1501+
size="sm"
1502+
className="w-full sm:w-64"
1503+
value={environment.serverConfig?.settings.environmentLabel ?? ""}
1504+
onCommit={(next) =>
1505+
void updateSettings({
1506+
environmentId,
1507+
input: { patch: { environmentLabel: next.trim() } },
1508+
})
1509+
}
1510+
placeholder="Use the machine’s name"
1511+
aria-label={`Host name for ${environment.label}`}
1512+
disabled={!connected || !supported || !canUpdateSettings}
1513+
spellCheck={false}
1514+
/>
1515+
<p className="text-xs text-muted-foreground">
1516+
{!connected
1517+
? "Connect to this environment to change its host name."
1518+
: !supported
1519+
? "Update this environment to change its host name."
1520+
: !canUpdateSettings
1521+
? "You need permission to update this environment’s settings."
1522+
: "Shown to every client. Clear it to use the machine’s name."}
1523+
</p>
1524+
</div>
1525+
);
1526+
}
1527+
14861528
/**
14871529
* One added machine in the Environments list. The switch is the main action;
14881530
* the update icon appears only when that machine can take an update; the
@@ -1497,7 +1539,9 @@ function SavedBackendListRow({
14971539
}: SavedBackendListRowProps) {
14981540
const [routesOpen, setRoutesOpen] = useState(false);
14991541
const [permissionsOpen, setPermissionsOpen] = useState(false);
1542+
const [hostNameOpen, setHostNameOpen] = useState(false);
15001543
const environmentId = environment.environmentId;
1544+
const isConnectHost = environment.entry.target._tag === "RelayConnectionTarget";
15011545
const unsupported = environment.connection.phase === "unsupported";
15021546
const enabled = environment.entry.enabled && !unsupported;
15031547
const isConnected = environment.connection.phase === "connected";
@@ -1694,6 +1738,7 @@ function SavedBackendListRow({
16941738
}
16951739
detail={
16961740
<>
1741+
{hostNameOpen && isConnectHost && <RemoteHostNameField environment={environment} />}
16971742
{routesOpen && (
16981743
<EnvironmentRoutesList
16991744
environment={environment}
@@ -1774,6 +1819,11 @@ function SavedBackendListRow({
17741819
environmentId={environmentId}
17751820
serverConfig={environment.serverConfig}
17761821
/>
1822+
{isConnectHost ? (
1823+
<MenuItem onClick={() => setHostNameOpen((open) => !open)}>
1824+
{hostNameOpen ? "Hide host name" : "Host name"}
1825+
</MenuItem>
1826+
) : null}
17771827
<MenuItem onClick={() => setRoutesOpen((open) => !open)}>
17781828
<RouteIcon />
17791829
{routesOpen ? "Hide routes" : "Routes"}

‎docs/user/remote-access.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ disconnect an otherwise healthy conversation.
3535
In the web or desktop app, open Settings → Connections and edit Host name. Connected clients and
3636
T3 Connect use the new name without a server restart.
3737

38-
On mobile, open Settings → Environments, choose a T3 Connect host, and edit Host name.
38+
To rename another T3 Connect host, open its row menu in Settings → Connections and choose Host
39+
name. On mobile, open Settings → Environments, choose a T3 Connect host, and edit Host name.
3940
You need permission to update that environment’s settings. Labels on manually paired
4041
connections remain local to your device.
4142

0 commit comments

Comments
 (0)