feat(webui): polish agent output and app discovery

This commit is contained in:
Xubin Ren
2026-07-22 22:42:31 +08:00
parent b189a37648
commit aa8387fb4d
87 changed files with 6225 additions and 2379 deletions
+8 -7
View File
@@ -7,15 +7,13 @@ import {
} from "@/hooks/useLogoFallback";
function TestLogo({ urls }: { urls: string[] }) {
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(urls);
const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(urls);
if (!logoUrl) return <span>No logo</span>;
return (
<img
src={logoUrl}
alt="Logo"
onLoad={onLogoLoad}
onError={onLogoError}
/>
<>
<span>{logoLoaded ? "Loaded" : "Loading"}</span>
<img src={logoUrl} alt="Logo" onLoad={onLogoLoad} onError={onLogoError} />
</>
);
}
@@ -32,15 +30,18 @@ describe("useLogoFallback", () => {
const first = render(<TestLogo urls={urls} />);
expect(screen.getByRole("img", { name: "Logo" })).toHaveAttribute("src", urls[0]);
expect(screen.getByText("Loading")).toBeInTheDocument();
fireEvent.error(screen.getByRole("img", { name: "Logo" }));
expect(screen.getByRole("img", { name: "Logo" })).toHaveAttribute("src", urls[1]);
fireEvent.load(screen.getByRole("img", { name: "Logo" }));
expect(screen.getByText("Loaded")).toBeInTheDocument();
first.unmount();
render(<TestLogo urls={urls} />);
expect(screen.getByRole("img", { name: "Logo" })).toHaveAttribute("src", urls[1]);
expect(screen.getByText("Loaded")).toBeInTheDocument();
});
it("returns no logo once every candidate failed", () => {