mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-24 18:22:38 +00:00
fix(app): render terminal-profile icons instead of the generic Bot
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Bot } from "lucide-react-native";
|
||||
import { SvgXml } from "react-native-svg";
|
||||
import { TERMINAL_PROFILE_ICON_NAMES } from "@getpaseo/protocol/provider-icon-names";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { replaceProviderSnapshotIcons } from "./provider-icon-name";
|
||||
import { getProviderIcon, type ProviderIconComponent } from "./provider-icons";
|
||||
@@ -30,4 +31,26 @@ describe("getProviderIcon", () => {
|
||||
|
||||
expect(getProviderIcon("plain-provider", "server-1")).toBe(Bot);
|
||||
});
|
||||
|
||||
it("renders the shipped SVG for the agy terminal-profile icon instead of the Bot", () => {
|
||||
const icon = getProviderIcon("agy");
|
||||
expect(icon).not.toBe(Bot);
|
||||
expect(icon.displayName).toBe("SvgProviderIcon(agy)");
|
||||
});
|
||||
|
||||
it("resolves every registered terminal-profile icon to its shipped SVG, not the Bot", () => {
|
||||
for (const name of TERMINAL_PROFILE_ICON_NAMES) {
|
||||
const icon = getProviderIcon(name);
|
||||
expect(icon, `terminal-profile icon "${name}" fell back to Bot`).not.toBe(Bot);
|
||||
expect(icon.displayName).toBe(`SvgProviderIcon(${name})`);
|
||||
}
|
||||
});
|
||||
|
||||
it("still resolves ACP catalog icons to their SVG (the seeded map is shared)", () => {
|
||||
expect(getProviderIcon("cursor")).not.toBe(Bot);
|
||||
});
|
||||
|
||||
it("falls back to the Bot for an unknown icon id", () => {
|
||||
expect(getProviderIcon("definitely-not-a-real-icon")).toBe(Bot);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Bot, PackagePlus } from "lucide-react-native";
|
||||
import { createElement, type ComponentType } from "react";
|
||||
import { SvgXml } from "react-native-svg";
|
||||
import { TERMINAL_PROFILE_ICON_NAMES } from "@getpaseo/protocol/provider-icon-names";
|
||||
import { ClaudeIcon } from "@/components/icons/claude-icon";
|
||||
import { CodexIcon } from "@/components/icons/codex-icon";
|
||||
import { CopilotIcon } from "@/components/icons/copilot-icon";
|
||||
@@ -8,6 +9,7 @@ import { MiniMaxIcon } from "@/components/icons/minimax-icon";
|
||||
import { OpenCodeIcon } from "@/components/icons/opencode-icon";
|
||||
import { OmpIcon } from "@/components/icons/omp-icon";
|
||||
import { PiIcon } from "@/components/icons/pi-icon";
|
||||
import { ACP_PROVIDER_ICON_SVGS } from "@/assets/acp-provider-icons";
|
||||
import { ACP_PROVIDER_CATALOG } from "@/data/acp-provider-catalog";
|
||||
import { resolveProviderIconName } from "@/components/provider-icon-name";
|
||||
|
||||
@@ -29,10 +31,17 @@ const BUILTIN_PROVIDER_ICONS: Record<string, ProviderIconComponent> = {
|
||||
pi: PiIcon as unknown as ProviderIconComponent,
|
||||
};
|
||||
|
||||
const CATALOG_ICON_SVGS = new Map(
|
||||
const CATALOG_ICON_SVGS = new Map<string, string>(
|
||||
ACP_PROVIDER_CATALOG.flatMap((entry) => (entry.iconSvg ? [[entry.id, entry.iconSvg]] : [])),
|
||||
);
|
||||
|
||||
for (const name of TERMINAL_PROFILE_ICON_NAMES) {
|
||||
const iconSvg = (ACP_PROVIDER_ICON_SVGS as Record<string, string | undefined>)[name];
|
||||
if (iconSvg) {
|
||||
CATALOG_ICON_SVGS.set(name, iconSvg);
|
||||
}
|
||||
}
|
||||
|
||||
const catalogIconComponents = new Map<string, ProviderIconComponent>();
|
||||
const snapshotIconComponents = new Map<string, { svg: string; component: ProviderIconComponent }>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user