feat: add custom mcp icon (#9112)

This commit is contained in:
Curry Yang
2025-09-08 15:02:08 +08:00
committed by GitHub
parent 2f7e671274
commit 08bb209557
2 changed files with 21 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
import type { IconName } from '@fortawesome/fontawesome-svg-core';
import type { IconName, IconProp } from '@fortawesome/fontawesome-svg-core';
import { Fragment, useEffect, useMemo, useState } from 'react';
import {
Button,
@@ -677,7 +677,7 @@ const Component = () => {
const createInProjectActionList: {
id: string;
name: string;
icon: IconName;
icon: IconProp;
action: () => void;
}[] = [
{
@@ -695,7 +695,7 @@ const Component = () => {
{
id: 'new-mcp-client',
name: 'MCP Client',
icon: 'file',
icon: ['fac', 'mcp'] as unknown as IconProp,
action: createNewMcpClient,
},
{
@@ -715,7 +715,7 @@ const Component = () => {
const scopeActionList: {
id: string;
label: string;
icon: IconName;
icon: IconProp;
action?: {
icon: IconName;
label: string;
@@ -750,7 +750,7 @@ const Component = () => {
{
id: 'mcp',
label: `MCP Clients (${mcpClientsCount})`,
icon: 'file',
icon: ['fac', 'mcp'] as unknown as IconProp,
action: {
icon: 'plus',
label: 'New mcp client',

View File

@@ -6,4 +6,20 @@ import { FontAwesomeIcon, type FontAwesomeIconProps } from '@fortawesome/react-f
library.add(fas, far, fab);
import type { IconDefinition, IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';
const customMcpIcon: IconDefinition = {
prefix: 'fac' as IconPrefix, // custom prefix for "custom" icons, avoids conflicts with standard prefixes
iconName: 'mcp' as IconName,
icon: [
24,
24,
[],
'',
'M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z',
],
};
library.add(customMcpIcon);
export const Icon = (props: FontAwesomeIconProps) => <FontAwesomeIcon {...props} />;