Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(connectors): make Add a direct action and turn the custom connector sheet into a dialog (#23545)

AmAzing-2beaea5f248d
diff --git a/e2e/src/steps/community/interactions.steps.ts b/e2e/src/steps/community/interactions.steps.ts
index 148580822ad..399635c30f9 100644
--- a/e2e/src/steps/community/interactions.steps.ts
+++ b/e2e/src/steps/community/interactions.steps.ts
@@ -1,7 +1,7 @@
import { Then, When } from '@cucumber/cucumber';
import { expect } from '@playwright/test';
-import type { CustomWorld } from '../../support/world';
+import { type CustomWorld, WAIT_TIMEOUT } from '../../support/world';
// ============================================
// When Steps (Actions)
@@ -380,5 +380,7 @@ Then('I should see the MCP detail content', async function (this: CustomWorld) {
});
Then('I should be navigated to {string}', async function (this: CustomWorld, expectedPath: string) {
- await expect(this.page).toHaveURL((url) => url.pathname + url.search === expectedPath);
+ await expect(this.page).toHaveURL((url) => url.pathname + url.search === expectedPath, {
+ timeout: WAIT_TIMEOUT,
+ });
});
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index af022ab21ae..a237b6ff0b7 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -916,6 +916,7 @@
"detailModal.tabs.manifest": "Manifest",
"detailModal.tabs.settings": "Settings",
"detailModal.title": "Skill details",
+ "dev.addConnector": "Add",
"dev.confirmDeleteDevPlugin": "This local Skill will be deleted permanently. Continue?",
"dev.deleteSuccess": "Skill deleted",
"dev.manifest.identifier.desc": "Unique identifier for the Skill",
@@ -986,7 +987,6 @@
"dev.mcp.identifier.label": "MCP name",
"dev.mcp.identifier.placeholder": "e.g. my-mcp-plugin",
"dev.mcp.identifier.required": "Enter MCP identifier",
- "dev.mcp.previewManifest": "Preview manifest",
"dev.mcp.quickImport": "Import JSON config",
"dev.mcp.quickImportError.empty": "Content cannot be empty",
"dev.mcp.quickImportError.invalidJson": "Invalid JSON",
@@ -994,6 +994,7 @@
"dev.mcp.stdioNotSupported": "STDIO MCP not supported in current environment",
"dev.mcp.testConnection": "Test connection",
"dev.mcp.testConnectionTip": "MCP will be available after successful connection test",
+ "dev.mcp.testSuccess": "Connected · {{summary}}",
"dev.mcp.type.desc": "Select MCP type, web only supports Streamable HTTP",
"dev.mcp.type.httpFeature1": "Web and desktop compatible",
"dev.mcp.type.httpFeature2": "Connect to remote MCP server, no setup required",
@@ -1040,14 +1041,7 @@
"dev.openai.importUrl": "Import from URL",
"dev.openai.schema": "Schema",
"dev.permissionDenied": "You are not allowed to modify this connector — only the creator or a workspace owner can",
- "dev.preview.api.noParams": "No parameters",
- "dev.preview.api.noResults": "No APIs found",
- "dev.preview.api.params": "Parameters:",
- "dev.preview.api.searchPlaceholder": "Search Skills…",
- "dev.preview.card": "Preview Skill card",
"dev.preview.desc": "Preview description",
- "dev.preview.empty.desc": "Complete configuration to preview Skill capabilities",
- "dev.preview.empty.title": "Configure to preview",
"dev.preview.mcp.empty": "No tools, prompts, or resources",
"dev.preview.mcp.prompts_one": "{{count}} prompt",
"dev.preview.mcp.prompts_other": "{{count}} prompts",
@@ -1056,12 +1050,12 @@
"dev.preview.mcp.tools_one": "{{count}} tool",
"dev.preview.mcp.tools_other": "{{count}} tools",
"dev.preview.title": "Skill name preview",
- "dev.save": "Install",
"dev.saveError": "Install failed, please try again",
"dev.saveSuccess": "Settings saved",
"dev.tabs.manifest": "Manifest",
"dev.tabs.meta": "Meta info",
- "dev.title.create": "Add Custom MCP Skill",
+ "dev.title.connectorSettings": "Connector settings",
+ "dev.title.createConnector": "Add custom connector",
"dev.title.edit": "Edit Custom MCP Skill",
"dev.title.editCommunity": "Edit Community Skill",
"dev.title.skillDetails": "Skill Details",
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index f23e8f5eff8..36a6f5d64ed 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -446,18 +446,14 @@
"connectorMarket.action.details": "View details",
"connectorMarket.action.install": "Install",
"connectorMarket.action.manage": "Manage",
- "connectorMarket.add": "Add",
- "connectorMarket.add.browseStore": "Browse Skill Store",
- "connectorMarket.add.browseStoreDesc": "Built-in tools, skills and MCP servers",
"connectorMarket.add.custom": "Add custom connector",
- "connectorMarket.add.customDesc": "Connect your own MCP server",
"connectorMarket.detail.byAuthor": "By {{author}}",
"connectorMarket.detail.information": "Information",
"connectorMarket.detail.tools": "Tools",
"connectorMarket.detail.type": "Type",
"connectorMarket.empty.clear": "Clear search",
"connectorMarket.empty.search": "No connectors match “{{keyword}}”",
- "connectorMarket.empty.searchDesc": "Try another name, or find more in the Skill Store.",
+ "connectorMarket.empty.searchDesc": "Try another name, or find more in the Marketplace.",
"connectorMarket.refresh": "Refresh",
"connectorMarket.search.placeholder": "Search connectors",
"connectorMarket.section.installed": "Installed",
@@ -2193,12 +2189,11 @@
"skillStore.wantMore.feedback.message": "## Skill Name\n[Please fill in]\n\n## Use Case\nWhen I am ___, I need ___\n\n## Expected Features\n1.\n2.\n3.\n\n## Reference Examples\n(Optional) Are there any similar tools or features for reference?\n\n---\n💡 Tip: The more specific your description, the better we can meet your needs",
"skillStore.wantMore.feedback.title": "[Skill Request] Summarize the skill you need in one sentence",
"skillStore.wantMore.reachedEnd": "You've reached the end. Can't find what you need?",
- "skillView.browseStoreDesc": "Find and install skills for your agents",
"skillView.connectorTabs.private": "Private",
"skillView.connectorTabs.workspace": "Workspace",
"skillView.connectors": "Connectors",
"skillView.connectorsDesc": "Connect the apps and tools your agents can use. Open one to see its account and tools.",
- "skillView.empty.description": "Browse the Skill Store or import a skill from the Add menu.",
+ "skillView.empty.description": "Find skills in the Marketplace, or import one from GitHub, a link, or a local file.",
"skillView.empty.search": "No skills match “{{keyword}}”",
"skillView.empty.title": "No skills yet",
"skillView.privateConnectorsDesc": "Only you can see these connectors, and only your private agents use them. Workspace agents never load them.",
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index d0a7de9b08c..cfb9eb91852 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -916,6 +916,7 @@
"detailModal.tabs.manifest": "安装文件",
"detailModal.tabs.settings": "设置",
"detailModal.title": "技能详情",
+ "dev.addConnector": "添加",
"dev.confirmDeleteDevPlugin": "即将删除该本地技能,删除后将无法找回,是否删除该技能?",
"dev.deleteSuccess": "技能删除成功",
"dev.manifest.identifier.desc": "技能的唯一标识",
@@ -986,7 +987,6 @@
"dev.mcp.identifier.label": "MCP 名称",
"dev.mcp.identifier.placeholder": "例如:my-mcp-plugin",
"dev.mcp.identifier.required": "请输入 MCP 服务标识符",
- "dev.mcp.previewManifest": "预览技能描述文件",
"dev.mcp.quickImport": "快速导入 JSON 配置",
"dev.mcp.quickImportError.empty": "输入内容不能为空",
"dev.mcp.quickImportError.invalidJson": "无效的 JSON 格式",
@@ -994,6 +994,7 @@
"dev.mcp.stdioNotSupported": "当前环境不支持 stdio 类型的 MCP",
"dev.mcp.testConnection": "测试连接",
"dev.mcp.testConnectionTip": "测试连接成功后 MCP 才可以被正常使用",
+ "dev.mcp.testSuccess": "连接成功 · {{summary}}",
"dev.mcp.type.desc": "选择 MCP 的通信方式,网页版只支持 Streamable HTTP",
"dev.mcp.type.httpFeature1": "兼容网页版与桌面端",
"dev.mcp.type.httpFeature2": "连接远程 MCP 服务器, 无需额外安装配置",
@@ -1040,14 +1041,7 @@
"dev.openai.importUrl": "从 URL 链接导入",
"dev.openai.schema": "Schema",
"dev.permissionDenied": "你无权修改此连接器——仅创建者或工作区 Owner 可以操作",
- "dev.preview.api.noParams": "该技能没有参数",
- "dev.preview.api.noResults": "未找到符合搜索条件的 API",
- "dev.preview.api.params": "参数:",
- "dev.preview.api.searchPlaceholder": "搜索技能…",
- "dev.preview.card": "预览技能展示效果",
"dev.preview.desc": "预览技能描述",
- "dev.preview.empty.desc": "完成配置后,将能够在此处预览技能支持的能力",
- "dev.preview.empty.title": "配置技能后开始预览",
"dev.preview.mcp.empty": "没有工具、提示词或资源",
"dev.preview.mcp.prompts_one": "{{count}} 个提示词",
"dev.preview.mcp.prompts_other": "{{count}} 个提示词",
@@ -1056,12 +1050,12 @@
"dev.preview.mcp.tools_one": "{{count}} 个工具",
"dev.preview.mcp.tools_other": "{{count}} 个工具",
"dev.preview.title": "技能名称预览",
- "dev.save": "安装技能",
"dev.saveError": "安装失败,请重试",
"dev.saveSuccess": "技能设置保存成功",
"dev.tabs.manifest": "功能描述清单 (Manifest)",
"dev.tabs.meta": "技能元信息",
- "dev.title.create": "添加自定义MCP技能",
+ "dev.title.connectorSettings": "连接器设置",
+ "dev.title.createConnector": "添加自定义连接器",
"dev.title.edit": "编辑自定义MCP技能",
"dev.title.editCommunity": "编辑社区技能",
"dev.title.skillDetails": "技能详情",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index d025d339c33..a1c87026697 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -446,18 +446,14 @@
"connectorMarket.action.details": "查看详情",
"connectorMarket.action.install": "安装",
"connectorMarket.action.manage": "管理",
- "connectorMarket.add": "添加",
- "connectorMarket.add.browseStore": "浏览技能商店",
- "connectorMarket.add.browseStoreDesc": "内置工具、技能和 MCP 服务器",
"connectorMarket.add.custom": "添加自定义连接器",
- "connectorMarket.add.customDesc": "接入你自己的 MCP 服务器",
"connectorMarket.detail.byAuthor": "由 {{author}} 提供",
"connectorMarket.detail.information": "信息",
"connectorMarket.detail.tools": "工具",
"connectorMarket.detail.type": "类型",
"connectorMarket.empty.clear": "清除搜索",
"connectorMarket.empty.search": "没有与“{{keyword}}”匹配的连接器",
- "connectorMarket.empty.searchDesc": "换个名称试试,或去技能商店查找更多。",
+ "connectorMarket.empty.searchDesc": "换个名称试试,或在市场中查找更多。",
"connectorMarket.refresh": "刷新",
"connectorMarket.search.placeholder": "搜索连接器",
"connectorMarket.section.installed": "已安装",
@@ -2193,12 +2189,11 @@
"skillStore.wantMore.feedback.message": "## 技能名称\n[请填写]\n\n## 使用场景\n当我在___时,我需要___\n\n## 期望功能\n1.\n2.\n3.\n\n## 参考示例\n(可选)是否有类似的工具或功能可供参考?\n\n---\n💡 提示:描述越具体,我们就越能满足您的需求",
"skillStore.wantMore.feedback.title": "[技能申请] 请用一句话概括您需要的技能",
"skillStore.wantMore.reachedEnd": "已经到底了,未找到所需技能?",
- "skillView.browseStoreDesc": "查找并安装适合助理的技能",
"skillView.connectorTabs.private": "私人",
"skillView.connectorTabs.workspace": "工作区",
"skillView.connectors": "连接器",
"skillView.connectorsDesc": "连接助理可以调用的应用和工具。点开一项,查看授权账号和工具清单。",
- "skillView.empty.description": "通过「添加」菜单浏览技能商店或导入技能。",
+ "skillView.empty.description": "在市场中查找技能,或从 GitHub、链接或本地文件导入。",
"skillView.empty.search": "没有找到与「{{keyword}}」匹配的技能",
"skillView.empty.title": "暂无技能",
"skillView.privateConnectorsDesc": "这些连接器只有你能看到,也只有你的私人助理会使用。工作区助理不会加载它们。",
diff --git a/packages/locales/src/default/plugin.ts b/packages/locales/src/default/plugin.ts
index 649211ea3cc..ece857f37c9 100644
--- a/packages/locales/src/default/plugin.ts
+++ b/packages/locales/src/default/plugin.ts
@@ -973,6 +973,7 @@ export default {
'detailModal.tabs.manifest': 'Manifest',
'detailModal.tabs.settings': 'Settings',
'detailModal.title': 'Skill details',
+ 'dev.addConnector': 'Add',
'dev.confirmDeleteDevPlugin': 'This local Skill will be deleted permanently. Continue?',
'dev.deleteSuccess': 'Skill deleted',
'dev.manifest.identifier.desc': 'Unique identifier for the Skill',
@@ -1050,7 +1051,6 @@ export default {
'dev.mcp.identifier.label': 'MCP name',
'dev.mcp.identifier.placeholder': 'e.g. my-mcp-plugin',
'dev.mcp.identifier.required': 'Enter MCP identifier',
- 'dev.mcp.previewManifest': 'Preview manifest',
'dev.mcp.quickImport': 'Import JSON config',
'dev.mcp.quickImportError.empty': 'Content cannot be empty',
'dev.mcp.quickImportError.invalidJson': 'Invalid JSON',
@@ -1058,6 +1058,7 @@ export default {
'dev.mcp.stdioNotSupported': 'STDIO MCP not supported in current environment',
'dev.mcp.testConnection': 'Test connection',
'dev.mcp.testConnectionTip': 'MCP will be available after successful connection test',
+ 'dev.mcp.testSuccess': 'Connected · {{summary}}',
'dev.mcp.type.desc': 'Select MCP type, web only supports Streamable HTTP',
'dev.mcp.type.httpFeature1': 'Web and desktop compatible',
'dev.mcp.type.httpFeature2': 'Connect to remote MCP server, no setup required',
@@ -1105,16 +1106,9 @@ export default {
'dev.oauthError.timeout': 'Authorization timed out. Click Authorize & Connect to try again.',
'dev.openai.importUrl': 'Import from URL',
'dev.openai.schema': 'Schema',
- 'dev.preview.api.noParams': 'No parameters',
- 'dev.preview.api.noResults': 'No APIs found',
- 'dev.preview.api.params': 'Parameters:',
- 'dev.preview.api.searchPlaceholder': 'Search Skills…',
- 'dev.preview.card': 'Preview Skill card',
'dev.permissionDenied':
'You are not allowed to modify this connector — only the creator or a workspace owner can',
'dev.preview.desc': 'Preview description',
- 'dev.preview.empty.desc': 'Complete configuration to preview Skill capabilities',
- 'dev.preview.empty.title': 'Configure to preview',
'dev.preview.mcp.empty': 'No tools, prompts, or resources',
'dev.preview.mcp.prompts_one': '{{count}} prompt',
'dev.preview.mcp.prompts_other': '{{count}} prompts',
@@ -1123,12 +1117,12 @@ export default {
'dev.preview.mcp.tools_one': '{{count}} tool',
'dev.preview.mcp.tools_other': '{{count}} tools',
'dev.preview.title': 'Skill name preview',
- 'dev.save': 'Install',
'dev.saveError': 'Install failed, please try again',
'dev.saveSuccess': 'Settings saved',
'dev.tabs.manifest': 'Manifest',
'dev.tabs.meta': 'Meta info',
- 'dev.title.create': 'Add Custom MCP Skill',
+ 'dev.title.connectorSettings': 'Connector settings',
+ 'dev.title.createConnector': 'Add custom connector',
'dev.title.edit': 'Edit Custom MCP Skill',
'dev.title.editCommunity': 'Edit Community Skill',
'dev.title.skillDetails': 'Skill Details',
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index 006197e6f61..c9004b1cbdd 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -3,18 +3,14 @@ export default {
'connectorMarket.action.details': 'View details',
'connectorMarket.action.install': 'Install',
'connectorMarket.action.manage': 'Manage',
- 'connectorMarket.add': 'Add',
- 'connectorMarket.add.browseStore': 'Browse Skill Store',
- 'connectorMarket.add.browseStoreDesc': 'Built-in tools, skills and MCP servers',
'connectorMarket.add.custom': 'Add custom connector',
- 'connectorMarket.add.customDesc': 'Connect your own MCP server',
'connectorMarket.detail.byAuthor': 'By {{author}}',
'connectorMarket.detail.information': 'Information',
'connectorMarket.detail.tools': 'Tools',
'connectorMarket.detail.type': 'Type',
'connectorMarket.empty.clear': 'Clear search',
'connectorMarket.empty.search': 'No connectors match “{{keyword}}”',
- 'connectorMarket.empty.searchDesc': 'Try another name, or find more in the Skill Store.',
+ 'connectorMarket.empty.searchDesc': 'Try another name, or find more in the Marketplace.',
'connectorMarket.refresh': 'Refresh',
'connectorMarket.search.placeholder': 'Search connectors',
'connectorMarket.section.installed': 'Installed',
@@ -2067,13 +2063,13 @@ When I am ___, I need ___
'skillStore.wantMore.feedback.title':
'[Skill Request] Summarize the skill you need in one sentence',
'skillStore.wantMore.reachedEnd': "You've reached the end. Can't find what you need?",
- 'skillView.browseStoreDesc': 'Find and install skills for your agents',
'skillView.connectorTabs.private': 'Private',
'skillView.connectorTabs.workspace': 'Workspace',
'skillView.connectors': 'Connectors',
'skillView.connectorsDesc':
'Connect the apps and tools your agents can use. Open one to see its account and tools.',
- 'skillView.empty.description': 'Browse the Skill Store or import a skill from the Add menu.',
+ 'skillView.empty.description':
+ 'Find skills in the Marketplace, or import one from GitHub, a link, or a local file.',
'skillView.empty.search': 'No skills match “{{keyword}}”',
'skillView.empty.title': 'No skills yet',
'skillView.privateConnectorsDesc':
diff --git a/scripts/stylexMigration/legacyFiles.json b/scripts/stylexMigration/legacyFiles.json
index b1e08f2b7e4..142c0f57ea7 100644
--- a/scripts/stylexMigration/legacyFiles.json
+++ b/scripts/stylexMigration/legacyFiles.json
@@ -462,8 +462,6 @@
"src/features/PlanIcon/index.tsx",
"src/features/PluginDevModal/MCPManifestForm/CollapsibleSection.tsx",
"src/features/PluginDevModal/MCPManifestForm/MCPTypeSelect.tsx",
- "src/features/PluginDevModal/PluginPreview/ApiVisualizer.tsx",
- "src/features/PluginDevModal/PluginPreview/EmptyState.tsx",
"src/features/Portal/AcceptanceCheck/Body.tsx",
"src/features/Portal/Artifacts/Body/Renderer/SVG.tsx",
"src/features/Portal/DashboardWidget/Body.tsx",
diff --git a/src/features/ChatInput/ActionBar/Tools/useControls.tsx b/src/features/ChatInput/ActionBar/Tools/useControls.tsx
index 58d6ee14b66..751e862ff81 100644
--- a/src/features/ChatInput/ActionBar/Tools/useControls.tsx
+++ b/src/features/ChatInput/ActionBar/Tools/useControls.tsx
@@ -32,7 +32,7 @@ import { useTranslation } from 'react-i18next';
import { buildAgentProfileTabPath } from '@/features/AgentProfileTabs/tabOptions';
import { useConnectorConfigure } from '@/features/Connectors/CustomConnectorModal/useConnectorConfigure';
-import { openPluginEditDrawer } from '@/features/PluginDevModal/imperative';
+import { openPluginEditModal } from '@/features/PluginDevModal/imperative';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { useFetchInstalledPlugins } from '@/hooks/useFetchInstalledPlugins';
import { usePermission } from '@/hooks/usePermission';
@@ -956,7 +956,7 @@ export const useControls = ({ closeDropdown }: { closeDropdown?: () => void } =
return createManagedSkillItem({
badge: isMcp ? <Icon icon={McpIcon} size={12} /> : undefined,
configureConfig: isCustom
- ? { onConfigure: () => openPluginEditDrawer(item.identifier) }
+ ? { onConfigure: () => openPluginEditModal(item.identifier) }
: undefined,
deleteConfig: {
displayName: title,
diff --git a/src/features/Connectors/CustomConnectorModal/imperative.tsx b/src/features/Connectors/CustomConnectorModal/imperative.tsx
index 1af55b0ba00..70f07d35454 100644
--- a/src/features/Connectors/CustomConnectorModal/imperative.tsx
+++ b/src/features/Connectors/CustomConnectorModal/imperative.tsx
@@ -4,7 +4,7 @@ import { mountImperative } from '@/components/ImperativeMount';
import CustomConnectorModal from '.';
-export const openConnectorEditDrawer = (connectorId: string) =>
+export const openConnectorEditModal = (connectorId: string) =>
mountImperative(({ close, open }) => (
<CustomConnectorModal
connectorId={connectorId}
diff --git a/src/features/Connectors/CustomConnectorModal/useConnectorConfigure.test.ts b/src/features/Connectors/CustomConnectorModal/useConnectorConfigure.test.ts
index 0ac46a9abf9..1836feecc34 100644
--- a/src/features/Connectors/CustomConnectorModal/useConnectorConfigure.test.ts
+++ b/src/features/Connectors/CustomConnectorModal/useConnectorConfigure.test.ts
@@ -7,7 +7,7 @@ import { useConnectorConfigure } from './useConnectorConfigure';
const mocks = vi.hoisted(() => ({
isOwner: false,
- openConnectorEditDrawer: vi.fn(),
+ openConnectorEditModal: vi.fn(),
policy: undefined as
{ canEditPolicy: boolean; canManage: boolean; memberManage: string } | undefined,
}));
@@ -19,7 +19,7 @@ vi.mock('@/libs/swr', async (importOriginal) => ({
vi.mock('@/business/client/hooks/useIsWorkspaceOwner', () => ({
useIsWorkspaceOwner: () => mocks.isOwner,
}));
-vi.mock('./imperative', () => ({ openConnectorEditDrawer: mocks.openConnectorEditDrawer }));
+vi.mock('./imperative', () => ({ openConnectorEditModal: mocks.openConnectorEditModal }));
const connector = (overrides: Record<string, unknown> = {}) => ({
id: 'conn-1',
@@ -42,7 +42,7 @@ describe('useConnectorConfigure', () => {
it("opens the edit drawer on the viewer's own connector", () => {
configureOf(connector())?.onConfigure();
- expect(mocks.openConnectorEditDrawer).toHaveBeenCalledWith('conn-1');
+ expect(mocks.openConnectorEditModal).toHaveBeenCalledWith('conn-1');
});
// The drawer reads the stored credentials (`connector.getForEdit`), which the
diff --git a/src/features/Connectors/CustomConnectorModal/useConnectorConfigure.ts b/src/features/Connectors/CustomConnectorModal/useConnectorConfigure.ts
index 51e1b1bec9c..14464172ad5 100644
--- a/src/features/Connectors/CustomConnectorModal/useConnectorConfigure.ts
+++ b/src/features/Connectors/CustomConnectorModal/useConnectorConfigure.ts
@@ -2,7 +2,7 @@ import { useCallback } from 'react';
import { useConnectorManageableChecker } from '@/hooks/useConnectorManagePolicy';
-import { openConnectorEditDrawer } from './imperative';
+import { openConnectorEditModal } from './imperative';
interface ConfigurableConnector {
agentId?: string | null;
@@ -25,7 +25,7 @@ export const useConnectorConfigure = () => {
(connector: ConfigurableConnector) =>
connector.mcpConnectionType === 'cloud' || !checkManageable(connector).canManageCredentials
? undefined
- : { onConfigure: () => openConnectorEditDrawer(connector.id) },
+ : { onConfigure: () => openConnectorEditModal(connector.id) },
[checkManageable],
);
};
diff --git a/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsx b/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsx
index 84134e70086..ace0068e9f0 100644
--- a/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsx
+++ b/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsx
@@ -3,7 +3,6 @@
import { memo, useState } from 'react';
import CatalogPageHeader from '@/features/Settings/skill/features/CatalogPageHeader';
-import { createMarketSkillStoreModal, createSkillStoreModal } from '@/features/SkillStore';
import { useQueryRoute } from '@/hooks/useQueryRoute';
import { revalidateReplica } from '@/libs/replica';
import { mcpCategoriesResource, mcpListResource } from '@/store/discover/slices/mcp/projection';
@@ -71,7 +70,6 @@ const DiscoverCatalogHeader = memo<DiscoverCatalogHeaderProps>(({ kind, query =
keyword={keyword}
refreshing={refreshing}
viewMode={kind}
- onBrowseStore={kind === 'skill' ? createMarketSkillStoreModal : createSkillStoreModal}
onRefresh={refresh}
onSearch={search}
onKeywordChange={(value) => {
diff --git a/src/features/PluginDevModal/MCPManifestForm/index.tsx b/src/features/PluginDevModal/MCPManifestForm/index.tsx
index ebd5e710d9f..d50fb0e3cb7 100644
--- a/src/features/PluginDevModal/MCPManifestForm/index.tsx
+++ b/src/features/PluginDevModal/MCPManifestForm/index.tsx
@@ -26,6 +26,7 @@ import { type McpConnectionParams, type MCPErrorInfoMetadata } from '@/types/plu
import ArgsInput from './ArgsInput';
import BoundDeviceSelect from './BoundDeviceSelect';
import CollapsibleSection from './CollapsibleSection';
+import { getMcpManifestSummary } from './mcpManifestSummary';
import MCPTypeSelect from './MCPTypeSelect';
import QuickImportSection from './QuickImportSection';
import { hasAdvancedValue, useAdvancedSectionExpanded } from './useAdvancedSection';
@@ -111,7 +112,7 @@ const MCPManifestForm = ({
oauthNotice,
privateConnector,
}: MCPManifestFormProps) => {
- const { t } = useTranslation('plugin');
+ const { t, i18n } = useTranslation('plugin');
const mcpType = useWatch(form, MCP_TYPE);
const authType = useWatch(form, AUTH_TYPE);
const connectVia = useWatch(form, CONNECT_VIA);
@@ -158,11 +159,18 @@ const MCPManifestForm = ({
const [connectionError, setConnectionError] = useState<string | null>(null);
const [errorMetadata, setErrorMetadata] = useState<MCPErrorInfoMetadata | null>(null);
+ // What the last successful test found ("12 tools"), kept with the
+ // connection it tested: once that changes it no longer vouches for it.
+ const stdioCommand = useWatch(form, STDIO_COMMAND);
+ const connectionKey = JSON.stringify([mcpType, httpUrl, stdioCommand, authType]);
+ const [testResult, setTestResult] = useState<{ key: string; summary: string } | null>(null);
+ const testSummary = testResult?.key === connectionKey ? testResult.summary : null;
const handleTestConnection = async () => {
setIsTesting(true);
setConnectionError(null);
setErrorMetadata(null);
+ setTestResult(null);
// Manually trigger validation for fields needed for the test
const fieldsToValidate: FieldPath<LobeToolCustomPlugin>[] =
@@ -202,6 +210,10 @@ const MCPManifestForm = ({
// Optionally update form if manifest ID differs or to store the fetched manifest
// Be careful about overwriting user input if not desired
form.setValues({ manifest: result.manifest });
+ setTestResult({
+ key: connectionKey,
+ summary: getMcpManifestSummary(result.manifest, t, i18n.resolvedLanguage),
+ });
setConnectionError(null); // Clear local error state
setErrorMetadata(null);
} else if (result.error) {
@@ -461,6 +473,13 @@ const MCPManifestForm = ({
</Flexbox>
</Form.Field>
)}
+ {testSummary && !connectionError && !testState.error && (
+ <Alert
+ showIcon
+ title={t('dev.mcp.testSuccess', { summary: testSummary })}
+ type="success"
+ />
+ )}
{(connectionError || testState.error) && (
<Alert
closable
diff --git a/src/features/PluginDevModal/PluginPreview/mcpManifestSummary.test.ts b/src/features/PluginDevModal/MCPManifestForm/mcpManifestSummary.test.ts
similarity index 100%
rename from src/features/PluginDevModal/PluginPreview/mcpManifestSummary.test.ts
rename to src/features/PluginDevModal/MCPManifestForm/mcpManifestSummary.test.ts
diff --git a/src/features/PluginDevModal/PluginPreview/mcpManifestSummary.ts b/src/features/PluginDevModal/MCPManifestForm/mcpManifestSummary.ts
similarity index 100%
rename from src/features/PluginDevModal/PluginPreview/mcpManifestSummary.ts
rename to src/features/PluginDevModal/MCPManifestForm/mcpManifestSummary.ts
diff --git a/src/features/PluginDevModal/PluginPreview/ApiVisualizer.tsx b/src/features/PluginDevModal/PluginPreview/ApiVisualizer.tsx
deleted file mode 100644
index c27b4f914d0..00000000000
--- a/src/features/PluginDevModal/PluginPreview/ApiVisualizer.tsx
+++ /dev/null
@@ -1,186 +0,0 @@
-'use client';
-
-import { Block, createStaticStyles, cssVar, Flexbox, Icon, Input, Tag } from '@lobehub/ui';
-import { ChevronDown, ChevronRight, SearchIcon } from 'lucide-react';
-import { memo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { densityVars } from '@/styles/densityVars';
-
-const styles = createStaticStyles(({ css }) => ({
- apiDesc: css`
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
-
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
- `,
- apiHeader: css`
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: space-between;
- `,
- apiTitle: css`
- font-family: ${cssVar.fontFamilyCode};
- `,
-
- emptyState: css`
- padding: 32px;
- color: ${cssVar.colorTextDisabled};
- text-align: center;
- `,
- header: css`
- display: flex;
- gap: 8px;
- align-items: center;
- margin-block-end: 24px;
- `,
- paramDesc: css`
- font-size: 12px;
- line-height: 18px;
- color: ${cssVar.colorTextSecondary};
- `,
- paramGrid: css`
- display: grid;
- grid-template-columns: 1fr 2fr;
- gap: ${densityVars.contentGap};
- align-items: center;
-
- margin-block-end: 12px;
- `,
- paramName: css`
- display: flex;
- gap: 6px;
- align-items: center;
- font-family: monospace;
- `,
- params: css`
- color: ${cssVar.colorTextQuaternary};
- `,
- required: css`
- margin-inline-start: 2px;
- color: ${cssVar.colorError};
- `,
- searchIcon: css`
- position: absolute;
- z-index: 1;
- inset-block-start: 50%;
- inset-inline-start: 12px;
- transform: translateY(-50%);
-
- color: ${cssVar.colorTextSecondary};
- `,
- searchWrapper: css`
- position: relative;
- `,
- typeTag: css`
- height: 20px;
- padding-block: 0;
- padding-inline: 6px;
-
- font-size: 12px;
- line-height: 20px;
- `,
-}));
-
-interface ApiItemProps {
- api: {
- description: string;
- name: string;
- parameters: {
- properties: Record<string, { description: string; type: string }>;
- required: string[];
- };
- };
-}
-
-const ApiItem = memo<ApiItemProps>(({ api }) => {
- const [expanded, setExpanded] = useState(false);
- const { t } = useTranslation('plugin');
-
- const params = Object.entries(api.parameters.properties || {});
- return (
- <Block gap={8} padding={16}>
- <div className={styles.apiHeader} onClick={() => setExpanded(!expanded)}>
- <Flexbox gap={8}>
- <div className={styles.apiTitle}>{api.name}</div>
- <div className={styles.apiDesc}>{api.description}</div>
- </Flexbox>
-
- <Icon icon={expanded ? ChevronDown : ChevronRight} />
- </div>
-
- {expanded && (
- <Flexbox
- gap={12}
- padding={16}
- style={{ background: cssVar.colorFillQuaternary, borderRadius: 6 }}
- >
- {params.length === 0 ? (
- <div className={styles.params}>{t('dev.preview.api.noParams')}</div>
- ) : (
- <>
- <div className={styles.params}>{t('dev.preview.api.params')}</div>
- <Flexbox gap={8} width={'100%'}>
- {params.map(([name, param]) => {
- const isRequired = api.parameters.required?.includes(name);
- return (
- <div className={styles.paramGrid} key={name}>
- <div className={styles.paramName}>
- <span>{name}</span>
- {isRequired && <span className={styles.required}>*</span>}
- <Tag className={styles.typeTag}>{param.type}</Tag>
- </div>
- <div className={styles.paramDesc}>{param.description}</div>
- </div>
- );
- })}
- </Flexbox>
- </>
- )}
- </Flexbox>
- )}
- </Block>
- );
-});
-
-interface ApiVisualizerProps {
- apis: ApiItemProps['api'][];
-}
-
-const ApiVisualizer = memo<ApiVisualizerProps>(({ apis = [] }) => {
- const [searchQuery, setSearchQuery] = useState('');
- const { t } = useTranslation('plugin');
-
- const filteredApis = apis.filter(
- (api) =>
- api.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
- api.description.toLowerCase().includes(searchQuery.toLowerCase()),
- );
-
- return (
- <Flexbox gap={8} width={'100%'}>
- <div className={styles.searchWrapper}>
- <Input
- placeholder={t('dev.preview.api.searchPlaceholder')}
- prefix={<Icon icon={SearchIcon} />}
- value={searchQuery}
- onChange={(e) => setSearchQuery(e.target.value)}
- />
- </div>
-
- <Flexbox gap={8} width={'100%'}>
- {filteredApis.length > 0 ? (
- filteredApis.map((api, index) => <ApiItem api={api} key={index} />)
- ) : (
- <div className={styles.emptyState}>{t('dev.preview.api.noResults')}</div>
- )}
- </Flexbox>
- </Flexbox>
- );
-});
-
-export default ApiVisualizer;
diff --git a/src/features/PluginDevModal/PluginPreview/EmptyState.tsx b/src/features/PluginDevModal/PluginPreview/EmptyState.tsx
deleted file mode 100644
index 067a58bdee3..00000000000
--- a/src/features/PluginDevModal/PluginPreview/EmptyState.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import { createStaticStyles, Flexbox, Icon, Text } from '@lobehub/ui';
-import { Puzzle } from 'lucide-react';
-import { useTranslation } from 'react-i18next';
-
-import { densityVars } from '@/styles/densityVars';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- display: flex;
- flex-direction: column;
- gap: ${densityVars.contentGap};
- align-items: center;
- justify-content: center;
-
- width: 100%;
- height: 100%;
- padding: ${cssVar.paddingLG};
- `,
- description: css`
- color: ${cssVar.colorTextSecondary};
- text-align: center;
- `,
- iconWrapper: css`
- display: flex;
- align-items: center;
- justify-content: center;
-
- width: 64px;
- height: 64px;
- border-radius: 50%;
-
- background-color: ${cssVar.colorPrimaryBg};
- `,
- line: css`
- height: 6px;
- border-radius: 3px;
- background: ${cssVar.colorBorderSecondary};
- `,
- placeholderLine: css`
- height: 6px;
- margin-block: ${cssVar.marginXS};
- margin-inline: 0;
- border-radius: ${cssVar.borderRadiusLG};
-
- background-color: ${cssVar.colorBorderSecondary};
- `,
- title: css`
- margin-block-end: ${cssVar.marginXS};
- font-size: ${cssVar.fontSizeLG};
- font-weight: 500;
- `,
-}));
-
-export default function PluginEmptyState() {
- const { t } = useTranslation('plugin');
-
- return (
- <div className={styles.container}>
- <div className={styles.iconWrapper}>
- <Icon icon={Puzzle} size={32} />
- </div>
- <Text as={'h4'} className={styles.title}>
- {t('dev.preview.empty.title')}
- </Text>
- <Text className={styles.description}>{t('dev.preview.empty.desc')}</Text>
- <Flexbox align={'center'} gap={8}>
- <div className={styles.line} style={{ width: 128 }} />
- <div className={styles.line} style={{ width: 96 }} />
- <div className={styles.line} style={{ width: 48 }} />
- </Flexbox>
- </div>
- );
-}
diff --git a/src/features/PluginDevModal/PluginPreview/index.tsx b/src/features/PluginDevModal/PluginPreview/index.tsx
deleted file mode 100644
index c37579e73ea..00000000000
--- a/src/features/PluginDevModal/PluginPreview/index.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import { type LobeToolCustomPlugin } from '@lobechat/types';
-import { Block, Button, cssVar, Flexbox, Icon, Text } from '@lobehub/ui';
-import { type FormInstance, useWatch } from '@lobehub/ui/form';
-import { FileCode } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import ManifestPreviewer from '@/components/ManifestPreviewer';
-import PluginAvatar from '@/components/Plugins/PluginAvatar';
-import PluginTag from '@/components/Plugins/PluginTag';
-import { pluginHelpers } from '@/store/tool';
-
-import ApiVisualizer from './ApiVisualizer';
-import PluginEmptyState from './EmptyState';
-import { getMcpManifestSummary } from './mcpManifestSummary';
-
-const PluginPreview = memo<{ form: FormInstance<LobeToolCustomPlugin> }>(({ form }) => {
- const { t, i18n } = useTranslation('plugin');
- const manifest = useWatch(form, 'manifest');
- const meta = manifest?.meta;
-
- if (!manifest)
- return (
- <Flexbox flex={2} height={'100%'} style={{ background: cssVar.colorBgLayout }}>
- <PluginEmptyState />
- </Flexbox>
- );
-
- return (
- <Flexbox
- flex={2}
- gap={24}
- padding={12}
- style={{ background: cssVar.colorBgLayout, overflowY: 'auto' }}
- >
- <Block
- horizontal
- gap={16}
- justify={'space-between'}
- padding={16}
- title={t('dev.preview.card')}
- variant={'outlined'}
- >
- <Flexbox horizontal gap={16}>
- <PluginAvatar avatar={pluginHelpers.getPluginAvatar(meta)} size={40} />
- <Flexbox gap={2}>
- <Flexbox horizontal align={'center'} gap={8}>
- {pluginHelpers.getPluginTitle(meta) || 'Plugin Title'}
- <PluginTag type={'customPlugin'} />
- </Flexbox>
- <Text style={{ fontSize: 12 }} type={'secondary'}>
- {pluginHelpers.getPluginDesc(meta) ||
- (manifest.type === 'mcp'
- ? getMcpManifestSummary(manifest, t, i18n.resolvedLanguage)
- : 'Plugin Description')}
- </Text>
- </Flexbox>
- </Flexbox>
-
- {manifest && (
- <ManifestPreviewer manifest={manifest}>
- <Flexbox>
- <Button icon={<Icon icon={FileCode} />}>{t('dev.mcp.previewManifest')}</Button>
- </Flexbox>
- </ManifestPreviewer>
- )}
- </Block>
- {manifest && <ApiVisualizer apis={manifest.api as any} />}
- </Flexbox>
- );
-});
-
-export default PluginPreview;
diff --git a/src/features/PluginDevModal/imperative.tsx b/src/features/PluginDevModal/imperative.tsx
index a31cdb4e8cf..95ac7813653 100644
--- a/src/features/PluginDevModal/imperative.tsx
+++ b/src/features/PluginDevModal/imperative.tsx
@@ -10,13 +10,13 @@ import { pluginSelectors } from '@/store/tool/selectors';
import DevModal from '.';
-interface PluginEditDrawerProps {
+interface PluginEditModalProps {
identifier: string;
onClose: () => void;
open: boolean;
}
-const PluginEditDrawer = memo<PluginEditDrawerProps>(({ identifier, onClose, open }) => {
+const PluginEditModal = memo<PluginEditModalProps>(({ identifier, onClose, open }) => {
const { allowed: canEdit } = usePermission('edit_own_content');
const value = useToolStore(pluginSelectors.getCustomPluginById(identifier), isEqual);
const [uninstallPlugin, updateCustomPlugin, updateNewCustomPlugin] = useToolStore((s) => [
@@ -49,9 +49,9 @@ const PluginEditDrawer = memo<PluginEditDrawerProps>(({ identifier, onClose, ope
);
});
-PluginEditDrawer.displayName = 'PluginEditDrawer';
+PluginEditModal.displayName = 'PluginEditModal';
-export const openPluginEditDrawer = (identifier: string) =>
+export const openPluginEditModal = (identifier: string) =>
mountImperative(({ close, open }) => (
- <PluginEditDrawer identifier={identifier} open={open} onClose={close} />
+ <PluginEditModal identifier={identifier} open={open} onClose={close} />
));
diff --git a/src/features/PluginDevModal/index.tsx b/src/features/PluginDevModal/index.tsx
index 2bb160b9063..c21f2eb817a 100644
--- a/src/features/PluginDevModal/index.tsx
+++ b/src/features/PluginDevModal/index.tsx
@@ -1,7 +1,5 @@
-import { isDesktop } from '@lobechat/const';
-import { TITLE_BAR_HEIGHT } from '@lobechat/desktop-bridge';
import { type LobeToolCustomPlugin } from '@lobechat/types';
-import { Button, confirmModal, Drawer, Flexbox, toast, useResponsive } from '@lobehub/ui';
+import { Button, confirmModal, Flexbox, Modal, toast } from '@lobehub/ui';
import { useForm, useWatch } from '@lobehub/ui/form';
import { memo, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -15,7 +13,6 @@ import {
type DevModalOAuthPlan,
planOAuthSave,
} from './oauthSavePlan';
-import PluginPreview from './PluginPreview';
import { pruneHiddenFields } from './pruneHiddenFields';
import { getSaveErrorToast } from './saveErrorToast';
@@ -69,7 +66,6 @@ const DevModal = memo<DevModalProps>(
const [submitting, setSubmitting] = useState(false);
- const { mobile } = useResponsive();
const form = useForm<LobeToolCustomPlugin>({
initialValues: INITIAL_VALUES,
onSubmit: async (values) => {
@@ -158,14 +154,11 @@ const DevModal = memo<DevModalProps>(
if (mode === 'create' && !open) form.reset(INITIAL_VALUES);
}, [open]);
- const buttonStyle = mobile ? { flex: 1 } : { margin: 0 };
-
const footer = (
<Flexbox horizontal flex={1} gap={12} justify={'space-between'}>
{isEditMode ? (
<Button
danger
- style={buttonStyle}
onClick={() =>
confirmModal({
cancelText: t('cancel', { ns: 'common' }),
@@ -187,67 +180,56 @@ const DevModal = memo<DevModalProps>(
)}
<Flexbox horizontal gap={12}>
<Button
- style={buttonStyle}
onClick={() => {
onOpenChange(false);
}}
>
{t('cancel', { ns: 'common' })}
</Button>
- <Button
- loading={submitting}
- style={buttonStyle}
- type={'primary'}
- onClick={handlePrimaryClick}
- >
- {t(isEditMode ? 'dev.update' : 'dev.save')}
+ <Button loading={submitting} type={'primary'} onClick={handlePrimaryClick}>
+ {t(isEditMode ? 'dev.update' : 'dev.addConnector')}
</Button>
</Flexbox>
</Flexbox>
);
+ // A centered dialog, not a full-height sheet: the form is a handful of
+ // fields with the advanced ones folded, so it keeps the page it was opened
+ // from in view. The body scrolls; the footer stays put.
return (
- <Drawer
- containerMaxWidth={'auto'}
+ <Modal
footer={footer}
- height={isDesktop ? `calc(100vh - ${TITLE_BAR_HEIGHT}px)` : '100vh'}
+ keyboard={!submitting}
+ maskClosable={!submitting}
open={open}
- placement={'bottom'}
- push={false}
- title={t(isEditMode ? 'dev.title.skillSettings' : 'dev.title.create')}
- width={mobile ? '100%' : 800}
+ title={t(isEditMode ? 'dev.title.connectorSettings' : 'dev.title.createConnector')}
+ width={640}
styles={{
- bodyContent: {
- height: '100%',
- padding: 0,
- },
+ body: { maxHeight: 'calc(100dvh - 200px)', overflowY: 'auto' },
}}
- onClose={() => {
+ onCancel={() => {
onOpenChange(false);
}}
>
+ {/* React events bubble through the portal: keep form clicks away from
+ the row or menu that opened the dialog. */}
<Flexbox
- horizontal
- gap={0}
- height={'100%'}
+ gap={16}
onClick={(e) => {
e.stopPropagation();
}}
>
- <Flexbox flex={3} gap={16} padding={24} style={{ overflowY: 'auto' }}>
- <MCPManifestForm
- enableDeviceBinding={enableDeviceBinding}
- enableOAuth={enableOAuth}
- form={form}
- isEditMode={isEditMode}
- oauthNotice={oauthPlan.notice}
- privateConnector={privateConnector}
- onAuthorizeOAuth={oauthPlan.authorize ? runOAuthFlow : undefined}
- />
- </Flexbox>
- <PluginPreview form={form} />
+ <MCPManifestForm
+ enableDeviceBinding={enableDeviceBinding}
+ enableOAuth={enableOAuth}
+ form={form}
+ isEditMode={isEditMode}
+ oauthNotice={oauthPlan.notice}
+ privateConnector={privateConnector}
+ onAuthorizeOAuth={oauthPlan.authorize ? runOAuthFlow : undefined}
+ />
</Flexbox>
- </Drawer>
+ </Modal>
);
},
);
diff --git a/src/features/Settings/skill/features/CatalogPageHeader.tsx b/src/features/Settings/skill/features/CatalogPageHeader.tsx
index 572305baefd..58589c32b27 100644
--- a/src/features/Settings/skill/features/CatalogPageHeader.tsx
+++ b/src/features/Settings/skill/features/CatalogPageHeader.tsx
@@ -1,10 +1,10 @@
'use client';
import type { ConnectorVisibility } from '@lobechat/types';
-import { ActionIcon, Button, DropdownMenu, Flexbox, Icon, SearchBar, Text } from '@lobehub/ui';
+import { ActionIcon, Button, Flexbox, SearchBar, Text, Tooltip } from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
-import { ChevronDown, Grid2x2Plus, Import, Plus, RotateCw, Store } from 'lucide-react';
+import { Import, Plus, RotateCw } from 'lucide-react';
import { memo, type ReactNode, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -14,25 +14,11 @@ import { useConnectorManageable } from '@/hooks/useConnectorManagePolicy';
import { usePermission } from '@/hooks/usePermission';
import { densityTokens } from '@/styles/density.stylex';
+import { getCatalogAddAction } from './catalogAddAction';
import { getPageSearchPlacement } from './pageHeaderLayout';
import type { SkillViewMode } from './SkillList';
const styles = stylex.create({
- // @lobehub/ui paints every open dropdown trigger with `colorFillTertiary`
- // (`.lobe-dropdown-menu-trigger[data-popup-open]`, `lobe-popup` layer), which
- // wins over the primary Button's own open state and leaves its light text on
- // a near-white fill. Restore the primary open state with the same tokens the
- // Button uses, so the label stays readable in both themes.
- addTrigger: {
- backgroundColor: {
- 'default': null,
- ':is([data-popup-open])': cssVar.colorPrimaryActive,
- },
- color: {
- 'default': null,
- ':is([data-popup-open])': cssVar.colorBgLayout,
- },
- },
// The Codex Plugins header: the title shares its row with search, the page
// controls and the primary Add (last); one line of what the page does sits
// 8px under both, so a long description never pushes the toolbar down.
@@ -61,6 +47,8 @@ const styles = stylex.create({
pageSearchCompact: { width: '100%' },
// SearchBar draws its border on the inner input box, so the pill goes there.
pageSearchInput: { borderRadius: '999px' },
+ // Disabled buttons swallow hover events; the wrapper anchors the tooltip.
+ tooltipAnchor: { display: 'inline-flex' },
pageTitle: {
marginBlock: 0,
fontSize: cssVar.fontSizeHeading3,
@@ -73,7 +61,6 @@ const styles = stylex.create({
interface CatalogPageHeaderProps {
compact?: boolean;
keyword: string;
- onBrowseStore: () => void;
onKeywordChange: (value: string) => void;
onRefresh: () => void;
onSearch?: (value: string) => void;
@@ -87,7 +74,6 @@ const CatalogPageHeader = memo<CatalogPageHeaderProps>(
({
compact,
keyword,
- onBrowseStore,
onKeywordChange,
onRefresh,
onSearch,
@@ -102,8 +88,6 @@ const CatalogPageHeader = memo<CatalogPageHeaderProps>(
const { canManage, isPending } = useConnectorManageable();
const isConnectorView = viewMode === 'connector';
const isPrivateTab = visibility === 'private';
- const canAddConnector = isPrivateTab || canManage;
- const isPolicyPending = !isPrivateTab && isPending;
const description = t(
!isConnectorView
? 'skillView.skillsDesc'
@@ -113,51 +97,39 @@ const CatalogPageHeader = memo<CatalogPageHeaderProps>(
? 'skillView.workspaceConnectorsDesc'
: 'skillView.connectorsDesc',
);
- const addItems = [
- ...(isConnectorView
- ? [
- {
- desc:
- canAddConnector || isPolicyPending
- ? t('connectorMarket.add.customDesc')
- : t('tools.connectorFeedback.manageOnly'),
- disabled: !canAddConnector,
- icon: <Icon icon={Grid2x2Plus} />,
- key: 'custom',
- label: t('connectorMarket.add.custom'),
- onClick: () => setShowAddConnector(true),
- },
- ]
- : []),
- // A store install joins the shared pool, so the private tab omits it
- ...(isPrivateTab
- ? []
- : [
- {
- desc: t(
- isConnectorView
- ? 'connectorMarket.add.browseStoreDesc'
- : 'skillView.browseStoreDesc',
- ),
- icon: <Icon icon={Store} />,
- key: 'store',
- label: t('connectorMarket.add.browseStore'),
- onClick: onBrowseStore,
- },
- ]),
- ...(!isConnectorView
- ? [
- {
- desc: t('agentSkillModal.sources'),
- disabled: !canCreate,
- icon: <Icon icon={Import} />,
- key: 'import',
- label: t('agentSkillModal.title'),
- onClick: openSkillImportModal,
- },
- ]
- : []),
- ];
+ const add = getCatalogAddAction({
+ canCreate,
+ canManageShared: canManage,
+ policyPending: isPending,
+ viewMode,
+ visibility,
+ });
+ const addAction =
+ add.kind === 'customConnector' ? (
+ <Tooltip title={add.disabledReason && t('tools.connectorFeedback.manageOnly')}>
+ <span {...stylex.props(styles.tooltipAnchor)}>
+ <Button
+ disabled={add.disabled}
+ icon={Plus}
+ shape={'round'}
+ type={'primary'}
+ onClick={() => setShowAddConnector(true)}
+ >
+ {t('connectorMarket.add.custom')}
+ </Button>
+ </span>
+ </Tooltip>
+ ) : (
+ <Button
+ disabled={add.disabled}
+ icon={Import}
+ shape={'round'}
+ type={'primary'}
+ onClick={openSkillImportModal}
+ >
+ {t('agentSkillModal.title')}
+ </Button>
+ );
const searchPlaceholder = t(
isConnectorView ? 'connectorMarket.search.placeholder' : 'skillView.search.placeholder',
);
@@ -197,17 +169,7 @@ const CatalogPageHeader = memo<CatalogPageHeaderProps>(
title={t('connectorMarket.refresh')}
onClick={onRefresh}
/>
- <DropdownMenu items={addItems} placement={'bottomRight'}>
- <Button
- className={stylex.props(styles.addTrigger).className}
- icon={Plus}
- shape={'round'}
- type={'primary'}
- >
- {t('connectorMarket.add')}
- <Icon icon={ChevronDown} size={14} />
- </Button>
- </DropdownMenu>
+ {addAction}
</Flexbox>
</div>
{searchBelowTitle && search}
diff --git a/src/features/Settings/skill/features/ConnectorConfigureButton.tsx b/src/features/Settings/skill/features/ConnectorConfigureButton.tsx
index f7abc830321..e45e223ec7b 100644
--- a/src/features/Settings/skill/features/ConnectorConfigureButton.tsx
+++ b/src/features/Settings/skill/features/ConnectorConfigureButton.tsx
@@ -2,7 +2,7 @@ import { Button, Tooltip } from '@lobehub/ui';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
-import { openConnectorEditDrawer } from '@/features/Connectors/CustomConnectorModal/imperative';
+import { openConnectorEditModal } from '@/features/Connectors/CustomConnectorModal/imperative';
import type { ConnectorWithTools } from '@/store/tool/slices/connector/types';
import { useConnectorConfigureGate } from './useConnectorConfigureGate';
@@ -21,7 +21,7 @@ const ConnectorConfigureButton = memo<{ canEdit: boolean; connector: ConnectorWi
<Button
disabled={!allowed}
onClick={() => {
- if (allowed) openConnectorEditDrawer(connector.id);
+ if (allowed) openConnectorEditModal(connector.id);
}}
>
{t('store.actions.configure')}
diff --git a/src/features/Settings/skill/features/LeftPanel.tsx b/src/features/Settings/skill/features/LeftPanel.tsx
index ac8b004e408..e1f607217b9 100644
--- a/src/features/Settings/skill/features/LeftPanel.tsx
+++ b/src/features/Settings/skill/features/LeftPanel.tsx
@@ -9,12 +9,10 @@ import { memo, type ReactNode, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { CustomConnectorModal } from '@/features/Connectors';
-import { MARKETPLACE_SKILL_PATH } from '@/features/Marketplace/paths';
import { pillTabClassNames } from '@/features/Marketplace/pillTabs';
import { NavPanelDensityContext } from '@/features/NavPanel/density';
import { createMarketSkillStoreModal, createSkillStoreModal } from '@/features/SkillStore';
import { openSkillImportModal } from '@/features/SkillStore/SkillImportModal';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { useConnectorManageable } from '@/hooks/useConnectorManagePolicy';
import { usePermission } from '@/hooks/usePermission';
import { useInterfaceDensity } from '@/styles/density';
@@ -104,15 +102,9 @@ const LeftPanel = memo<LeftPanelProps>(
const [keyword, setKeyword] = useState('');
const isConnectorView = viewMode === 'connector';
- const navigate = useWorkspaceAwareNavigate();
+ // Mobile column only: it has no Discover / Installed tabs, so the store
+ // button stays its way to find more.
const handleOpenStore = isConnectorView ? createSkillStoreModal : createMarketSkillStoreModal;
- // The page now lives in the Marketplace beside the skill catalog, so
- // browsing more skills switches to the Discover tab instead of stacking
- // the same catalog in a modal. Connectors keep their store modal: it also
- // offers the connector installation flows.
- const handleBrowseStore = isConnectorView
- ? createSkillStoreModal
- : () => navigate(MARKETPLACE_SKILL_PATH);
const { allowed: canCreate } = usePermission('create_content');
const isPrivateTab = isConnectorView && visibility === 'private';
// Adding a shared workspace connector follows the same member policy as
@@ -159,7 +151,6 @@ const LeftPanel = memo<LeftPanelProps>(
toolbarExtra={
isConnectorView && !isPrivateTab && <ConnectorManagePolicy variant={'toolbar'} />
}
- onBrowseStore={handleBrowseStore}
onKeywordChange={setKeyword}
onRefresh={onRefresh}
/>
diff --git a/src/features/Settings/skill/features/catalogAddAction.test.ts b/src/features/Settings/skill/features/catalogAddAction.test.ts
new file mode 100644
index 00000000000..78be3982647
--- /dev/null
+++ b/src/features/Settings/skill/features/catalogAddAction.test.ts
@@ -0,0 +1,59 @@
+import { describe, expect, it } from 'vitest';
+
+import { getCatalogAddAction } from './catalogAddAction';
+
+const base = { canCreate: true, canManageShared: true, policyPending: false };
+
+describe('getCatalogAddAction', () => {
+ // Regression: "Add" was a menu whose second item, "Browse Skill Store",
+ // stacked a store modal on top of the Marketplace catalog it was opened from.
+ it('gives the connectors page one direct action: add a custom connector', () => {
+ expect(getCatalogAddAction({ ...base, viewMode: 'connector' })).toEqual({
+ disabled: false,
+ kind: 'customConnector',
+ });
+ });
+
+ it('gives the skills page one direct action: import a skill', () => {
+ expect(getCatalogAddAction({ ...base, viewMode: 'skill' })).toEqual({
+ disabled: false,
+ kind: 'importSkill',
+ });
+ expect(getCatalogAddAction({ ...base, canCreate: false, viewMode: 'skill' }).disabled).toBe(
+ true,
+ );
+ });
+
+ it('disables a shared connector for a member the policy excludes, and says why', () => {
+ expect(
+ getCatalogAddAction({
+ ...base,
+ canManageShared: false,
+ viewMode: 'connector',
+ visibility: 'public',
+ }),
+ ).toEqual({ disabled: true, disabledReason: 'manageOnly', kind: 'customConnector' });
+ });
+
+ it('gives no reason while the policy is still loading', () => {
+ expect(
+ getCatalogAddAction({
+ ...base,
+ canManageShared: false,
+ policyPending: true,
+ viewMode: 'connector',
+ }),
+ ).toEqual({ disabled: true, kind: 'customConnector' });
+ });
+
+ it('lets anyone add a private connector', () => {
+ expect(
+ getCatalogAddAction({
+ ...base,
+ canManageShared: false,
+ viewMode: 'connector',
+ visibility: 'private',
+ }).disabled,
+ ).toBe(false);
+ });
+});
diff --git a/src/features/Settings/skill/features/catalogAddAction.ts b/src/features/Settings/skill/features/catalogAddAction.ts
new file mode 100644
index 00000000000..a8fd92e5f8f
--- /dev/null
+++ b/src/features/Settings/skill/features/catalogAddAction.ts
@@ -0,0 +1,45 @@
+import type { ConnectorVisibility } from '@lobechat/types';
+
+import type { SkillViewMode } from './SkillList';
+
+export interface CatalogAddActionInput {
+ /** `create_content` permission: importing a skill creates content. */
+ canCreate: boolean;
+ /** The workspace member policy allows managing shared connectors. */
+ canManageShared: boolean;
+ /** The member policy is still loading. */
+ policyPending: boolean;
+ viewMode: SkillViewMode;
+ visibility?: ConnectorVisibility;
+}
+
+export interface CatalogAddAction {
+ disabled: boolean;
+ /** Why the action is disabled, when the reason is known (not while loading). */
+ disabledReason?: 'manageOnly';
+ kind: 'customConnector' | 'importSkill';
+}
+
+/**
+ * The page header's single primary action. Connectors add a custom server,
+ * skills import one. Finding more lives in the Marketplace's own Discover
+ * catalog, so the header offers no store entry and no menu: one action is a
+ * button.
+ */
+export const getCatalogAddAction = ({
+ canCreate,
+ canManageShared,
+ policyPending,
+ viewMode,
+ visibility,
+}: CatalogAddActionInput): CatalogAddAction => {
+ if (viewMode !== 'connector') return { disabled: !canCreate, kind: 'importSkill' };
+
+ // A private connector is the caller's own; only the shared pool follows the policy.
+ if (visibility === 'private' || canManageShared)
+ return { disabled: false, kind: 'customConnector' };
+
+ return policyPending
+ ? { disabled: true, kind: 'customConnector' }
+ : { disabled: true, disabledReason: 'manageOnly', kind: 'customConnector' };
+};