Skip to content

The agent that grows with you

refactor(webapp): share the greyed profile row glyph between both pickers

unsupportedpastelsb5b28309f89c
diff --git a/apps/desktop/src/app/chat/sidebar/profile-dropdown-switcher.tsx b/apps/desktop/src/app/chat/sidebar/profile-dropdown-switcher.tsx
index 9072c602603..5051a2d8abe 100644
--- a/apps/desktop/src/app/chat/sidebar/profile-dropdown-switcher.tsx
+++ b/apps/desktop/src/app/chat/sidebar/profile-dropdown-switcher.tsx
@@ -54,7 +54,7 @@ import { FleetGatewayMenuGroup } from './fleet-gateway-menu-group'
import { buildRestGroups, type FleetAgent, fleetRouteKey } from './fleet-rail'
import { useLocalDeviceSwitch } from './local-device-switch'
import { ProfileLaunchContextMenu } from './profile-launch-menu'
-import { UnservedProfileNote, useUnservedProfiles } from './unserved-profiles'
+import { ProfileRowGlyph, UnservedProfileNote, useUnservedProfiles } from './unserved-profiles'
import { useFleetRoster } from './use-fleet-roster'
import { useProfilePrewarm } from './use-profile-prewarm'
import { useProfileRailRefreshOnActive } from './use-profile-rail-refresh-on-active'
@@ -318,13 +318,7 @@ function ProfileItem({ color, connectionId, isDefault, label, launchMenu, name,
value={name}
>
<span className="flex min-w-0 items-center gap-1.5">
- <ProfileGlyph
- aria-hidden="true"
- className={cn(unserved && 'grayscale')}
- color={color}
- isDefault={isDefault}
- name={name}
- />
+ <ProfileRowGlyph color={color} isDefault={isDefault} name={name} unserved={unserved} />
<span className="truncate">{label}</span>
</span>
{unserved && <UnservedProfileNote />}
diff --git a/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx b/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx
index 377f089576f..98ed3654fdb 100644
--- a/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx
+++ b/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx
@@ -108,7 +108,7 @@ import { buildRestGroups, countRestAgents, type FleetAgent, type FleetGroup, fle
import { useLocalDeviceSwitch } from './local-device-switch'
import { ProfileLaunchContextMenu, ProfileLaunchMenuSection } from './profile-launch-menu'
import { ProfileRemoteOverrideDialog } from './profile-remote-override-dialog'
-import { UnservedProfileNote, useUnservedProfiles } from './unserved-profiles'
+import { ProfileRowGlyph, UnservedProfileNote, useUnservedProfiles } from './unserved-profiles'
import { useFleetRoster } from './use-fleet-roster'
import { useProfilePrewarm } from './use-profile-prewarm'
import { useProfileRailRefreshOnActive } from './use-profile-rail-refresh-on-active'
@@ -1036,13 +1036,7 @@ function ProfileDropdownItem({
value={name}
>
<span className="flex min-w-0 items-center gap-1.5">
- <ProfileGlyph
- aria-hidden="true"
- className={cn(unserved && 'grayscale')}
- color={color}
- isDefault={isDefault}
- name={name}
- />
+ <ProfileRowGlyph color={color} isDefault={isDefault} name={name} unserved={unserved} />
<span className="truncate">{label}</span>
{summary && !hideStatus && <ProfileStatusDot summary={summary} />}
</span>
diff --git a/apps/desktop/src/app/chat/sidebar/unserved-profiles.tsx b/apps/desktop/src/app/chat/sidebar/unserved-profiles.tsx
index 7bfc9155253..dd5393aac42 100644
--- a/apps/desktop/src/app/chat/sidebar/unserved-profiles.tsx
+++ b/apps/desktop/src/app/chat/sidebar/unserved-profiles.tsx
@@ -1,7 +1,9 @@
-import { useEffect, useState } from 'react'
+import { type ComponentProps, useEffect, useState } from 'react'
+import { ProfileGlyph } from '@/components/ui/profile-glyph'
import { useI18n } from '@/i18n'
import { isBrowserHostedDesktop } from '@/lib/platform'
+import { cn } from '@/lib/utils'
import { normalizeProfileKey } from '@/store/profile'
import type { ProfileInfo } from '@/types/hermes'
@@ -44,6 +46,16 @@ export function useUnservedProfiles(profiles: readonly ProfileInfo[]): ReadonlyS
return unserved
}
+/** A profile menu row's mark, greyed when the row's profile is not served here. Both pickers' rows
+ * use it with `UnservedProfileNote`, so an unserved row looks the same in each. */
+export function ProfileRowGlyph({
+ className,
+ unserved,
+ ...props
+}: ComponentProps<typeof ProfileGlyph> & { unserved: boolean }) {
+ return <ProfileGlyph aria-hidden="true" className={cn(unserved && 'grayscale', className)} {...props} />
+}
+
/** What an unserved row says beside its name; the row itself is disabled and greyed. Its accessible
* name reads `<profile>, <note>` the way a row's status does (one text node, so the comma's space
* survives name computation). */