From a111d0bc822d9191135b18a2a38729c99589e828 Mon Sep 17 00:00:00 2001 From: SSU-WEI HUANG Date: Mon, 3 Aug 2026 12:32:39 +0800 Subject: [PATCH] feat: use official Pi agent logo (#1335) * feat: add official Pi agent logo * fix: honor selected theme for Pi logo --- web/src/components/AgentFlavorIcon.test.tsx | 15 ++++++------ web/src/components/AgentFlavorIcon.tsx | 27 +++++++++++++++------ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/web/src/components/AgentFlavorIcon.test.tsx b/web/src/components/AgentFlavorIcon.test.tsx index 76616df3..76d9f706 100644 --- a/web/src/components/AgentFlavorIcon.test.tsx +++ b/web/src/components/AgentFlavorIcon.test.tsx @@ -3,8 +3,7 @@ import { render } from '@testing-library/react' import { AGENT_FLAVORS } from '@hapi/protocol' import { AgentFlavorIcon } from './AgentFlavorIcon' -// Flavors backed by a @lobehub/icons brand logo. 'pi' has no logo in the -// package and intentionally falls back to the letter badge. +// Flavors backed by a @lobehub/icons brand logo. const LOGO_FLAVORS = AGENT_FLAVORS.filter((f) => f !== 'pi') function getWrapper(container: HTMLElement): HTMLElement { @@ -29,13 +28,15 @@ describe('AgentFlavorIcon', () => { } }) - it('keeps the "Pi" letter badge for the pi flavor (no brand logo available)', () => { + it('renders the Pi logo with transparent, theme-aware coloring', () => { const { container } = render() const badge = getWrapper(container) - expect(container.querySelector('svg')).toBeNull() - expect(badge.textContent).toBe('Pi') - expect(badge.className).toContain('bg-[#5b21b6]') - expect(badge.className).toContain('text-white') + const svg = container.querySelector('svg') + expect(svg).not.toBeNull() + expect(badge.textContent).toBe('') + expect(badge.className).not.toContain('rounded-sm') + expect(badge.className).toContain('text-[var(--app-fg)]') + expect(svg?.getAttribute('viewBox')).toBe('0 0 800 800') }) it.each([null, undefined, '', ' ', 'mystery-cli'])( diff --git a/web/src/components/AgentFlavorIcon.tsx b/web/src/components/AgentFlavorIcon.tsx index 259a4805..8df6f416 100644 --- a/web/src/components/AgentFlavorIcon.tsx +++ b/web/src/components/AgentFlavorIcon.tsx @@ -24,13 +24,13 @@ const FLAVOR_LOGOS: Record = { opencode: OpenCodeMono, } -// Letter-badge fallback for flavors without a brand logo in @lobehub/icons -// (pi) and for anything unrecognized. -const FLAVOR_BADGES: Record = { - pi: { - label: 'Pi', - colors: 'bg-[#5b21b6] text-white', - }, +function PiLogo() { + return ( + + + + + ) } const UNKNOWN_FLAVOR_BADGE = { @@ -54,7 +54,18 @@ export function AgentFlavorIcon({ flavor, className }: { flavor?: string | null; ) } - const badge = FLAVOR_BADGES[normalized] ?? UNKNOWN_FLAVOR_BADGE + if (normalized === 'pi') { + return ( + + ) + } + + const badge = UNKNOWN_FLAVOR_BADGE return (