Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix(docs): handle toolkit icon load failures with proper fallback
Sushmithamallesha66d8736e4ae
diff --git a/docs/components/toolkits/toolkit-detail.tsx b/docs/components/toolkits/toolkit-detail.tsxindex 848990bda..4cf51feb8 100644--- a/docs/components/toolkits/toolkit-detail.tsx+++ b/docs/components/toolkits/toolkit-detail.tsx@@ -16,15 +16,21 @@ interface ToolkitDetailProps {}function ToolkitIcon({ toolkit }: { toolkit: Toolkit }) {+ const [imgFailed, setImgFailed] = useState(false);+ const fallback = (toolkit.name?.trim() || toolkit.slug).charAt(0).toUpperCase();+return (- <div- className="flex h-16 w-16 shrink-0 items-center justify-center rounded-xl border border-fd-border bg-fd-card bg-center bg-no-repeat text-xl font-semibold text-fd-muted-foreground shadow-sm"- style={toolkit.logo ? {- backgroundImage: `url(${toolkit.logo})`,- backgroundSize: '60%',- } : undefined}- >- {!toolkit.logo && (toolkit.name?.trim() || toolkit.slug).charAt(0).toUpperCase()}+ <div className="flex h-16 w-16 shrink-0 items-center justify-center rounded-xl border border-fd-border bg-fd-card text-xl font-semibold text-fd-muted-foreground shadow-sm">+ {toolkit.logo && !imgFailed ? (+ <img+ src={toolkit.logo}+ alt=""+ className="h-[60%] w-[60%] object-contain"+ onError={() => setImgFailed(true)}+ />+ ) : (+ fallback+ )}</div>);}diff --git a/docs/components/toolkits/toolkits-landing.tsx b/docs/components/toolkits/toolkits-landing.tsxindex 465964700..2c2171c61 100644--- a/docs/components/toolkits/toolkits-landing.tsx+++ b/docs/components/toolkits/toolkits-landing.tsx@@ -23,15 +23,21 @@ const POPULAR_SLUGS = [];function ToolkitIcon({ toolkit }: { toolkit: ToolkitSummary }) {+ const [imgFailed, setImgFailed] = useState(false);+ const fallback = toolkit.name.trim().charAt(0).toUpperCase();+return (- <div- className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-fd-border/50 bg-fd-background bg-center bg-no-repeat text-sm font-medium text-fd-muted-foreground sm:h-10 sm:w-10"- style={toolkit.logo ? {- backgroundImage: `url(${toolkit.logo})`,- backgroundSize: '65%',- } : undefined}- >- {!toolkit.logo && toolkit.name.trim().charAt(0).toUpperCase()}+ <div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-fd-border/50 bg-fd-background text-sm font-medium text-fd-muted-foreground sm:h-10 sm:w-10">+ {toolkit.logo && !imgFailed ? (+ <img+ src={toolkit.logo}+ alt=""+ className="h-[65%] w-[65%] object-contain"+ onError={() => setImgFailed(true)}+ />+ ) : (+ fallback+ )}</div>);}