diff --git a/web/src/app/home/plugins/components/plugin-installed/ExtensionCardComponent.tsx b/web/src/app/home/plugins/components/plugin-installed/ExtensionCardComponent.tsx index 61c19ff7..8ddf4f34 100644 --- a/web/src/app/home/plugins/components/plugin-installed/ExtensionCardComponent.tsx +++ b/web/src/app/home/plugins/components/plugin-installed/ExtensionCardComponent.tsx @@ -2,7 +2,16 @@ import { ExtensionCardVO, ExtensionType } from './ExtensionCardVO'; import { useState } from 'react'; import { Badge } from '@/components/ui/badge'; import { useTranslation } from 'react-i18next'; -import { BugIcon, ExternalLink, Ellipsis, Trash, ArrowUp } from 'lucide-react'; +import { + BugIcon, + ExternalLink, + Ellipsis, + Trash, + ArrowUp, + Server, + Sparkles, + Puzzle, +} from 'lucide-react'; import { getCloudServiceClientSync, systemInfo } from '@/app/infra/http'; import { httpClient } from '@/app/infra/http/HttpClient'; import { Button } from '@/components/ui/button'; @@ -30,6 +39,17 @@ export default function ExtensionCardComponent({ }: ExtensionCardComponentProps) { const { t } = useTranslation(); const [dropdownOpen, setDropdownOpen] = useState(false); + const [iconFailed, setIconFailed] = useState(false); + + const FallbackIcon = + cardVO.type === 'mcp' + ? Server + : cardVO.type === 'skill' + ? Sparkles + : Puzzle; + const iconSrc = + cardVO.iconURL || httpClient.getPluginIconURL(cardVO.author, cardVO.name); + const showFallback = iconFailed || !iconSrc; const getTypeBadgeColor = (type: ExtensionType) => { switch (type) { @@ -202,14 +222,18 @@ export default function ExtensionCardComponent({ onClick={() => onCardClick()} >
- extension icon + {showFallback ? ( +
+ +
+ ) : ( + extension icon setIconFailed(true)} + /> + )}