fix(webui): unify provider logo tiles on white
This commit is contained in:
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}`}
|
data-testid={`provider-logo-${provider}`}
|
||||||
className={cn(
|
className={cn(
|
||||||
"relative grid h-8 w-8 shrink-0 place-items-center overflow-hidden rounded-[9px] text-[11px] font-semibold text-muted-foreground",
|
"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
|
aria-hidden
|
||||||
>
|
>
|
||||||
@@ -1304,7 +1304,7 @@ export function ProviderIcon({
|
|||||||
referrerPolicy="no-referrer"
|
referrerPolicy="no-referrer"
|
||||||
draggable={false}
|
draggable={false}
|
||||||
className={cn(
|
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",
|
logoLoaded ? "opacity-100" : "opacity-0",
|
||||||
)}
|
)}
|
||||||
onLoad={onLogoLoad}
|
onLoad={onLogoLoad}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ describe("settings provider icons", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
it.each(["openai_codex", "anthropic", "deepseek", "gemini", "xai_grok"])(
|
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) => {
|
(provider) => {
|
||||||
const { container } = render(<ProviderIcon provider={provider} showBrandLogos />);
|
const { container } = render(<ProviderIcon provider={provider} showBrandLogos />);
|
||||||
const icon = container.firstElementChild!;
|
const icon = container.firstElementChild!;
|
||||||
@@ -26,13 +26,13 @@ describe("settings provider icons", () => {
|
|||||||
expect(icon).toHaveClass("bg-muted");
|
expect(icon).toHaveClass("bg-muted");
|
||||||
expect(fallback).toHaveTextContent(providerBrand(provider)!.initials);
|
expect(fallback).toHaveTextContent(providerBrand(provider)!.initials);
|
||||||
expect(fallback).toHaveClass("opacity-100");
|
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", "");
|
expect(image).toHaveAttribute("alt", "");
|
||||||
|
|
||||||
fireEvent.load(image);
|
fireEvent.load(image);
|
||||||
|
|
||||||
expectFootprint(icon);
|
expectFootprint(icon);
|
||||||
expect(icon).toHaveClass("bg-transparent");
|
expect(icon).toHaveClass("bg-white");
|
||||||
expect(icon).not.toHaveClass("bg-muted");
|
expect(icon).not.toHaveClass("bg-muted");
|
||||||
expect(icon).not.toHaveAttribute("style");
|
expect(icon).not.toHaveAttribute("style");
|
||||||
expect(fallback).toHaveClass("opacity-0");
|
expect(fallback).toHaveClass("opacity-0");
|
||||||
@@ -77,13 +77,15 @@ describe("settings provider icons", () => {
|
|||||||
|
|
||||||
rerender(<ProviderIcon provider="openai_codex" showBrandLogos />);
|
rerender(<ProviderIcon provider="openai_codex" showBrandLogos />);
|
||||||
expectFootprint(icon);
|
expectFootprint(icon);
|
||||||
expect(icon).toHaveClass("bg-transparent");
|
expect(icon).toHaveClass("bg-white");
|
||||||
expect(icon.querySelector("img")).toHaveClass("opacity-100");
|
expect(icon.querySelector("img")).toHaveClass("opacity-100");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses the same footprint for unknown and custom providers", () => {
|
it("uses the same footprint for unknown and custom providers", () => {
|
||||||
const { container, rerender } = render(<ProviderIcon provider="custom" showBrandLogos />);
|
const { container, rerender } = render(<ProviderIcon provider="custom" showBrandLogos />);
|
||||||
expectFootprint(container.firstElementChild!);
|
expectFootprint(container.firstElementChild!);
|
||||||
|
expect(container.firstElementChild).toHaveClass("bg-muted");
|
||||||
|
expect(container.firstElementChild).not.toHaveClass("bg-white");
|
||||||
expect(container.querySelector("img")).toBeNull();
|
expect(container.querySelector("img")).toBeNull();
|
||||||
expect(container.querySelector("svg")).not.toBeNull();
|
expect(container.querySelector("svg")).not.toBeNull();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user