refactor(ui): replace middle-dot separators with clearer hierarchy (#6087)

* refactor(ui): replace middle-dot separators with clearer hierarchy

* refactor(ui): use layout instead of punctuation separators
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-07 15:19:55 +08:00
1 parent d6ddceed99
commit 7cb396788c
82 files changed
+433 -462

No files matched your search

@@ -25,7 +25,7 @@ export function HostCompatibilityDialog({ profile, clientVersion, onClose }: {
<DialogContent className="remote-dialog max-w-md overflow-y-auto outline-none">
<DialogHeader className="pr-5 text-left">
<DialogTitle className="text-balance leading-snug">{t("remote.compatibility.title")}</DialogTitle>
<DialogDescription className="text-pretty [overflow-wrap:anywhere]">{displayedProfile?.name} · {displayedProfile?.host}</DialogDescription>
<DialogDescription className="text-pretty [overflow-wrap:anywhere]"><span className="block font-medium">{displayedProfile?.name}</span>{" "}<span className="block font-mono text-xs">{displayedProfile?.host}</span></DialogDescription>
</DialogHeader>
<SettingsGroup>
<dl className="space-y-3 px-4 py-3 text-[13px] leading-5">
+11 -6
View File
@@ -104,7 +104,7 @@ function HostMenuItems({ picker }: { picker: HostPicker }) {
{showLocal && !!profiles.length && <DropdownMenuSeparator />}
{profiles.map((profile) => <DropdownMenuItem key={profile.id} onSelect={() => picker.select(profile.id)} className="gap-2.5"
aria-label={`${profile.name} ${profile.host}`} aria-describedby={`host-state-${profile.id}`}
title={`${profile.name} · ${profile.host}`} aria-current={picker.currentId === profile.id || undefined}>
title={`${profile.name}\n${profile.host}`} aria-current={picker.currentId === profile.id || undefined}>
<Server className="h-4 w-4 shrink-0 text-muted-foreground" />
<span className="min-w-0 flex-1"><span className="block truncate">{profile.name}</span><span className="block truncate text-xs text-muted-foreground">{profile.host}</span></span>
<span id={`host-state-${profile.id}`}><HostConnectionStatus state={profile.state} compact /></span>
@@ -145,10 +145,9 @@ export function HostSwitcher({ collapsed = false, portalContainer }: { collapsed
// visible; progress belongs to the target's row and the accessible status.
const label = picker.name;
const currentLabel = failed ? shell?.offlineLabel || t("remote.offline") : t(`connection.${currentStatus}`);
const identity = picker.name === picker.hostname ? picker.name : `${picker.name} · ${picker.hostname}`;
const current = `${identity} · ${currentLabel}`;
const detail = pendingName ? `${current} · ${t("remote.preparing", { name: pendingName })}` : current;
const hint = picker.error ? `${detail} — ${picker.error}` : detail;
const identity = picker.name === picker.hostname ? picker.name : `${picker.name}, ${picker.hostname}`;
const current = `${identity}, ${currentLabel}`;
const detail = pendingName ? `${current}. ${t("remote.preparing", { name: pendingName })}` : current;
const button = <Button ref={buttonRef} variant="ghost" size="sm" aria-label={t("remote.switchHost")}
data-host-switcher className={cn("host-no-drag touch-target h-8 min-w-0 gap-2 rounded-xl px-2 text-xs font-normal text-sidebar-content/75 hover:text-sidebar-content",
collapsed ? "w-8 justify-center px-0" : "max-w-full flex-1 justify-start")}
@@ -168,7 +167,13 @@ export function HostSwitcher({ collapsed = false, portalContainer }: { collapsed
// The mobile sidebar already owns the modal lock; a nested lock can outlive it on navigation.
return <TooltipProvider><Tooltip>
{shell ? <DropdownMenu modal={!portalContainer}><DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger><HostMenuContent picker={shell} portalContainer={portalContainer} /></DropdownMenu> : trigger}
<TooltipContent side="top">{hint}</TooltipContent>
<TooltipContent side="top" className="max-w-[min(24rem,calc(100vw-2rem))] space-y-1 break-words">
<p className="font-medium">{picker.name}</p>
{picker.hostname !== picker.name ? <p className="font-mono text-xs text-muted-foreground">{picker.hostname}</p> : null}
<p>{currentLabel}</p>
{pendingName ? <p>{t("remote.preparing", { name: pendingName })}</p> : null}
{picker.error ? <p className="text-destructive">{picker.error}</p> : null}
</TooltipContent>
</Tooltip></TooltipProvider>;
}
@@ -319,7 +319,7 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro
}}>
{busy === profile.id ? <Loader2 className="h-[18px] w-[18px] shrink-0 animate-spin text-muted-foreground" /> : <Server className="h-[18px] w-[18px] shrink-0 text-muted-foreground" />}
<span className="min-w-0 flex-1"><span className="block truncate text-[14px] font-medium">{profile.name}</span><span className="mt-0.5 block truncate text-xs text-muted-foreground">{profile.host}</span>
{groups.some((other) => other.id !== groupId && other.profile.name === profile.name && other.profile.host === profile.host) && <span className="mt-0.5 block truncate text-xs text-muted-foreground" title={profile.config_path}>{profile.port ? `:${profile.port} · ` : ""}{profile.config_path}</span>}
{groups.some((other) => other.id !== groupId && other.profile.name === profile.name && other.profile.host === profile.host) && <span className="mt-0.5 block truncate text-xs text-muted-foreground" title={profile.config_path}>{profile.port ? <span className="mr-2">:{profile.port}</span> : null}{profile.config_path}</span>}
<span id={`${statusId}-${profile.id}`} className="mt-1 block"><HostConnectionStatus state={connections.hostStates[profile.id] || "closed"} /></span>
{profile.compatibility && profile.compatibility.status !== "compatible" && <span className="mt-1 block text-xs text-muted-foreground">
{t(`remote.compatibility.${profile.compatibility.status}`)}
@@ -134,7 +134,7 @@ export function RemoteInstances({ children }: { children: ReactNode }) {
manage,
cancel: hosts.cancel, clearError: hosts.clearError, restoreFocus: () => { if (!managing) restoreFocus(); },
};
useEffect(() => { if (selected) document.title = `${selected.name} · nanobot`; }, [selected]);
useEffect(() => { if (selected) document.title = selected.name; }, [selected]);
useEffect(() => {
const rememberFocus = (event: FocusEvent) => {
if (!managementOpen.current && event.target instanceof HTMLElement && localPanel.current?.contains(event.target)
@@ -190,9 +190,10 @@ export function RemoteInstances({ children }: { children: ReactNode }) {
<RemoteConnectionsPage onBackToChat={() => changeManagement(false)} mainNavigationExpanded={!!bridge.surface?.left} />
</ThemeProvider>
</main>}
{!managing && selected && (offline || !activeFrame?.loaded) && <div className="absolute inset-0 overflow-y-auto bg-background p-6 text-center"><div className="flex min-h-full flex-col items-center justify-center gap-3">
{!managing && selected && (offline || !activeFrame?.loaded) && <div role="region" aria-label={t(offline ? recoveryTitle : "remote.opening")} className="absolute inset-0 overflow-y-auto bg-background p-6 text-center"><div className="flex min-h-full flex-col items-center justify-center gap-3">
{offline ? <PlugZap className="h-7 w-7 text-muted-foreground" /> : <Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />}
<p className="max-w-full text-pretty text-xs text-muted-foreground [overflow-wrap:anywhere]">{selected.name} · {selected.hostname}</p>
<p className="max-w-full text-pretty text-xs text-muted-foreground [overflow-wrap:anywhere]"><span className="block font-medium">{selected.name}</span>{" "}
{selected.hostname !== selected.name ? <span className="block">{selected.hostname}</span> : null}</p>
<p className="font-medium">{t(offline ? recoveryTitle : "remote.opening")}</p>
<p className="max-w-sm text-pretty text-sm text-muted-foreground">{recoveryMessage}</p>
<div className="flex max-w-full flex-wrap items-stretch justify-center gap-2 [&>button]:h-auto [&>button]:min-h-10 [&>button]:min-w-0 [&>button]:max-w-full [&>button]:whitespace-normal">