Skip to content

Commit 09499e9

Browse files
refactor(web): simplify provider badge fix
Co-authored-by: maria <[email protected]>
1 parent 454e353 commit 09499e9

2 files changed

Lines changed: 1 addition & 98 deletions

File tree

‎apps/web/src/components/chat/ProviderInstanceIcon.test.tsx‎

Lines changed: 0 additions & 83 deletions
This file was deleted.

‎apps/web/src/components/chat/ProviderInstanceIcon.tsx‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@ import { type ProviderDriverKind } from "@t3tools/contracts";
44
import { PROVIDER_ICON_BY_PROVIDER } from "./providerIconUtils";
55
import { cn } from "~/lib/utils";
66

7-
const NEUTRAL_BADGE_SURFACE = {
8-
backgroundImage: [
9-
"linear-gradient(var(--muted), var(--muted))",
10-
"linear-gradient(var(--card), var(--card))",
11-
"linear-gradient(var(--background), var(--background))",
12-
"linear-gradient(Canvas, Canvas)",
13-
].join(", "),
14-
} satisfies CSSProperties;
15-
167
export function providerInstanceInitials(label: string): string {
178
const words = label.replace(/[_-]+/g, " ").split(/\s+/u).filter(Boolean);
189
if (words.length === 0) return "";
@@ -41,11 +32,6 @@ export const ProviderInstanceIcon = memo(function ProviderInstanceIcon(props: {
4132
? ({ "--provider-accent": props.accentColor } as CSSProperties)
4233
: undefined;
4334
const badgeContent = props.badgeContent ?? "initials";
44-
// Stack the theme surfaces over Canvas so the badge always occludes the glyph.
45-
// Imported themes may make any individual surface translucent.
46-
const badgeSurface: CSSProperties | undefined = props.accentColor
47-
? undefined
48-
: NEUTRAL_BADGE_SURFACE;
4935

5036
return (
5137
<span
@@ -82,7 +68,7 @@ export const ProviderInstanceIcon = memo(function ProviderInstanceIcon(props: {
8268
: "bg-card text-muted-foreground",
8369
props.badgeClassName,
8470
)}
85-
style={{ borderColor: indicatorBackground, ...badgeSurface }}
71+
style={{ borderColor: indicatorBackground }}
8672
aria-hidden
8773
>
8874
{badgeContent === "initials" ? providerInstanceInitials(props.displayName) : null}

0 commit comments

Comments
 (0)