Skip to content

Self-improving AI Employees for everyone

refactor(icons): single <NodeIcon> primitive + brand-tint utilities

trohitgd0d95882efd0
diff --git a/client/src/ParameterPanel.tsx b/client/src/ParameterPanel.tsx
index 1c3a3ca9..7ee79580 100644
--- a/client/src/ParameterPanel.tsx
+++ b/client/src/ParameterPanel.tsx
@@ -7,7 +7,7 @@ import { useWebSocket } from './contexts/WebSocketContext';
import { ExecutionService, ExecutionResult } from './services/executionService';
import { useAppTheme } from './hooks/useAppTheme';
import { ActionButton } from './components/ui/action-button';
-import { resolveIcon, resolveLibraryIcon, isImageIcon } from './assets/icons';
+import { NodeIcon } from './assets/icons';
const ParameterPanel: React.FC = () => {
const theme = useAppTheme();
@@ -133,26 +133,15 @@ const ParameterPanel: React.FC = () => {
- // Wave 10.B: schema-driven icon dispatch. Library-backed React
- // components (`lobehub:<brand>`) resolve first, then the string
- // resolver handles `asset:<key>`, URLs, data URIs, and plain
- // emoji/text.
- const renderIcon = (icon: string | undefined) => {
- const LibIcon = resolveLibraryIcon(icon);
- if (LibIcon) return <LibIcon size={20} />;
- const resolved = resolveIcon(icon);
- if (!resolved) return null;
- if (isImageIcon(resolved)) {
- return <img src={resolved} alt="icon" style={{ width: 20, height: 20, objectFit: 'contain' }} />;
- }
- return <span>{resolved}</span>;
- };
-
// Header actions with node name and buttons in middle area
const headerActions = (
<div className="flex items-center gap-4">
<div className="flex items-center gap-2 text-[15px] font-semibold text-foreground">
- {renderIcon(nodeDefinition.icon)}
+ <NodeIcon
+ icon={nodeDefinition.icon}
+ color={nodeDefinition.defaults?.color}
+ className="h-5 w-5 text-xl"
+ />
<span>{nodeDefinition.displayName}</span>
{hasUnsavedChanges && <span style={{ color: theme.accent.orange }}>*</span>}
</div>
diff --git a/client/src/assets/icons/NodeIcon.tsx b/client/src/assets/icons/NodeIcon.tsx
new file mode 100644
index 00000000..89060f64
--- /dev/null
+++ b/client/src/assets/icons/NodeIcon.tsx
@@ -0,0 +1,76 @@
+/**
+ * NodeIcon — single icon-rendering primitive.
+ *
+ * Resolves any backend-declared icon string (`lucide:Battery`,
+ * `lobehub:Claude`, `asset:gmail`, emoji, URL, data URI) and renders
+ * it inside a wrapper sized by Tailwind classes. The lucide / image
+ * branches stretch to fill the wrapper; the emoji/text branch
+ * inherits the wrapper's font size.
+ *
+ * The wrapper carries `currentColor` from the optional `color` prop
+ * so lucide icons (which use `currentColor` for stroke) pick up the
+ * brand color. Image and lobehub `.Color` icons use explicit fills
+ * and ignore `color` — safe to pass at every call site.
+ *
+ * Replaces the per-file `renderIcon` / `getServiceIcon` /
+ * `renderSkillIcon` helpers and the catalogue-adapter icon factory
+ * so the resolver branches live in one place and call sites use
+ * Tailwind sizing tokens (`h-6 w-6 text-2xl`) instead of pixel
+ * literals.
+ */
+
+import * as React from 'react';
+
+import { cn } from '@/lib/utils';
+import { resolveIcon, resolveLibraryIcon, isImageIcon } from '.';
+
+export interface NodeIconProps {
+ /** Backend-declared icon string. May be undefined while the spec
+ * cache hydrates — the component renders the fallback in that case. */
+ icon: string | undefined | null;
+ /** Wrapper class. Use Tailwind sizing tokens for the box (`h-6 w-6`)
+ * and a `text-X` class to size the emoji/text branch. */
+ className?: string;
+ /** Brand color forwarded as currentColor (e.g. node `defaults.color`,
+ * provider `color`, skill `color`). Lucide picks it up for stroke;
+ * image / lobehub `.Color` icons ignore it. */
+ color?: string;
+ /** Element rendered when the icon ref does not resolve. */
+ fallback?: React.ReactNode;
+}
+
+export const NodeIcon: React.FC<NodeIconProps> = ({
+ icon,
+ className,
+ color,
+ fallback = null,
+}) => {
+ let inner: React.ReactNode;
+ const LibIcon = resolveLibraryIcon(icon);
+ if (LibIcon) {
+ // Lucide accepts className; `h-full w-full` makes the SVG fill the
+ // wrapper, so size flows from the wrapper's Tailwind sizing class.
+ inner = <LibIcon className="h-full w-full" />;
+ } else {
+ const resolved = resolveIcon(icon);
+ if (!resolved) {
+ inner = fallback;
+ } else if (isImageIcon(resolved)) {
+ inner = <img src={resolved} alt="" className="h-full w-full object-contain" />;
+ } else {
+ // Emoji / short text — inherits font-size from the wrapper's
+ // `text-X` class.
+ inner = <span className="leading-none">{resolved}</span>;
+ }
+ }
+ return (
+ <span
+ className={cn('inline-flex items-center justify-center', className)}
+ style={color ? { color } : undefined}
+ >
+ {inner}
+ </span>
+ );
+};
+
+export default NodeIcon;
diff --git a/client/src/assets/icons/index.ts b/client/src/assets/icons/index.ts
index 809b081d..c5c15a3f 100644
--- a/client/src/assets/icons/index.ts
+++ b/client/src/assets/icons/index.ts
@@ -146,3 +146,6 @@ export const resolveLibraryIcon = (icon: string | undefined | null): LibraryIcon
return resolver ? resolver(icon.slice(sep + 1)) : null;
};
+// Single icon-rendering primitive — see NodeIcon.tsx. Re-exported here
+// so consumers import everything from `assets/icons`.
+export { NodeIcon, type NodeIconProps } from './NodeIcon';
diff --git a/client/src/components/AIAgentNode.tsx b/client/src/components/AIAgentNode.tsx
index f6ea7cb0..2f273de4 100644
--- a/client/src/components/AIAgentNode.tsx
+++ b/client/src/components/AIAgentNode.tsx
@@ -8,7 +8,7 @@ import { useAppTheme } from '../hooks/useAppTheme';
import { useNodeStatus } from '../contexts/WebSocketContext';
import { dracula } from '../styles/theme';
import { useNodeSpec } from '../lib/nodeSpec';
-import { resolveIcon, resolveLibraryIcon } from '../assets/icons';
+import { NodeIcon } from '../assets/icons';
// LangGraph phase icons and labels. Colors reference the dracula token
// constants so a future palette change in tokens.css propagates without
@@ -35,21 +35,6 @@ interface SpecHandle {
role?: string;
}
-// Wave 10.B: schema-driven icon dispatch via the shared resolver.
-// No frontend fallback — if resolution returns null the node's plugin
-// metadata is missing an icon, which surfaces as a visible gap rather
-// than a masking emoji.
-const renderIcon = (icon?: string): React.ReactNode => {
- const LibIcon = resolveLibraryIcon(icon);
- if (LibIcon) return <LibIcon size={28} />;
- const resolved = resolveIcon(icon);
- if (!resolved) return null;
- if (resolved.startsWith('http') || resolved.startsWith('data:') || resolved.startsWith('/')) {
- return <img src={resolved} alt="icon" style={{ width: 28, height: 28, objectFit: 'contain' }} />;
- }
- return <span style={{ fontSize: '28px' }}>{resolved}</span>;
-};
-
const REACT_POSITION: Record<SpecHandle['position'], Position> = {
top: Position.Top,
bottom: Position.Bottom,
@@ -200,9 +185,10 @@ const AIAgentNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnecta
title="Edit Parameters"
>⚙️</button>
- {/* Icon */}
- <div style={{ lineHeight: '1', marginBottom: theme.spacing.xs, color: accentColor }}>
- {renderIcon(spec?.icon)}
+ {/* Icon — `color` on the wrapper feeds currentColor to lucide;
+ NodeIcon stretches to fill via `h-7 w-7 text-3xl`. */}
+ <div style={{ marginBottom: theme.spacing.xs, color: accentColor }}>
+ <NodeIcon icon={spec?.icon} className="h-7 w-7 text-3xl" />
</div>
{/* Title */}
diff --git a/client/src/components/GenericNode.tsx b/client/src/components/GenericNode.tsx
index 787d133e..ce08e20d 100644
--- a/client/src/components/GenericNode.tsx
+++ b/client/src/components/GenericNode.tsx
@@ -2,7 +2,7 @@ import React, { memo, useCallback } from 'react';
import { nodePropsEqual } from './nodeMemoEquality';
import { Handle, Position, NodeProps } from 'reactflow';
import { resolveNodeDescription } from '../lib/nodeSpec';
-import { resolveIcon, resolveLibraryIcon } from '../assets/icons';
+import { NodeIcon } from '../assets/icons';
import { useNodeSpec } from '../lib/nodeSpec';
import { NodeData } from '../types/NodeTypes';
import { INodeInputDefinition, INodeOutputDefinition, NodeConnectionType } from '../types/INodeProperties';
@@ -97,24 +97,6 @@ const GenericNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnecta
const nodeInputs = getNodeInputs();
const nodeOutputs = getNodeOutputs();
- // Wave 10.B: schema-driven icon dispatch. No fallback.
- const renderIcon = (rawIcon: string | undefined) => {
- const LibIcon = resolveLibraryIcon(rawIcon);
- if (LibIcon) return <LibIcon size={24} />;
- const icon = resolveIcon(rawIcon);
- if (!icon) return null;
- if (icon.startsWith('http') || icon.startsWith('data:') || icon.startsWith('/')) {
- return (
- <img
- src={icon}
- alt="icon"
- style={{ width: '24px', height: '24px', objectFit: 'contain', borderRadius: '4px' }}
- />
- );
- }
- return icon;
- };
-
// Helper functions for color management
const getNodeColor = () => definition.defaults.color || '#9E9E9E';
const getBorderColor = () => {
@@ -232,9 +214,11 @@ const GenericNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnecta
zIndex: 10,
paddingRight: '4px'
}}>
- <span className="flex items-center text-2xl">
- {renderIcon(iconSpec?.icon ?? definition.icon)}
- </span>
+ <NodeIcon
+ icon={iconSpec?.icon ?? definition.icon}
+ color={getNodeColor()}
+ className="h-6 w-6 text-2xl"
+ />
<EditableNodeLabel
nodeId={id}
label={data?.label}
diff --git a/client/src/components/SquareNode.tsx b/client/src/components/SquareNode.tsx
index c2e1b801..989a46b7 100644
--- a/client/src/components/SquareNode.tsx
+++ b/client/src/components/SquareNode.tsx
@@ -7,7 +7,7 @@ import { useAppTheme } from '../hooks/useAppTheme';
import EditableNodeLabel from './ui/EditableNodeLabel';
import { useWebSocket, useWhatsAppStatus, useNodeStatus } from '../contexts/WebSocketContext';
import { getCachedNodeSpec, isNodeInBackendGroup, resolveNodeDescription, useNodeSpec } from '../lib/nodeSpec';
-import { resolveIcon, resolveLibraryIcon } from '../assets/icons';
+import { NodeIcon } from '../assets/icons';
import { AI_MODEL_PROVIDER_MAP } from '../lib/aiModelProviders';
// Nodes with 'tool' in their group can connect to AI Agent/Zeenie tool handles
@@ -237,27 +237,12 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectab
};
- // Wave 10.B: schema-driven icon dispatch. `useNodeSpec` subscribes
- // to the NodeSpec cache so the icon populates when prefetch lands
- // without waiting for a parent re-render.
+ // Schema-driven icon dispatch. `useNodeSpec` subscribes to the
+ // NodeSpec cache so the icon populates when prefetch lands without
+ // waiting for a parent re-render. <NodeIcon> resolves the ref and
+ // tints lucide icons with the node's brand color via currentColor.
const iconSpec = useNodeSpec(type);
- const getServiceIcon = () => {
- const raw = (iconSpec?.icon as string | undefined) ?? (definition?.icon as string | undefined) ?? '';
- const LibIcon = resolveLibraryIcon(raw);
- if (LibIcon) return <LibIcon size={28} />;
- const icon = resolveIcon(raw);
- if (!icon) return null;
- if (icon.startsWith('http') || icon.startsWith('data:') || icon.startsWith('/')) {
- return (
- <img
- src={icon}
- alt="icon"
- style={{ width: '28px', height: '28px', objectFit: 'contain', borderRadius: '4px' }}
- />
- );
- }
- return icon;
- };
+ const iconRef = (iconSpec?.icon as string | undefined) ?? (definition?.icon as string | undefined);
// Get the node color from definition or use default
const nodeColor = definition?.defaults?.color || '#1A73E8';
@@ -331,7 +316,7 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectab
{/* Service Icon */}
- {getServiceIcon()}
+ <NodeIcon icon={iconRef} color={nodeColor} className="h-7 w-7 text-3xl" />
{/* Parameters Button */}
<button
diff --git a/client/src/components/ToolkitNode.tsx b/client/src/components/ToolkitNode.tsx
index 932a9d52..64317a52 100644
--- a/client/src/components/ToolkitNode.tsx
+++ b/client/src/components/ToolkitNode.tsx
@@ -16,7 +16,7 @@ import { Handle, Position, NodeProps } from 'reactflow';
import { NodeData } from '../types/NodeTypes';
import { useAppStore } from '../store/useAppStore';
import { resolveNodeDescription } from '../lib/nodeSpec';
-import { resolveIcon, resolveLibraryIcon } from '../assets/icons';
+import { NodeIcon } from '../assets/icons';
import { useNodeSpec } from '../lib/nodeSpec';
import { useAppTheme } from '../hooks/useAppTheme';
import { useWebSocket } from '../contexts/WebSocketContext';
@@ -62,25 +62,10 @@ const ToolkitNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnecta
// Get the node color from definition or use Android green
const nodeColor = definition?.defaults?.color || '#3DDC84';
- // Wave 10.B: schema-driven icon dispatch with reactive subscription.
+ // Schema-driven icon dispatch with reactive subscription.
+ // <NodeIcon> resolves the ref and tints lucide icons via currentColor.
const iconSpec = useNodeSpec(type);
- const getIcon = () => {
- const raw = (iconSpec?.icon as string | undefined) ?? (definition?.icon as string | undefined);
- const LibIcon = resolveLibraryIcon(raw);
- if (LibIcon) return <LibIcon size={28} />;
- const icon = resolveIcon(raw);
- if (!icon) return null;
- if (icon.startsWith('http') || icon.startsWith('data:') || icon.startsWith('/')) {
- return (
- <img
- src={icon}
- alt="icon"
- style={{ width: '28px', height: '28px', objectFit: 'contain', borderRadius: '4px' }}
- />
- );
- }
- return icon;
- };
+ const iconRef = (iconSpec?.icon as string | undefined) ?? (definition?.icon as string | undefined);
// Get status indicator color
const getStatusIndicatorColor = () => {
@@ -137,7 +122,7 @@ const ToolkitNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnecta
}}
>
{/* Service Icon */}
- {getIcon()}
+ <NodeIcon icon={iconRef} color={nodeColor} className="h-7 w-7 text-3xl" />
{/* Parameters Button */}
<button
diff --git a/client/src/components/TriggerNode.tsx b/client/src/components/TriggerNode.tsx
index ae1fc757..798fb629 100644
--- a/client/src/components/TriggerNode.tsx
+++ b/client/src/components/TriggerNode.tsx
@@ -12,7 +12,7 @@ import { Handle, Position, NodeProps } from 'reactflow';
import { NodeData } from '../types/NodeTypes';
import { useAppStore } from '../store/useAppStore';
import { resolveNodeDescription, useNodeSpec } from '../lib/nodeSpec';
-import { resolveIcon, resolveLibraryIcon } from '../assets/icons';
+import { NodeIcon } from '../assets/icons';
import { useAppTheme } from '../hooks/useAppTheme';
import { useWhatsAppStatus, useNodeStatus } from '../contexts/WebSocketContext';
import EditableNodeLabel from './ui/EditableNodeLabel';
@@ -110,26 +110,11 @@ const TriggerNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnecta
}
};
- // Wave 10.B: schema-driven icon dispatch. `useNodeSpec` subscribes
- // to the NodeSpec cache so the icon populates when prefetch lands.
+ // Schema-driven icon dispatch. `useNodeSpec` subscribes to the
+ // NodeSpec cache so the icon populates when prefetch lands.
+ // <NodeIcon> resolves the ref and tints lucide icons via currentColor.
const iconSpec = useNodeSpec(type);
- const getTriggerIcon = () => {
- const raw = (iconSpec?.icon as string | undefined) ?? (definition?.icon as string | undefined) ?? '';
- const LibIcon = resolveLibraryIcon(raw);
- if (LibIcon) return <LibIcon size={28} />;
- const icon = resolveIcon(raw);
- if (!icon) return null;
- if (icon.startsWith('http') || icon.startsWith('data:') || icon.startsWith('/')) {
- return (
- <img
- src={icon}
- alt="icon"
- style={{ width: '28px', height: '28px', objectFit: 'contain', borderRadius: '4px' }}
- />
- );
- }
- return icon;
- };
+ const iconRef = (iconSpec?.icon as string | undefined) ?? (definition?.icon as string | undefined);
// Get the node color from definition or use default trigger color
const nodeColor = definition?.defaults?.color || '#f59e0b';
@@ -206,7 +191,7 @@ const TriggerNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnecta
)}
{/* Trigger Icon */}
- {getTriggerIcon()}
+ <NodeIcon icon={iconRef} color={nodeColor} className="h-7 w-7 text-3xl" />
{/* Parameters Button */}
<button
diff --git a/client/src/components/credentials/CredentialsPalette.tsx b/client/src/components/credentials/CredentialsPalette.tsx
index ac757b99..9013ea0e 100644
--- a/client/src/components/credentials/CredentialsPalette.tsx
+++ b/client/src/components/credentials/CredentialsPalette.tsx
@@ -38,6 +38,7 @@ import { Search, X } from 'lucide-react';
import { Input } from '@/components/ui/input';
import { cn } from '@/lib/utils';
+import { NodeIcon } from '../../assets/icons';
import type { ProviderConfig, CategoryGroup } from './types';
// ============================================================================
@@ -145,7 +146,6 @@ interface RowProps {
}
const ProviderRow = memo<RowProps>(function ProviderRow({ provider, selected, onSelect }) {
- const Icon = provider.icon;
const handleClick = useCallback(() => onSelect(provider.id), [onSelect, provider.id]);
return (
@@ -159,9 +159,11 @@ const ProviderRow = memo<RowProps>(function ProviderRow({ provider, selected, on
: 'border-transparent bg-transparent'
)}
>
- <div className="flex h-6 w-6 shrink-0 items-center justify-center text-foreground">
- <Icon size={14} />
- </div>
+ <NodeIcon
+ icon={provider.iconRef}
+ color={provider.color}
+ className="h-3.5 w-3.5 shrink-0 text-sm"
+ />
<span className="flex-1 truncate">{provider.name}</span>
{provider.stored && (
<span aria-label="Credential stored" className="h-2 w-2 rounded-full bg-success" />
diff --git a/client/src/components/credentials/catalogueAdapter.ts b/client/src/components/credentials/catalogueAdapter.ts
index d753f014..3116a014 100644
--- a/client/src/components/credentials/catalogueAdapter.ts
+++ b/client/src/components/credentials/catalogueAdapter.ts
@@ -17,10 +17,6 @@
* in Phase 8, this module becomes the canonical resolver.
*/
-import React from 'react';
-
-import { resolveIcon, resolveLibraryIcon, isImageIcon } from '../../assets/icons';
-
import type {
ProviderConfig,
CategoryGroup,
@@ -40,96 +36,6 @@ import type {
CatalogueResponse,
} from '../../hooks/useCatalogueQuery';
-// ============================================================================
-// Wave 10.B: icon resolution now routes through the shared resolvers in
-// `assets/icons/`. Backend `icon_ref` uses the same three-format contract
-// as node icons:
-// "lobehub:<brand>" → React component (provider brand icon)
-// "asset:<key>" → <img> with filesystem-registered SVG data URI
-// emoji / plain text → <span>
-// ============================================================================
-
-// IconProps mirrors lucide-react's prop shape: both size (px) and
-// className are accepted and forwarded. Call sites prefer className so
-// sizing flows from Tailwind tokens (h-6 w-6) instead of pixel literals.
-interface IconProps {
- size?: number;
- className?: string;
-}
-
-// Fallback for providers whose icon_ref cannot be resolved — renders a
-// circle with the provider initial, so the palette never shows nothing.
-// `size` is a px hint used only when the parent doesn't constrain via
-// className; the wrapper sizes itself from className when present.
-const fallbackIcon = (initial: string): React.FC<IconProps> => {
- const Comp: React.FC<IconProps> = ({ size = 16, className }) =>
- React.createElement(
- 'div',
- {
- className,
- style: className
- ? undefined
- : {
- width: size,
- height: size,
- borderRadius: '50%',
- background: 'rgba(128,128,128,0.2)',
- color: 'currentColor',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- fontSize: Math.max(10, size * 0.55),
- fontWeight: 600,
- },
- },
- initial,
- );
- return Comp;
-};
-
-export function resolveIconRef(iconRef: string | undefined, providerId: string): React.FC<IconProps> {
- const initial = (providerId[0] ?? '?').toUpperCase();
- if (!iconRef) return fallbackIcon(initial);
-
- const LibIcon = resolveLibraryIcon(iconRef);
- if (LibIcon) {
- const Comp: React.FC<IconProps> = ({ size, className }) =>
- React.createElement(LibIcon, { size, className });
- return Comp;
- }
-
- const resolved = resolveIcon(iconRef);
- if (resolved && isImageIcon(resolved)) {
- const Comp: React.FC<IconProps> = ({ size = 16, className }) =>
- React.createElement('img', {
- src: resolved,
- alt: '',
- className,
- width: className ? undefined : size,
- height: className ? undefined : size,
- style: className ? undefined : { display: 'block' },
- });
- return Comp;
- }
-
- if (resolved) {
- const Comp: React.FC<IconProps> = ({ size = 16, className }) =>
- React.createElement(
- 'span',
- {
- className,
- style: className
- ? undefined
- : { fontSize: size, lineHeight: 1, display: 'inline-block' },
- },
- resolved,
- );
- return Comp;
- }
-
- return fallbackIcon(initial);
-}
-
// ============================================================================
// Status-row / action / QR rehydrators
//
@@ -239,7 +145,7 @@ export function rehydrateProvider(entry: ServerProviderConfig): ProviderConfig {
categoryLabel: entry.category_label,
color: entry.color,
kind: entry.kind as PanelKind,
- icon: resolveIconRef(entry.icon_ref, entry.id),
+ iconRef: entry.icon_ref ?? '',
fields: buildFields(entry.fields),
ws: entry.ws,
statusHook: entry.status_hook,
diff --git a/client/src/components/credentials/panels/ApiKeyPanel.tsx b/client/src/components/credentials/panels/ApiKeyPanel.tsx
index 6549026d..8dc6b587 100644
--- a/client/src/components/credentials/panels/ApiKeyPanel.tsx
+++ b/client/src/components/credentials/panels/ApiKeyPanel.tsx
@@ -12,6 +12,7 @@ import { Alert, AlertDescription } from '@/components/ui/alert';
import ApiKeyInput from '../../ui/ApiKeyInput';
import { useCredentialPanel } from '../useCredentialPanel';
import { ProviderDefaultsSection, LlmUsageSection, ApiUsageSection } from '../sections';
+import { NodeIcon } from '../../../assets/icons';
import type { ProviderConfig } from '../types';
const ApiKeyPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ config, visible }) => {
@@ -45,13 +46,18 @@ const ApiKeyPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ c
<CardHeader className="flex flex-row items-center justify-between gap-3 space-y-0 pb-3">
<div className="flex items-center gap-3">
<div
- className="flex h-12 w-12 items-center justify-center rounded-lg"
- // config.color is per-provider brand metadata (data-driven,
- // same carve-out as canvas nodeColor); CSS color-mix keeps
- // the math in CSS rather than as JS string concat.
- style={{ backgroundColor: `color-mix(in srgb, ${config.color} 8%, transparent)` }}
+ className="rounded-lg bg-tint-soft"
+ // currentColor is the provider's brand color;
+ // `bg-tint-soft` mixes it against transparent at the
+ // canonical alpha (--tint-soft). The icon picks up the
+ // same color via NodeIcon.
+ style={{ color: config.color }}
>
- <config.icon className="h-6 w-6" />
+ <NodeIcon
+ icon={config.iconRef}
+ color={config.color}
+ className="h-12 w-12 text-2xl"
+ />
</div>
<CardTitle className="text-lg">{config.name}</CardTitle>
</div>
diff --git a/client/src/components/credentials/panels/EmailPanel.tsx b/client/src/components/credentials/panels/EmailPanel.tsx
index e81015f0..413d9417 100644
--- a/client/src/components/credentials/panels/EmailPanel.tsx
+++ b/client/src/components/credentials/panels/EmailPanel.tsx
@@ -33,6 +33,7 @@ import {
} from '@/components/ui/select';
import { useAppTheme } from '../../../hooks/useAppTheme';
import { useApiKeys } from '../../../hooks/useApiKeys';
+import { NodeIcon } from '../../../assets/icons';
import { StatusCard } from '../primitives';
import {
AUTH_NOTES,
@@ -153,12 +154,10 @@ const EmailPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co
}
};
- const iconSize = parseInt(theme.iconSize.md);
-
return (
<div className="flex min-h-0 flex-1 flex-col gap-4 p-5">
<StatusCard
- icon={<config.icon size={iconSize} />}
+ icon={<NodeIcon icon={config.iconRef} color={config.color} className="h-6 w-6 text-2xl" />}
title={config.name}
status={{ stored, address }}
rows={[
diff --git a/client/src/components/credentials/panels/OAuthPanel.tsx b/client/src/components/credentials/panels/OAuthPanel.tsx
index 26c25fba..7bc5dab0 100644
--- a/client/src/components/credentials/panels/OAuthPanel.tsx
+++ b/client/src/components/credentials/panels/OAuthPanel.tsx
@@ -8,6 +8,7 @@ import { useCredentialPanel } from '../useCredentialPanel';
import { useProviderStatus } from '../hooks';
import { OAuthConnect } from '../primitives';
import { ApiUsageSection } from '../sections';
+import { NodeIcon } from '../../../assets/icons';
import type { ProviderConfig } from '../types';
const OAuthPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ config, visible }) => {
@@ -20,7 +21,7 @@ const OAuthPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co
<OAuthConnect
config={config} form={panel.form} connected={connected}
stored={panel.stored} loading={panel.loading} error={panel.error}
- icon={<config.icon className="h-6 w-6" />}
+ icon={<NodeIcon icon={config.iconRef} color={config.color} className="h-6 w-6 text-2xl" />}
onSaveCredentials={() => {
const missing = config.fields?.find(f => f.required && !panel.form.getFieldValue(f.key)?.trim());
if (missing) { panel.setError(`${missing.label} is required`); return; }
diff --git a/client/src/components/credentials/panels/QrPairingPanel.tsx b/client/src/components/credentials/panels/QrPairingPanel.tsx
index 89150e10..73f32f3d 100644
--- a/client/src/components/credentials/panels/QrPairingPanel.tsx
+++ b/client/src/components/credentials/panels/QrPairingPanel.tsx
@@ -15,6 +15,7 @@ import { useCredentialPanel } from '../useCredentialPanel';
import { useProviderStatus } from '../hooks';
import { StatusCard, ActionBar } from '../primitives';
import { RateLimitSection } from '../sections';
+import { NodeIcon } from '../../../assets/icons';
import type { ActionDef } from '../primitives/ActionBar';
import type { ProviderConfig } from '../types';
@@ -62,7 +63,14 @@ const QrPairingPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = (
onDelete={() => panel.actions.remove(field.key)}
placeholder={field.placeholder} loading={panel.loading === 'save'} isStored={panel.stored}
/>}
- {config.statusRows && <StatusCard icon={<config.icon size={parseInt(theme.iconSize.md)} />} title={config.name} rows={config.statusRows} status={status} />}
+ {config.statusRows && (
+ <StatusCard
+ icon={<NodeIcon icon={config.iconRef} color={config.color} className="h-6 w-6 text-2xl" />}
+ title={config.name}
+ rows={config.statusRows}
+ status={status}
+ />
+ )}
<div className="flex min-h-[300px] flex-1 flex-col items-center justify-center rounded-lg bg-muted p-5">
<QRCodeDisplay value={qrData} isConnected={connected} size={280}
connectedTitle={qr.connectedTitle} connectedSubtitle={qr.connectedSubtitle(status)}
diff --git a/client/src/components/credentials/providers.tsx b/client/src/components/credentials/providers.tsx
index e8772bb7..2da9b587 100644
--- a/client/src/components/credentials/providers.tsx
+++ b/client/src/components/credentials/providers.tsx
@@ -1,36 +1,18 @@
/**
* Provider configs — every credential provider as a plain config object.
*
- * Icons: reuse existing asset modules and node-definition exports.
- * Google Maps + Android use emoji (matching the convention of locationNodes
- * and androidServiceNodes, which already use '🗺️' and '🔋' etc.).
- * Colors: theme token keys (resolved at render by the consumer).
- * Status rows: pure data (ok/trueText/falseText), theme colors resolved in StatusCard.
+ * Icons are declared as `iconRef` strings using the prefix-dispatch
+ * contract resolved by `<NodeIcon>`:
+ * - `lobehub:<brand>` → React component from @lobehub/icons
+ * - `asset:<key>` → SVG via the filesystem registry
+ * - emoji / text → rendered as-is
+ * Colors are theme token keys, resolved at render by the consumer.
+ * Status rows are pure data — theme colors are resolved in StatusCard.
*/
import { AI_PROVIDER_META } from '../icons/AIProviderIcons';
-import { resolveIconRef } from './catalogueAdapter';
import type { ProviderConfig, CategoryGroup } from './types';
-// ============================================================================
-// Wave 10.B: icon resolution unified with the backend-driven catalogue —
-// every provider icon goes through `resolveIconRef`, which dispatches
-// `lobehub:<brand>` → React component, `asset:<key>` → SVG via the
-// filesystem registry, and emoji/text as a styled <span>.
-// ============================================================================
-
-const BraveIcon = resolveIconRef('asset:brave', 'brave');
-const SerperIcon = resolveIconRef('asset:google', 'serper');
-const PerplexityIcon = resolveIconRef('asset:perplexity', 'perplexity');
-const TelegramBotIcon = resolveIconRef('asset:telegram', 'telegram');
-const GWorkspaceIcon = resolveIconRef('asset:gmail', 'google');
-const EmailCredIcon = resolveIconRef('asset:read', 'email');
-const ApifyIconC = resolveIconRef('asset:apify', 'apify');
-const WhatsAppIcon = resolveIconRef('asset:whatsapp', 'whatsapp');
-const XIcon = resolveIconRef('asset:x', 'twitter');
-const GoogleMapsIcon = resolveIconRef('🗺️', 'maps');
-const AndroidIcon = resolveIconRef('📱', 'android');
-
// ============================================================================
// AI PROVIDERS — derived from centralized AI_PROVIDER_META
// ============================================================================
@@ -43,7 +25,7 @@ const AI_PLACEHOLDERS: Record<string, string> = {
const aiProviders: ProviderConfig[] = Object.entries(AI_PROVIDER_META).map(([id, meta]) => ({
id, name: meta.label, category: 'ai', categoryLabel: 'AI Providers',
- color: meta.color, kind: 'apiKey' as const, icon: meta.Icon, hasDefaults: true,
+ color: meta.color, kind: 'apiKey' as const, iconRef: meta.iconRef, hasDefaults: true,
fields: [{ key: 'apiKey', label: 'API Key', secret: true, placeholder: AI_PLACEHOLDERS[id], required: true }],
}));
@@ -58,7 +40,7 @@ export const PROVIDERS: ProviderConfig[] = [
{
id: 'whatsapp_personal', name: 'WhatsApp Personal',
category: 'social', categoryLabel: 'Social Media',
- color: 'categoryWhatsapp', kind: 'qrPairing', icon: WhatsAppIcon,
+ color: 'categoryWhatsapp', kind: 'qrPairing', iconRef: 'asset:whatsapp',
statusHook: 'whatsapp', hasRateLimits: true,
statusRows: [
{ label: 'Status', ok: s => !!s?.connected, trueText: 'Connected', falseText: 'Disconnected' },
@@ -85,7 +67,7 @@ export const PROVIDERS: ProviderConfig[] = [
{
id: 'twitter', name: 'Twitter/X',
category: 'social', categoryLabel: 'Social Media',
- color: 'categoryTrigger', kind: 'oauth', icon: XIcon,
+ color: 'categoryTrigger', kind: 'oauth', iconRef: 'asset:x',
statusHook: 'twitter', usageService: 'twitter',
ws: { login: 'twitter_oauth_login', logout: 'twitter_logout', status: 'twitter_oauth_status' },
fields: [
@@ -100,7 +82,7 @@ export const PROVIDERS: ProviderConfig[] = [
{
id: 'telegram', name: 'Telegram Bot',
category: 'social', categoryLabel: 'Social Media',
- color: 'categoryChat', kind: 'oauth', icon: TelegramBotIcon, statusHook: 'telegram',
+ color: 'categoryChat', kind: 'oauth', iconRef: 'asset:telegram', statusHook: 'telegram',
ws: { login: 'telegram_connect', logout: 'telegram_disconnect', status: 'telegram_status' },
fields: [{ key: 'telegram_bot_token', label: 'Bot Token', secret: true, placeholder: '123456789:ABCdefGHIjklMNOpqrSTUvwxYZ', required: true }],
instructions: 'Get a bot token from @BotFather on Telegram. After connecting, send any message to your bot to register as the owner.',
@@ -110,7 +92,7 @@ export const PROVIDERS: ProviderConfig[] = [
{
id: 'gmail', name: 'Google Workspace',
category: 'productivity', categoryLabel: 'Productivity',
- color: 'categoryAI', kind: 'oauth', icon: GWorkspaceIcon,
+ color: 'categoryAI', kind: 'oauth', iconRef: 'asset:gmail',
statusHook: 'google', usageService: 'google_workspace',
ws: { login: 'google_oauth_login', logout: 'google_logout', status: 'google_oauth_status' },
fields: [
@@ -125,14 +107,14 @@ export const PROVIDERS: ProviderConfig[] = [
{
id: 'email_himalaya', name: 'Email (IMAP/SMTP)',
category: 'email', categoryLabel: 'Email',
- color: 'categoryChat', kind: 'email', icon: EmailCredIcon,
+ color: 'categoryChat', kind: 'email', iconRef: 'asset:read',
},
// ── Android Device (QR pairing) ──────────────────────────────────────
{
id: 'android_remote', name: 'Android Device',
category: 'android', categoryLabel: 'Android',
- color: 'categoryAndroid', kind: 'qrPairing', icon: AndroidIcon,
+ color: 'categoryAndroid', kind: 'qrPairing', iconRef: '📱',
statusHook: 'android',
fields: [{ key: 'android_remote', label: 'API Key', secret: true, placeholder: 'Enter Android Relay API key...', required: true }],
statusRows: [
@@ -159,23 +141,23 @@ export const PROVIDERS: ProviderConfig[] = [
// ── Search ───────────────────────────────────────────────────────────
{ id: 'brave_search', name: 'Brave Search', category: 'search', categoryLabel: 'Search',
- color: 'categoryLocation', kind: 'apiKey', icon: BraveIcon,
+ color: 'categoryLocation', kind: 'apiKey', iconRef: 'asset:brave',
fields: [{ key: 'apiKey', label: 'API Key', secret: true, placeholder: 'BSA...', required: true }] },
{ id: 'perplexity', name: 'Perplexity', category: 'search', categoryLabel: 'Search',
- color: 'categoryUtil', kind: 'apiKey', icon: PerplexityIcon,
+ color: 'categoryUtil', kind: 'apiKey', iconRef: 'asset:perplexity',
fields: [{ key: 'apiKey', label: 'API Key', secret: true, placeholder: 'pplx-...', required: true }] },
// ── Scrapers ─────────────────────────────────────────────────────────
{ id: 'apify', name: 'Apify', category: 'scrapers', categoryLabel: 'Scrapers',
- color: 'categoryAI', kind: 'apiKey', icon: ApifyIconC, validateAs: 'apify',
+ color: 'categoryAI', kind: 'apiKey', iconRef: 'asset:apify', validateAs: 'apify',
fields: [{ key: 'apiKey', label: 'API Key', secret: true, placeholder: 'apify_api_...', required: true }] },
{ id: 'serper', name: 'Serper', category: 'scrapers', categoryLabel: 'Scrapers',
- color: 'categoryAI', kind: 'apiKey', icon: SerperIcon,
+ color: 'categoryAI', kind: 'apiKey', iconRef: 'asset:google',
fields: [{ key: 'apiKey', label: 'API Key', secret: true, required: true }] },
// ── Services ─────────────────────────────────────────────────────────
{ id: 'google_maps', name: 'Google Maps', category: 'services', categoryLabel: 'Services',
- color: 'categoryLocation', kind: 'apiKey', icon: GoogleMapsIcon,
+ color: 'categoryLocation', kind: 'apiKey', iconRef: '🗺️',
validateAs: 'google_maps', usageService: 'google_maps',
fields: [{ key: 'apiKey', label: 'API Key', secret: true, placeholder: 'AIza...', required: true }] },
];
diff --git a/client/src/components/credentials/types.ts b/client/src/components/credentials/types.ts
index ee9a4b66..7fe6e01a 100644
--- a/client/src/components/credentials/types.ts
+++ b/client/src/components/credentials/types.ts
@@ -4,8 +4,6 @@
* ALL conditional logic lives in config — panel components are pure renderers.
*/
-import type { FC } from 'react';
-
// ============================================================================
// Panel kinds — one renderer branch per kind
// ============================================================================
@@ -83,11 +81,12 @@ export interface ProviderConfig {
/** Theme color key (resolved via theme.colors[color] at render). */
color: string;
kind: PanelKind;
- /** Provider icon. lucide-react icons + the in-house brand icons both
- * accept `size` and `className`; call sites prefer `className` so
- * sizing flows from Tailwind tokens (`h-6 w-6`) instead of hardcoded
- * pixel values. */
- icon: FC<{ size?: number; className?: string }>;
+ /** Provider icon ref string (e.g. `lobehub:Claude`, `lucide:Mail`,
+ * `asset:gmail`, emoji). Resolved at render time by `<NodeIcon>` so
+ * the same dispatch path (lib component / image / text) is used for
+ * every icon in the app. Sizing flows from the wrapper's Tailwind
+ * classes (`h-6 w-6`) — no pixel literals at call sites. */
+ iconRef: string;
/** Credential input fields. */
fields?: FieldDef[];
diff --git a/client/src/components/icons/AIProviderIcons.tsx b/client/src/components/icons/AIProviderIcons.tsx
index 8d475f4d..3f448686 100644
--- a/client/src/components/icons/AIProviderIcons.tsx
+++ b/client/src/components/icons/AIProviderIcons.tsx
@@ -60,18 +60,21 @@ export const AI_PROVIDER_ICONS: Record<string, React.FC<{ size?: number }>> = {
mistral: MistralIcon,
};
-// Centralized provider metadata (icon, theme color, display label)
-// Colors use dracula/solarized palette for consistency with the rest of the UI
-export const AI_PROVIDER_META: Record<string, { Icon: React.FC<{ size?: number }>; color: string; label: string }> = {
- openai: { Icon: OpenAIIcon, color: dracula.green, label: 'OpenAI' },
- anthropic: { Icon: ClaudeIcon, color: dracula.orange, label: 'Anthropic' },
- gemini: { Icon: GeminiIcon, color: solarized.blue, label: 'Gemini' },
- groq: { Icon: GroqIcon, color: dracula.red, label: 'Groq' },
- cerebras: { Icon: CerebrasIcon, color: dracula.orange, label: 'Cerebras' },
- openrouter: { Icon: OpenRouterIcon, color: solarized.violet, label: 'OpenRouter' },
- deepseek: { Icon: DeepSeekIcon, color: dracula.cyan, label: 'DeepSeek' },
- kimi: { Icon: KimiIcon, color: dracula.purple, label: 'Kimi' },
- mistral: { Icon: MistralIcon, color: dracula.pink, label: 'Mistral' },
+// Centralized provider metadata (icon ref, theme color, display label).
+// `iconRef` uses the prefix-dispatch contract resolved by `<NodeIcon>` —
+// `lobehub:<brand>` picks the package's `.Color` (or `.Avatar`)
+// component. `Icon` stays as a pre-built FC for the remaining direct
+// consumers (e.g. ApiKeyStep onboarding cards).
+export const AI_PROVIDER_META: Record<string, { iconRef: string; Icon: React.FC<{ size?: number }>; color: string; label: string }> = {
+ openai: { iconRef: 'lobehub:OpenAI', Icon: OpenAIIcon, color: dracula.green, label: 'OpenAI' },
+ anthropic: { iconRef: 'lobehub:Claude', Icon: ClaudeIcon, color: dracula.orange, label: 'Anthropic' },
+ gemini: { iconRef: 'lobehub:Gemini', Icon: GeminiIcon, color: solarized.blue, label: 'Gemini' },
+ groq: { iconRef: 'lobehub:Groq', Icon: GroqIcon, color: dracula.red, label: 'Groq' },
+ cerebras: { iconRef: 'lobehub:Cerebras', Icon: CerebrasIcon, color: dracula.orange, label: 'Cerebras' },
+ openrouter: { iconRef: 'lobehub:OpenRouter', Icon: OpenRouterIcon, color: solarized.violet, label: 'OpenRouter' },
+ deepseek: { iconRef: 'lobehub:DeepSeek', Icon: DeepSeekIcon, color: dracula.cyan, label: 'DeepSeek' },
+ kimi: { iconRef: 'lobehub:Kimi', Icon: KimiIcon, color: dracula.purple, label: 'Kimi' },
+ mistral: { iconRef: 'lobehub:Mistral', Icon: MistralIcon, color: dracula.pink, label: 'Mistral' },
};
// Get icon component by provider ID
diff --git a/client/src/components/parameterPanel/InputSection.tsx b/client/src/components/parameterPanel/InputSection.tsx
index dfe1a70f..cc18933d 100644
--- a/client/src/components/parameterPanel/InputSection.tsx
+++ b/client/src/components/parameterPanel/InputSection.tsx
@@ -17,7 +17,7 @@ import { Badge } from '@/components/ui/badge';
import { cn } from '@/lib/utils';
import { queryClient } from '../../lib/queryClient';
import { getCachedNodeSpec } from '../../lib/nodeSpec';
-import { resolveIcon, resolveLibraryIcon, isImageIcon } from '../../assets/icons';
+import { NodeIcon } from '../../assets/icons';
import { resolveNodeDescription } from '../../lib/nodeSpec';
// ---------------------------------------------------------------------------
@@ -93,29 +93,14 @@ interface NodeData {
name: string;
type: string;
icon: string;
+ /** Source node's brand color (`defaults.color`) — passed to NodeIcon
+ * so lucide icons inherit it via currentColor. */
+ color?: string;
inputData?: any;
outputSchema: Record<string, any>;
hasExecutionData: boolean;
}
-// Wave 10.B: shared icon dispatch — library components (`lobehub:*`),
-// filesystem SVGs (`asset:*`), data/http URIs, then emoji/text.
-const renderNodeIcon = (icon: string, size: number = 16) => {
- const LibIcon = resolveLibraryIcon(icon);
- if (LibIcon) return <LibIcon size={size} />;
- const resolved = resolveIcon(icon);
- if (resolved && isImageIcon(resolved)) {
- return (
- <img
- src={resolved}
- alt="icon"
- style={{ width: size, height: size, objectFit: 'contain' }}
- />
- );
- }
- return <span className="text-sm">{resolved ?? ''}</span>;
-};
-
// ---------------------------------------------------------------------------
// Reusable draggable-variable card.
//
@@ -336,6 +321,7 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
name: displayName,
type: nodeType,
icon: nodeDef?.icon || '',
+ color: nodeDef?.defaults?.color,
inputData,
outputSchema,
hasExecutionData,
@@ -556,7 +542,7 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
className="flex cursor-pointer items-center justify-between bg-muted px-3 py-2 transition-colors hover:bg-card"
>
<div className="flex items-center gap-2">
- {renderNodeIcon(node.icon, 18)}
+ <NodeIcon icon={node.icon} color={node.color} className="h-5 w-5 text-lg" />
<span className="text-sm font-semibold text-foreground">{node.name}</span>
</div>
<div className="flex items-center gap-2">
diff --git a/client/src/components/parameterPanel/MasterSkillEditor.tsx b/client/src/components/parameterPanel/MasterSkillEditor.tsx
index 07878802..8ed454f1 100644
--- a/client/src/components/parameterPanel/MasterSkillEditor.tsx
+++ b/client/src/components/parameterPanel/MasterSkillEditor.tsx
@@ -48,7 +48,8 @@ import { toast } from 'sonner';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { useAppTheme } from '../../hooks/useAppTheme';
import { useWebSocket } from '../../contexts/WebSocketContext';
-import { resolveIcon, resolveLibraryIcon, isImageIcon } from '../../assets/icons';
+import { NodeIcon } from '../../assets/icons';
+import { cn } from '@/lib/utils';
import { useFolderSkills } from '../../hooks/useFolderSkills';
// Skill configuration stored in node parameters
@@ -103,17 +104,11 @@ interface MasterSkillEditorProps {
nodeId?: string; // For persisting skillsConfig to database
}
-// Wave 10.B: shared icon dispatch — library components (`lobehub:*`),
-// filesystem SVGs (`asset:*`), data/http URIs, then emoji/text.
-const renderSkillIcon = (icon: string, size: number = 16) => {
- const LibIcon = resolveLibraryIcon(icon);
- if (LibIcon) return <LibIcon size={size} />;
- const resolved = resolveIcon(icon);
- if (resolved && isImageIcon(resolved)) {
- return <img src={resolved} alt="icon" style={{ width: size, height: size, objectFit: 'contain' }} />;
- }
- return <span style={{ fontSize: size }}>{resolved ?? ''}</span>;
-};
+// All skill-icon rendering routes through the shared <NodeIcon>
+// primitive — see `assets/icons/NodeIcon.tsx`. Sizing comes from
+// the wrapper's Tailwind classes (`h-4 w-4 text-base`); brand color
+// flows via `color` and is picked up by lucide icons through
+// currentColor (image / lobehub `.Color` icons ignore it).
const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({
skillsConfig,
@@ -624,11 +619,15 @@ const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({
}
setSelectedSkillName(skill.skillName);
}}
- className="cursor-pointer border-l-[3px] px-3 py-2 transition-colors"
- style={{
- backgroundColor: isSelected ? `${skill.color}15` : 'transparent',
- borderLeftColor: isSelected ? skill.color : 'transparent',
- }}
+ className={cn(
+ 'cursor-pointer border-l-[3px] px-3 py-2 transition-colors',
+ isSelected ? 'bg-tint-soft' : 'border-l-transparent',
+ )}
+ // currentColor is the skill's brand color when
+ // selected; `bg-tint-soft` mixes it at the
+ // canonical alpha (--tint-soft) and the left
+ // border picks up the same color.
+ style={isSelected ? { color: skill.color, borderLeftColor: skill.color } : undefined}
>
<div className="flex w-full items-center gap-2">
<Checkbox
@@ -638,7 +637,7 @@ const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({
}}
onClick={(e) => e.stopPropagation()}
/>
- {renderSkillIcon(skill.icon || '', 16)}
+ <NodeIcon icon={skill.icon} color={skill.color} className="h-4 w-4 text-base" />
<span
className="flex-1 overflow-hidden text-sm whitespace-nowrap text-ellipsis"
style={{
@@ -703,17 +702,17 @@ const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({
alignItems: 'center',
gap: theme.spacing.md
}}>
- <div style={{
- width: 40,
- height: 40,
- borderRadius: theme.borderRadius.md,
- backgroundColor: `${pendingSkillData.color}20`,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- border: `2px dashed ${pendingSkillData.color}`
- }}>
- {pendingSkillData.icon ? renderSkillIcon(pendingSkillData.icon, 20) : <Plus className="h-5 w-5" style={{ color: pendingSkillData.color }} />}
+ <div
+ className="flex h-10 w-10 items-center justify-center rounded-md border-2 border-dashed bg-tint-soft"
+ // currentColor is the new skill's brand color;
+ // `bg-tint-soft` mixes it against transparent at the
+ // canonical alpha (--tint-soft); the dashed border
+ // and inner glyph pick up the same color.
+ style={{ color: pendingSkillData.color }}
+ >
+ {pendingSkillData.icon
+ ? <NodeIcon icon={pendingSkillData.icon} color={pendingSkillData.color} className="h-5 w-5 text-xl" />
+ : <Plus className="h-5 w-5" />}
</div>
<div style={{ flex: 1 }}>
<div style={{
@@ -842,7 +841,7 @@ const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({
alignItems: 'center',
gap: theme.spacing.md
}}>
- {renderSkillIcon(selectedSkillInfo.icon || '', 24)}
+ <NodeIcon icon={selectedSkillInfo.icon} color={selectedSkillInfo.color} className="h-6 w-6 text-2xl" />
<div style={{ flex: 1 }}>
{isEditingUserSkill ? (
<Input
diff --git a/client/src/components/parameterPanel/MiddleSection.tsx b/client/src/components/parameterPanel/MiddleSection.tsx
index 4953c77f..6a2b7cd2 100644
--- a/client/src/components/parameterPanel/MiddleSection.tsx
+++ b/client/src/components/parameterPanel/MiddleSection.tsx
@@ -39,7 +39,7 @@ import { folderSkillsQueryKey, type AvailableSkill } from '../../hooks/useFolder
import { dracula } from '../../styles/theme';
import { queryKeys, STALE_TIME } from '../../lib/queryConfig';
import { INodeTypeDescription, INodeProperties } from '../../types/INodeProperties';
-import { resolveIcon, resolveLibraryIcon, isImageIcon } from '../../assets/icons';
+import { NodeIcon } from '../../assets/icons';
import { ExecutionResult } from '../../services/executionService';
import { Edge } from 'reactflow';
import { shouldShowParameter } from '../../utils/parameterVisibility';
@@ -802,21 +802,18 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({
style={{ borderLeft: `3px solid ${skill.color}` }}
>
<div
- className="flex h-9 w-9 shrink-0 items-center justify-center rounded-md"
- // skill.color is per-skill metadata (SKILL.md frontmatter); the
- // tinted icon background uses CSS color-mix so the math lives in
- // CSS, not as JS string concat at the call site.
- style={{ backgroundColor: `color-mix(in srgb, ${skill.color} 12%, transparent)` }}
+ className="flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-tint-soft"
+ // currentColor is the skill's brand color
+ // (SKILL.md frontmatter); `bg-tint-soft`
+ // mixes it against transparent at the
+ // canonical alpha (--tint-soft).
+ style={{ color: skill.color }}
>
- {(() => {
- const LibIcon = resolveLibraryIcon(skill.icon);
- if (LibIcon) return <LibIcon size={20} />;
- const resolved = resolveIcon(skill.icon);
- if (resolved && isImageIcon(resolved)) {
- return <img src={resolved} alt={skill.name} className="h-5 w-5" />;
- }
- return <span className="text-lg">{resolved ?? ''}</span>;
- })()}
+ <NodeIcon
+ icon={skill.icon}
+ color={skill.color}
+ className="h-5 w-5 text-lg"
+ />
</div>
<div className="min-w-0 flex-1">
<div className="mb-0.5 text-sm font-semibold text-foreground">
diff --git a/client/src/components/ui/ComponentItem.tsx b/client/src/components/ui/ComponentItem.tsx
index 0deb0b02..43b0c3c7 100644
--- a/client/src/components/ui/ComponentItem.tsx
+++ b/client/src/components/ui/ComponentItem.tsx
@@ -3,7 +3,7 @@ import { GripVertical } from 'lucide-react';
import { cn } from '@/lib/utils';
import { Card } from '@/components/ui/card';
import { INodeTypeDescription } from '../../types/INodeProperties';
-import { resolveIcon, resolveLibraryIcon, isImageIcon as isImage } from '../../assets/icons';
+import { NodeIcon } from '../../assets/icons';
import { useNodeSpec } from '../../lib/nodeSpec';
interface ComponentItemProps {
@@ -14,16 +14,13 @@ interface ComponentItemProps {
const ComponentItem: React.FC<ComponentItemProps> = ({ definition: localDefinition, onDragStart }) => {
const [isDragging, setIsDragging] = useState(false);
- // Wave 10.B: subscribe to the backend NodeSpec cache so the palette
- // icon populates the moment prefetch lands. Icon + color come from
- // the spec; display fields fall back to the bundled definition.
+ // Subscribe to the backend NodeSpec cache so the palette icon
+ // populates the moment prefetch lands. Icon + color come from the
+ // spec; display fields fall back to the bundled definition.
const spec = useNodeSpec(localDefinition.name);
const definition = localDefinition;
const iconRaw = spec?.icon ?? definition.icon;
-
- const LibIcon = resolveLibraryIcon(iconRaw);
- const resolvedIcon = LibIcon ? null : resolveIcon(iconRaw);
- const iconIsImage = !!resolvedIcon && isImage(resolvedIcon);
+ const brandColor = spec?.color ?? definition.defaults?.color;
return (
<Card
@@ -41,14 +38,13 @@ const ComponentItem: React.FC<ComponentItemProps> = ({ definition: localDefiniti
isDragging && 'opacity-50',
)}
>
- <div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-muted text-lg ring-1 ring-foreground/10">
- {LibIcon ? (
- <LibIcon size={20} />
- ) : iconIsImage ? (
- <img src={resolvedIcon!} alt="" className="h-5 w-5 object-contain" />
- ) : (
- <span>{resolvedIcon || '📦'}</span>
- )}
+ <div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-muted ring-1 ring-foreground/10">
+ <NodeIcon
+ icon={iconRaw}
+ color={brandColor}
+ className="h-5 w-5 text-lg"
+ fallback={<span>📦</span>}
+ />
</div>
<div className="min-w-0 flex-1">
diff --git a/client/src/components/ui/ComponentPalette.tsx b/client/src/components/ui/ComponentPalette.tsx
index 3da8aa8b..40da327e 100644
--- a/client/src/components/ui/ComponentPalette.tsx
+++ b/client/src/components/ui/ComponentPalette.tsx
@@ -9,7 +9,7 @@ import { Badge } from '@/components/ui/badge';
import { Input } from '@/components/ui/input';
import { Skeleton } from '@/components/ui/skeleton';
import { Search } from 'lucide-react';
-import { resolveIcon, resolveLibraryIcon, isImageIcon } from '../../assets/icons';
+import { NodeIcon } from '../../assets/icons';
import { useNodeGroups, listCachedNodeSpecs, NodeGroupEntry } from '../../lib/nodeSpec';
import { nodeSpecToDescription } from '../../adapters/nodeSpecToDescription';
@@ -154,28 +154,25 @@ const ComponentPalette: React.FC<ComponentPaletteProps> = ({
<div className="flex w-full items-center justify-between">
<div className="flex items-center gap-2.5">
<span
- className="flex h-7 w-7 items-center justify-center rounded-md text-base"
- style={{ backgroundColor: `${config.color}20` }}
+ className="flex h-7 w-7 items-center justify-center rounded-md bg-tint-soft"
+ // currentColor is the category's brand color;
+ // `bg-tint-soft` mixes it against transparent
+ // at the canonical alpha (--tint-soft). The
+ // icon picks up the same color via NodeIcon.
+ style={{ color: config.color }}
>
- {(() => {
- const LibIcon = resolveLibraryIcon(config.icon);
- if (LibIcon) return <LibIcon size={16} />;
- const resolved = resolveIcon(config.icon);
- if (resolved && isImageIcon(resolved)) {
- return <img src={resolved} alt="" className="h-4 w-4 object-contain" />;
- }
- return resolved || '📦';
- })()}
+ <NodeIcon
+ icon={config.icon}
+ color={config.color}
+ className="h-4 w-4 text-base"
+ fallback={<span>📦</span>}
+ />
</span>
<span className="text-sm font-semibold text-foreground">
{config.label}
</span>
</div>
- <Badge
- variant="secondary"
- className="text-xs font-medium"
- style={{ backgroundColor: `${config.color}15`, color: 'hsl(var(--muted-foreground))' }}
- >
+ <Badge variant="secondary" className="text-xs font-medium">
{components?.length || 0}
</Badge>
</div>
diff --git a/client/src/index.css b/client/src/index.css
index 00156672..4b94d7b7 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -97,6 +97,15 @@
--node-workflow: 27 100% 71%;
--node-workflow-soft: 27 100% 71% / 0.08;
--node-workflow-border: 27 100% 71% / 0.3;
+
+ /* Brand-color tint alphas — same scale as the node-X-soft / -border
+ * variants above, but exposed as standalone variables so utilities
+ * can mix them against `currentColor` (data-driven brand colors
+ * like provider.color / definition.defaults.color, which can't use
+ * the role tokens). Themes redefine these in their own scope to
+ * change the canonical alphas without touching call sites. */
+ --tint-soft: 8%;
+ --tint-border: 30%;
}
.dark {
@@ -289,6 +298,23 @@
stroke-width: 2;
}
+/* ============================================================================
+ * Brand-color tint utilities — for sites where the color is data-driven
+ * (provider.color, definition.defaults.color, skill.color) and can't
+ * use a node-X token. Apply alongside `style={{ color: brandColor }}`
+ * (or any class that sets the foreground color); these utilities mix
+ * `currentColor` against `transparent` at the canonical alphas defined
+ * in :root (`--tint-soft`, `--tint-border`).
+ * ============================================================================ */
+
+.bg-tint-soft {
+ background-color: color-mix(in srgb, currentColor var(--tint-soft), transparent);
+}
+
+.border-tint {
+ border-color: color-mix(in srgb, currentColor var(--tint-border), transparent);
+}
+
/* ============================================================================
* Scrollbars
* ============================================================================ */