fix(webui): unify provider logo tiles on white

This commit is contained in:
Xubin Ren committed 2026-09-19 17:59:17 +08:00
1 parent 83a747bea2
commit a15656e6ac
2 files changed
+8 -6

No files matched your search

@@ -1281,7 +1281,7 @@ export function ProviderIcon({
data-testid={`provider-logo-${provider}`}
className={cn(
"relative grid h-8 w-8 shrink-0 place-items-center overflow-hidden rounded-[9px] text-[11px] font-semibold text-muted-foreground",
showLoadedLogo ? "bg-transparent" : "bg-muted",
showLoadedLogo ? "bg-white" : "bg-muted",
)}
aria-hidden
>
@@ -1304,7 +1304,7 @@ export function ProviderIcon({
referrerPolicy="no-referrer"
draggable={false}
className={cn(
"absolute h-full w-full object-contain transition-opacity duration-150 motion-reduce:transition-none",
"absolute h-7 w-7 object-contain transition-opacity duration-150 motion-reduce:transition-none",
logoLoaded ? "opacity-100" : "opacity-0",
)}
onLoad={onLogoLoad}
+6 -4
View File
@@ -15,7 +15,7 @@ describe("settings provider icons", () => {
}
it.each(["openai_codex", "anthropic", "deepseek", "gemini", "xai_grok"])(
"shows %s as a single full-size logo after loading",
"shows %s on a single white tile with a small inset after loading",
(provider) => {
const { container } = render(<ProviderIcon provider={provider} showBrandLogos />);
const icon = container.firstElementChild!;
@@ -26,13 +26,13 @@ describe("settings provider icons", () => {
expect(icon).toHaveClass("bg-muted");
expect(fallback).toHaveTextContent(providerBrand(provider)!.initials);
expect(fallback).toHaveClass("opacity-100");
expect(image).toHaveClass("h-full", "w-full", "object-contain", "opacity-0");
expect(image).toHaveClass("h-7", "w-7", "object-contain", "opacity-0");
expect(image).toHaveAttribute("alt", "");
fireEvent.load(image);
expectFootprint(icon);
expect(icon).toHaveClass("bg-transparent");
expect(icon).toHaveClass("bg-white");
expect(icon).not.toHaveClass("bg-muted");
expect(icon).not.toHaveAttribute("style");
expect(fallback).toHaveClass("opacity-0");
@@ -77,13 +77,15 @@ describe("settings provider icons", () => {
rerender(<ProviderIcon provider="openai_codex" showBrandLogos />);
expectFootprint(icon);
expect(icon).toHaveClass("bg-transparent");
expect(icon).toHaveClass("bg-white");
expect(icon.querySelector("img")).toHaveClass("opacity-100");
});
it("uses the same footprint for unknown and custom providers", () => {
const { container, rerender } = render(<ProviderIcon provider="custom" showBrandLogos />);
expectFootprint(container.firstElementChild!);
expect(container.firstElementChild).toHaveClass("bg-muted");
expect(container.firstElementChild).not.toHaveClass("bg-white");
expect(container.querySelector("img")).toBeNull();
expect(container.querySelector("svg")).not.toBeNull();