@devries-cameron20 / t3code Mirror · read-only / commits / a5d35321bd
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 16:30 UTC

fix(web): show provider account accent badge in sidebar rows and hover card (#5980)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

Vitaly Iegorov committed Aug 15, 2026 at 14:06 UTC a5d35321bd620400dc03ddf7a42ee2672b225ac3
4 files changed +71 -28
apps/web/src/components/Sidebar.tsx
+44 -11
@@ -158,7 +158,11 @@ import {
158 import { ProjectFavicon } from "./ProjectFavicon";
159 import { ProviderInstanceIcon } from "./chat/ProviderInstanceIcon";
160 import { getTriggerDisplayModelLabel } from "./chat/providerIconUtils";
161 -import { deriveProviderInstanceEntries, type ProviderInstanceEntry } from "../providerInstances";
161 +import {
162 + deriveProviderInstanceEntries,
163 + shouldShowInstanceBadge,
164 + type ProviderInstanceEntry,
165 +} from "../providerInstances";
166 import { primaryServerProvidersAtom } from "../state/server";
167 import { useThreadRunningTerminalIds } from "../state/terminalSessions";
168 import { stackedThreadToast, toastManager } from "./ui/toast";
@@ -247,7 +251,8 @@ function SidebarThreadTooltip({
251 projectCwd,
252 projectFaviconPath,
253 environmentLabel,
250 - driverKind,
254 + providerEntry,
255 + showInstanceBadge,
256 modelInstanceId,
257 modelLabel,
258 branchMismatch,
@@ -259,7 +264,8 @@ function SidebarThreadTooltip({
264 projectCwd: string | null;
265 projectFaviconPath: string | null;
266 environmentLabel: string | null;
262 - driverKind: ProviderInstanceEntry["driverKind"] | null;
267 + providerEntry: ProviderInstanceEntry | null;
268 + showInstanceBadge: boolean;
269 modelInstanceId: string;
270 modelLabel: string;
271 branchMismatch: {
@@ -269,6 +275,7 @@ function SidebarThreadTooltip({
275 terminalStatus: TerminalStatusIndicator | null;
276 terminalProcessCount: number;
277 }) {
278 + const driverKind = providerEntry?.driverKind ?? null;
279 return (
280 <TooltipPopup
281 side="right"
@@ -317,10 +324,21 @@ function SidebarThreadTooltip({
324 <div className="flex min-w-0 items-center gap-2">
325 <ProviderInstanceIcon
326 driverKind={driverKind}
320 - displayName={thread.session?.providerName ?? modelInstanceId}
327 + displayName={
328 + providerEntry?.displayName ?? thread.session?.providerName ?? modelInstanceId
329 + }
330 + accentColor={providerEntry?.accentColor}
331 + // Initials would swallow a size-3 glyph: accent dot, name in label.
332 + showBadge={showInstanceBadge && providerEntry?.accentColor !== undefined}
333 + badgeContent="none"
334 + badgeClassName="h-2 min-w-2 px-0"
335 iconClassName="size-3 shrink-0 grayscale opacity-60"
336 />
323 - <div className="min-w-0 truncate text-foreground/75">{modelLabel}</div>
337 + <div className="min-w-0 truncate text-foreground/75">
338 + {showInstanceBadge && providerEntry
339 + ? `${modelLabel} · ${providerEntry.displayName}`
340 + : modelLabel}
341 + </div>
342 </div>
343 ) : null}
344 {terminalStatus ? (
@@ -867,6 +885,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
885 const modelInstanceId = thread.session?.providerInstanceId ?? thread.modelSelection.instanceId;
886 const providerEntry = props.providerEntryByInstanceId.get(modelInstanceId) ?? null;
887 const driverKind = providerEntry?.driverKind ?? null;
888 + const showInstanceBadge =
889 + providerEntry !== null &&
890 + shouldShowInstanceBadge(providerEntry, props.providerEntryByInstanceId.values());
891 const selectedModel = providerEntry?.models.find(
892 (model) => model.slug === thread.modelSelection.model,
893 );
@@ -884,7 +905,8 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
905 projectCwd={props.projectCwd}
906 projectFaviconPath={props.projectFaviconPath}
907 environmentLabel={props.environmentLabel}
887 - driverKind={driverKind}
908 + providerEntry={providerEntry}
909 + showInstanceBadge={showInstanceBadge}
910 modelInstanceId={modelInstanceId}
911 modelLabel={modelLabel}
912 branchMismatch={branchMismatch}
@@ -1481,11 +1503,19 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
1503 </span>
1504 ) : null}
1505 {driverKind ? (
1484 - <span className="inline-flex shrink-0 items-center opacity-60">
1506 + <span className="inline-flex shrink-0 items-center">
1507 <ProviderInstanceIcon
1508 driverKind={driverKind}
1487 - displayName={thread.session?.providerName ?? modelInstanceId}
1488 - iconClassName="size-3.5"
1509 + displayName={
1510 + providerEntry?.displayName ??
1511 + thread.session?.providerName ??
1512 + modelInstanceId
1513 + }
1514 + accentColor={providerEntry?.accentColor}
1515 + showBadge={showInstanceBadge}
1516 + // Glyph dims, badge stays saturated; offset matches the composer trigger.
1517 + iconClassName="size-3.5 opacity-60"
1518 + badgeClassName="right-[-0.1875rem] bottom-[-0.1875rem] h-3 min-w-3 px-0.5 text-[7px]"
1519 />
1520 </span>
1521 ) : null}
@@ -1542,7 +1572,9 @@ const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props: {
1572 });
1573 const modelInstanceId = thread.session?.providerInstanceId ?? thread.modelSelection.instanceId;
1574 const providerEntry = props.providerEntryByInstanceId.get(modelInstanceId) ?? null;
1545 - const driverKind = providerEntry?.driverKind ?? null;
1575 + const showInstanceBadge =
1576 + providerEntry !== null &&
1577 + shouldShowInstanceBadge(providerEntry, props.providerEntryByInstanceId.values());
1578 const selectedModel = providerEntry?.models.find(
1579 (model) => model.slug === thread.modelSelection.model,
1580 );
@@ -1600,7 +1632,8 @@ const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props: {
1632 projectCwd={props.projectCwd}
1633 projectFaviconPath={props.projectFaviconPath}
1634 environmentLabel={props.environmentLabel}
1603 - driverKind={driverKind}
1635 + providerEntry={providerEntry}
1636 + showInstanceBadge={showInstanceBadge}
1637 modelInstanceId={modelInstanceId}
1638 modelLabel={modelLabel}
1639 branchMismatch={branchMismatch}
apps/web/src/components/chat/ModelPickerSidebar.tsx
+7 -12
@@ -1,10 +1,14 @@
1 import { type ProviderInstanceId } from "@t3tools/contracts";
2 -import { memo, useLayoutEffect, useMemo, useRef, useState } from "react";
2 +import { memo, useLayoutEffect, useRef, useState } from "react";
3 import { SparklesIcon, StarIcon } from "lucide-react";
4 import { ProviderInstanceIcon } from "./ProviderInstanceIcon";
5 import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
6 import { cn } from "~/lib/utils";
7 -import { isProviderInstancePickerReady, type ProviderInstanceEntry } from "../../providerInstances";
7 +import {
8 + isProviderInstancePickerReady,
9 + shouldShowInstanceBadge,
10 + type ProviderInstanceEntry,
11 +} from "../../providerInstances";
12
13 /**
14 * Build the hover tooltip for an instance button. Mirrors the old
@@ -65,14 +69,6 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
69 const [hoveredInstanceId, setHoveredInstanceId] = useState<ProviderInstanceId | null>(null);
70 const sidebarContentRef = useRef<HTMLDivElement>(null);
71 const [selectedIndicatorTop, setSelectedIndicatorTop] = useState<number | null>(null);
68 - const duplicateDriverCounts = useMemo(() => {
69 - const counts = new Map<string, number>();
70 - for (const entry of props.instanceEntries) {
71 - counts.set(entry.driverKind, (counts.get(entry.driverKind) ?? 0) + 1);
72 - }
73 - return counts;
74 - }, [props.instanceEntries]);
75 -
72 useLayoutEffect(() => {
73 const content = sidebarContentRef.current;
74 if (!content) {
@@ -143,8 +139,7 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
139 const isSelected = props.selectedInstanceId === entry.instanceId;
140 const isHovered = hoveredInstanceId === entry.instanceId;
141 const showNewBadge = props.newBadgeInstanceIds?.has(entry.instanceId) ?? false;
146 - const showInstanceBadge =
147 - Boolean(entry.accentColor) || (duplicateDriverCounts.get(entry.driverKind) ?? 0) > 1;
142 + const showInstanceBadge = shouldShowInstanceBadge(entry, props.instanceEntries);
143
144 const tooltip = isUnavailable
145 ? describeUnavailableInstance(entry)
apps/web/src/components/chat/ProviderModelPicker.tsx
+3 -5
@@ -16,7 +16,7 @@ import {
16 getTriggerDisplayModelLabel,
17 getTriggerDisplayModelName,
18 } from "./providerIconUtils";
19 -import type { ProviderInstanceEntry } from "../../providerInstances";
19 +import { shouldShowInstanceBadge, type ProviderInstanceEntry } from "../../providerInstances";
20 import { ComposerControl, ComposerControlChevron } from "./ComposerControl";
21
22 export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
@@ -67,10 +67,8 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
67 selectedInstanceOptions[0];
68 const triggerTitle = selectedModel ? getTriggerDisplayModelName(selectedModel) : props.model;
69 const triggerLabel = selectedModel ? getTriggerDisplayModelLabel(selectedModel) : props.model;
70 - const duplicateDriverCount = props.instanceEntries.filter(
71 - (entry) => activeEntry !== null && entry.driverKind === activeEntry.driverKind,
72 - ).length;
73 - const showInstanceBadge = Boolean(activeEntry?.accentColor) || duplicateDriverCount > 1;
70 + const showInstanceBadge =
71 + activeEntry !== null && shouldShowInstanceBadge(activeEntry, props.instanceEntries);
72
73 const setIsMenuOpen = (open: boolean) => {
74 props.onOpenChange?.(open);
apps/web/src/providerInstances.ts
+17
@@ -109,6 +109,23 @@ function driverKindLabel(driverKind: ProviderDriverKind): string {
109 return PROVIDER_DISPLAY_NAMES[driverKind] ?? formatProviderDriverKindLabel(driverKind);
110 }
111
112 +/**
113 + * Whether an instance's icon carries the account badge: accent color set, or
114 + * several instances sharing a driver so the brand glyph alone is ambiguous.
115 + * Shared by the composer trigger, the picker rail, and sidebar rows.
116 + */
117 +export function shouldShowInstanceBadge(
118 + entry: ProviderInstanceEntry,
119 + entries: Iterable<ProviderInstanceEntry>,
120 +): boolean {
121 + if (entry.accentColor) return true;
122 + let sharedDriverCount = 0;
123 + for (const candidate of entries) {
124 + if (candidate.driverKind === entry.driverKind && ++sharedDriverCount > 1) return true;
125 + }
126 + return false;
127 +}
128 +
129 export function normalizeProviderAccentColor(value: string | undefined): string | undefined {
130 const trimmed = value?.trim();
131 if (!trimmed) return undefined;