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(marketplace): unify agent, skill, and connector catalogs (#23563)

AmAzing-a58ae9386e43
diff --git a/.agents/ux/lobe-design-rules.md b/.agents/ux/lobe-design-rules.md
index b354c5efb43..e6486af4731 100644
--- a/.agents/ux/lobe-design-rules.md
+++ b/.agents/ux/lobe-design-rules.md
@@ -221,3 +221,17 @@ In installed skill navigation, show “Update available” as passive text. In t
In the skill detail header, put the repository, tracking ref, routine sync status and manual check in the GitHub source popover. Keep an available update actionable in the header.
Verify the pending state with tooltips closed. The sidebar should communicate availability, and the list should identify the update action alongside the manage menu. Source: user feedback on the skill update preview.
+
+## LOBE-UX-031 — Share the Marketplace catalog spacing
+
+Use the same centered content column, toolbar spacing, and grid for Agents, Skills, and Connectors. When changing the catalog density, measure the rendered column width, the gap from the toolbar to the first section, and the column gutter in the desktop window at the reference scale. Keep the loading layouts aligned with the catalog.
+
+Enforcement: both catalogs and their loading skeleton use the shared frame and grid in `src/features/Marketplace/Catalog/styles.ts`.
+
+Source: user correction comparing the Marketplace desktop layout with Open Bot (2026-11-20).
+
+## LOBE-UX-032 — Show installed skill rows in the main pane
+
+Display installed skill rows in the Skills catalog's main pane and in its installed manager. Use the row menus for skill management and the “View all” link for the full list. Keep the installed connector list and its manager entry visible in the sidebar across Marketplace sections. The section label already identifies installed connectors, so omit the connected check mark from those rows.
+
+Source: user correction comparing the Skills sidebar and main pane with Open Bot (2026-11-20).
diff --git a/e2e/src/features/community/interactions.feature b/e2e/src/features/community/interactions.feature
index c4ac31c600d..8eed1ba84ce 100644
--- a/e2e/src/features/community/interactions.feature
+++ b/e2e/src/features/community/interactions.feature
@@ -14,21 +14,22 @@ Feature: Discover Interactions
Given I navigate to "/marketplace/agent"
When I type "developer" in the search bar
And I wait for the search results to load
- Then I should see filtered assistant cards
+ Then I should see only "Code Assistant" in the assistant catalog
@COMMUNITY-INTERACT-002 @P1
Scenario: Filter assistants by category
Given I navigate to "/marketplace/agent"
- When I click on a category in the category menu
+ When I open the assistant category "programming"
And I wait for the filtered results to load
- Then I should see assistant cards filtered by the selected category
+ Then I should see only "Code Assistant" in the assistant catalog
And the URL should contain the category parameter
@COMMUNITY-INTERACT-003 @P1
Scenario: Navigate to next page of assistants
Given I navigate to "/marketplace/agent"
- When I click the next page button
- Then I should be navigated to "/marketplace/agent?page=2"
+ When I open the recommended assistants
+ And I click the next page button
+ Then I should be navigated to "/marketplace/agent?sort=recommended&page=2"
And I should see the assistant cards for page two
@COMMUNITY-INTERACT-004 @P1
@@ -77,7 +78,14 @@ Feature: Discover Interactions
Given I navigate to "/marketplace/connector"
When I open the MCP category "developer"
Then I should be navigated to "/marketplace/connector?category=developer"
- And I should see only "File Manager" in the MCP catalog
+ And I should see only these MCP cards
+ | File Manager |
+ | Build Runner |
+ | Code Search |
+ | Container Manager |
+ | Database Browser |
+ | Git Client |
+ | Log Viewer |
@COMMUNITY-INTERACT-009 @P1
Scenario: Navigate to MCP detail page
@@ -89,5 +97,5 @@ Feature: Discover Interactions
@COMMUNITY-INTERACT-010 @P1
Scenario: Open an old marketplace bookmark with a search
Given I navigate to "/community?q=developer"
- Then I should see filtered assistant cards
- And I should be navigated to "/marketplace/agent?q=developer"
+ Then I should be navigated to "/marketplace/agent?q=developer"
+ And I should see only "Code Assistant" in the assistant catalog
diff --git a/e2e/src/features/community/smoke.feature b/e2e/src/features/community/smoke.feature
index 7429cf945ef..c2763c0f114 100644
--- a/e2e/src/features/community/smoke.feature
+++ b/e2e/src/features/community/smoke.feature
@@ -16,9 +16,8 @@ Feature: Community Smoke Tests
Then the page should load without errors
And I should see the page body
And I should see the search bar
- And I should see the category menu
+ And I should see the assistant category "programming"
And I should see assistant cards
- And I should see pagination controls
@COMMUNITY-SMOKE-003 @P0
Scenario: Load Model List Page
@@ -45,6 +44,7 @@ Feature: Community Smoke Tests
@COMMUNITY-SMOKE-006 @P0
Scenario: Open a legacy MCP catalog link
- Given I navigate to "/community/mcp?category=developer"
- Then I should be navigated to "/marketplace/connector?category=developer"
- And I should see only "File Manager" in the MCP catalog
+ Given I navigate to "/community/mcp?category=productivity"
+ Then I should be navigated to "/marketplace/connector?category=productivity"
+ And I should see only these MCP cards
+ | Web Search |
diff --git a/e2e/src/mocks/community/data.ts b/e2e/src/mocks/community/data.ts
index 771813fb019..c796348b17c 100644
--- a/e2e/src/mocks/community/data.ts
+++ b/e2e/src/mocks/community/data.ts
@@ -304,6 +304,24 @@ export const mockMcpItems: DiscoverMcpItem[] = [
toolsCount: 2,
updatedAt: UPDATED_AT,
},
+ // Keep Developer above the six-item preview so it has a "View all" link.
+ ...[
+ ['build-runner', 'Build Runner'],
+ ['code-search', 'Code Search'],
+ ['container-manager', 'Container Manager'],
+ ['database-browser', 'Database Browser'],
+ ['git-client', 'Git Client'],
+ ['log-viewer', 'Log Viewer'],
+ ].map<DiscoverMcpItem>(([identifier, name]) => ({
+ capabilities: { prompts: false, resources: false, tools: true },
+ category: 'developer',
+ connectionType: 'stdio',
+ createdAt: CREATED_AT,
+ description: `${name} MCP fixture.`,
+ identifier,
+ name,
+ updatedAt: UPDATED_AT,
+ })),
];
export const mockMcpList: McpListResponse = {
@@ -315,12 +333,6 @@ export const mockMcpList: McpListResponse = {
totalPages: 1,
};
-export const mockMcpCategories = [
- { category: 'business', count: 7 },
- { category: 'developer', count: 5 },
- { category: 'productivity', count: 3 },
-];
-
// ============================================
// Detail Mock Data
// ============================================
diff --git a/e2e/src/mocks/community/handlers.ts b/e2e/src/mocks/community/handlers.ts
index 2de330f002f..507e8570990 100644
--- a/e2e/src/mocks/community/handlers.ts
+++ b/e2e/src/mocks/community/handlers.ts
@@ -10,7 +10,6 @@ import {
mockAssistantDetails,
mockAssistantItems,
mockAssistantList,
- mockMcpCategories,
mockMcpDetails,
mockMcpItems,
mockMcpList,
@@ -130,59 +129,78 @@ const paginate = <T>(items: T[], input: unknown, fallbackTotal = items.length) =
};
};
-const getAssistantList = (input: unknown) => {
- const category = getStringInput(input, 'category');
+const searchAssistantItems = (input: unknown) => {
const query = getStringInput(input, 'q');
+ if (!query) return mockAssistantItems;
+
+ return mockAssistantItems.filter(
+ (item) =>
+ matchesText(item.title, query) ||
+ matchesText(item.description, query) ||
+ matchesText(item.identifier, query) ||
+ matchesText(item.tags?.join(' '), query),
+ );
+};
- let items = mockAssistantItems;
-
- if (category && !['all', 'discover'].includes(category)) {
- const filtered = items.filter((item) => item.category === category);
- if (filtered.length > 0) items = filtered;
- }
+const getAssistantCategories = (input: unknown) => {
+ if (!getStringInput(input, 'q')) return mockAssistantCategories;
- if (query) {
- const filtered = items.filter(
- (item) =>
- matchesText(item.title, query) ||
- matchesText(item.description, query) ||
- matchesText(item.identifier, query) ||
- matchesText(item.tags?.join(' '), query),
- );
- if (filtered.length > 0) items = filtered;
- }
+ const items = searchAssistantItems(input);
+ return mockAssistantCategories.map((group) => ({
+ ...group,
+ count: items.filter((item) => item.category === group.category).length,
+ }));
+};
- // Keep the unfiltered catalog's second page distinct from its first.
- if (!query && (!category || category === 'all')) {
+const getAssistantList = (input: unknown) => {
+ const category = getStringInput(input, 'category');
+ const query = getStringInput(input, 'q');
+ const scoped = !!category && !['all', 'discover'].includes(category);
+ let items = searchAssistantItems(input);
+ const categoryCounts = getAssistantCategories(input);
+
+ if (scoped) {
+ items = items.filter((item) => item.category === category);
+ } else if (!query) {
+ // Keep the synthetic second page distinct from the first.
const page = getNumberInput(input, 'page') ?? 1;
items = page === 1 ? items.slice(0, -1) : items.slice(-1);
}
- return { ...mockAssistantList, ...paginate(items, input, mockAssistantList.totalCount) };
+ const total = query
+ ? items.length
+ : scoped
+ ? categoryCounts.find((group) => group.category === category)?.count
+ : mockAssistantList.totalCount;
+ const paging = paginate(items, input, total);
+ return { ...mockAssistantList, ...paging, categoryCounts };
};
-const getMcpList = (input: unknown) => {
- const category = getStringInput(input, 'category');
+const searchMcpItems = (input: unknown) => {
const query = getStringInput(input, 'q');
+ if (!query) return mockMcpItems;
+
+ return mockMcpItems.filter(
+ (item) =>
+ matchesText(item.name, query) ||
+ matchesText(item.description, query) ||
+ matchesText(item.identifier, query),
+ );
+};
- let items = mockMcpItems;
-
- if (category && !['all', 'discover'].includes(category)) {
- const filtered = items.filter((item) => item.category === category);
- if (filtered.length > 0) items = filtered;
- }
-
- if (query) {
- const filtered = items.filter(
- (item) =>
- matchesText(item.name, query) ||
- matchesText(item.description, query) ||
- matchesText(item.identifier, query),
- );
- if (filtered.length > 0) items = filtered;
- }
+const getMcpList = (input: unknown) => {
+ const category = getStringInput(input, 'category');
+ const items = searchMcpItems(input).filter(
+ (item) => !category || ['all', 'discover'].includes(category) || item.category === category,
+ );
+ const paging = paginate(items, input);
+ const offset = (paging.currentPage - 1) * paging.pageSize;
- return { ...mockMcpList, ...paginate(items, input), categories: mockMcpList.categories };
+ return {
+ ...mockMcpList,
+ ...paging,
+ items: items.slice(offset, offset + paging.pageSize),
+ };
};
const getModelList = (input: unknown) => {
@@ -227,7 +245,7 @@ const findByIdentifier = <T extends { identifier: string }>(items: T[], input: u
const getMockResponse = (procedure: string, input: unknown): unknown => {
switch (procedure) {
case 'market.getAssistantCategories': {
- return mockAssistantCategories;
+ return getAssistantCategories(input);
}
case 'market.getAssistantDetail': {
@@ -243,7 +261,11 @@ const getMockResponse = (procedure: string, input: unknown): unknown => {
}
case 'market.getMcpCategories': {
- return mockMcpCategories;
+ const items = searchMcpItems(input);
+ return mockMcpList.categories.map((category) => ({
+ category,
+ count: items.filter((item) => item.category === category).length,
+ }));
}
case 'market.getMcpDetail': {
diff --git a/e2e/src/steps/community/interactions.steps.ts b/e2e/src/steps/community/interactions.steps.ts
index 399635c30f9..9d284e07a99 100644
--- a/e2e/src/steps/community/interactions.steps.ts
+++ b/e2e/src/steps/community/interactions.steps.ts
@@ -1,7 +1,9 @@
+import type { DataTable } from '@cucumber/cucumber';
import { Then, When } from '@cucumber/cucumber';
import { expect } from '@playwright/test';
-import { type CustomWorld, WAIT_TIMEOUT } from '../../support/world';
+import type { CustomWorld } from '../../support/world';
+import { WAIT_TIMEOUT } from '../../support/world';
// ============================================
// When Steps (Actions)
@@ -25,42 +27,15 @@ When('I wait for the search results to load', async function (this: CustomWorld)
await this.page.waitForTimeout(500);
});
-When('I click on a category in the category menu', async function (this: CustomWorld) {
- await this.page.waitForLoadState('domcontentloaded', { timeout: 30_000 });
-
- // Find the category menu items - they are clickable elements in the sidebar
- // The UI shows categories like "All", "Academic", "Career", etc.
- const categoryItems = this.page.locator('[data-testid="category-menu"] li > :is(a, button)');
-
- const count = await categoryItems.count();
- console.log(` 📍 Found ${count} category items`);
-
- if (count === 0) {
- // Fallback: try finding by text content that looks like a category
- const fallbackCategories = this.page.locator(
- 'text=/^(Academic|Career|Design|Programming|General)/',
- );
- const fallbackCount = await fallbackCategories.count();
- console.log(` 📍 Fallback: Found ${fallbackCount} category items by text`);
-
- if (fallbackCount > 0) {
- await fallbackCategories.first().click();
- this.testContext.selectedCategory = await fallbackCategories.first().textContent();
- return;
- }
- }
-
- // Wait for categories to be visible
- await categoryItems.first().waitFor({ state: 'visible', timeout: 30_000 });
-
- // Click the third category (skip "Discover" at index 0 and "All" at index 1)
- // This should select the first actual category filter like "Academic"
- const targetCategory = categoryItems.nth(2);
- await targetCategory.click();
+When(
+ 'I open the assistant category {string}',
+ async function (this: CustomWorld, category: string) {
+ await this.page.locator(`section a[href="/marketplace/agent?category=${category}"]`).click();
+ },
+);
- // Store the category for later verification
- const categoryText = await targetCategory.textContent();
- this.testContext.selectedCategory = categoryText?.trim();
+When('I open the recommended assistants', async function (this: CustomWorld) {
+ await this.page.locator('section a[href="/marketplace/agent?sort=recommended"]').click();
});
When('I open the MCP category {string}', async function (this: CustomWorld, category: string) {
@@ -209,24 +184,12 @@ When('I wait for the sorted results to load', async function (this: CustomWorld)
// Then Steps (Assertions)
// ============================================
-Then('I should see filtered assistant cards', async function (this: CustomWorld) {
- await this.page.waitForLoadState('domcontentloaded', { timeout: 30_000 });
-
- const assistantItems = this.page.locator('[data-testid="assistant-item"]');
-
- // Wait for at least one item to be visible
- await expect(assistantItems.first()).toBeVisible({ timeout: 30_000 });
-});
-
Then(
- 'I should see assistant cards filtered by the selected category',
- async function (this: CustomWorld) {
- await this.page.waitForLoadState('domcontentloaded', { timeout: 30_000 });
-
- const assistantItems = this.page.locator('[data-testid="assistant-item"]');
-
- // Wait for at least one item to be visible
- await expect(assistantItems.first()).toBeVisible({ timeout: 30_000 });
+ 'I should see only {string} in the assistant catalog',
+ async function (this: CustomWorld, title: string) {
+ const rows = this.page.getByTestId('assistant-item');
+ await expect(rows).toHaveCount(1, { timeout: WAIT_TIMEOUT });
+ await expect(rows.first()).toContainText(title);
},
);
@@ -348,14 +311,14 @@ Then('I should see the provider detail content', async function (this: CustomWor
expect(titleText?.trim().length).toBeGreaterThan(0);
});
-Then(
- 'I should see only {string} in the MCP catalog',
- async function (this: CustomWorld, name: string) {
- const cards = this.page.getByTestId('mcp-item');
- await expect(cards).toHaveCount(1);
+Then('I should see only these MCP cards', async function (this: CustomWorld, expected: DataTable) {
+ const cards = this.page.getByTestId('mcp-item');
+ const rows = expected.raw();
+ await expect(cards).toHaveCount(rows.length, { timeout: WAIT_TIMEOUT });
+ for (const [name] of rows) {
await expect(cards.getByText(name, { exact: true })).toBeVisible();
- },
-);
+ }
+});
Then('I should be navigated to the MCP detail page', async function (this: CustomWorld) {
await this.page.waitForLoadState('domcontentloaded', { timeout: 30_000 });
diff --git a/e2e/src/steps/community/smoke.steps.ts b/e2e/src/steps/community/smoke.steps.ts
index 7b164e6b723..b09f730c9f9 100644
--- a/e2e/src/steps/community/smoke.steps.ts
+++ b/e2e/src/steps/community/smoke.steps.ts
@@ -14,11 +14,15 @@ Then('I should see the search bar', async function (this: CustomWorld) {
await expect(searchBar).toBeVisible({ timeout: 30_000 });
});
-Then('I should see the category menu', async function (this: CustomWorld) {
- // CategoryMenu component has data-testid="category-menu"
- const categoryMenu = this.page.locator('[data-testid="category-menu"]').first();
- await expect(categoryMenu).toBeVisible({ timeout: 30_000 });
-});
+Then(
+ 'I should see the assistant category {string}',
+ async function (this: CustomWorld, category: string) {
+ const groupLink = this.page.locator(
+ `section a[href="/marketplace/agent?category=${category}"]`,
+ );
+ await expect(groupLink).toBeVisible({ timeout: 30_000 });
+ },
+);
Then('I should see assistant cards', async function (this: CustomWorld) {
// Look for assistant items by data-testid
@@ -32,12 +36,6 @@ Then('I should see assistant cards', async function (this: CustomWorld) {
expect(count).toBeGreaterThan(0);
});
-Then('I should see pagination controls', async function (this: CustomWorld) {
- // Pagination component has data-testid="pagination"
- const pagination = this.page.locator('[data-testid="pagination"]').first();
- await expect(pagination).toBeVisible({ timeout: 30_000 });
-});
-
// Model List Page Steps
Then('I should see model cards', async function (this: CustomWorld) {
// Model items have data-testid="model-item"
diff --git a/locales/en-US/discover.json b/locales/en-US/discover.json
index 02b85378120..71ca8a3508e 100644
--- a/locales/en-US/discover.json
+++ b/locales/en-US/discover.json
@@ -81,6 +81,10 @@
"assistants.withPlugin": "This Agent includes Skills",
"back": "Back to Discovery",
"catalog.add": "Add",
+ "catalog.agentDescription": "Find Agents and groups for tasks like writing, coding, and research.",
+ "catalog.allAgents": "All Agents",
+ "catalog.allConnectors": "All connectors",
+ "catalog.allSkills": "All skills",
"catalog.back": "Back to Discover",
"catalog.installed": "Installed",
"catalog.manageInstalledConnectors": "Manage installed connectors",
@@ -89,9 +93,14 @@
"catalog.popular": "Popular",
"catalog.recommended": "Recommended",
"catalog.retry": "Retry",
+ "catalog.rowAction": "{{action}} {{name}}",
+ "catalog.searchAgents": "Search Agents",
+ "catalog.searchIn": "Search in {{name}}",
"catalog.searchResults": "Results for “{{keyword}}”",
"catalog.sectionError": "Couldn't load this group",
"catalog.viewAll": "View all",
+ "catalog.viewAllIn": "View all in {{name}}",
+ "catalog.yourSkills": "Your skills",
"category.assistant.academic": "Academic",
"category.assistant.all": "All",
"category.assistant.career": "Career",
diff --git a/locales/zh-CN/discover.json b/locales/zh-CN/discover.json
index 25c9b6ef636..b64449a589b 100644
--- a/locales/zh-CN/discover.json
+++ b/locales/zh-CN/discover.json
@@ -81,6 +81,10 @@
"assistants.withPlugin": "该助理附带技能",
"back": "返回发现",
"catalog.add": "添加",
+ "catalog.agentDescription": "查找擅长写作、编程、研究等任务的助理或助理群组。",
+ "catalog.allAgents": "全部助理",
+ "catalog.allConnectors": "全部连接器",
+ "catalog.allSkills": "全部技能",
"catalog.back": "返回发现",
"catalog.installed": "已安装",
"catalog.manageInstalledConnectors": "管理已安装的连接器",
@@ -89,9 +93,14 @@
"catalog.popular": "热门",
"catalog.recommended": "推荐",
"catalog.retry": "重试",
+ "catalog.rowAction": "{{action}} {{name}}",
+ "catalog.searchAgents": "搜索助理",
+ "catalog.searchIn": "在 {{name}} 中搜索",
"catalog.searchResults": "“{{keyword}}”的搜索结果",
"catalog.sectionError": "这一组没有加载出来",
"catalog.viewAll": "查看全部",
+ "catalog.viewAllIn": "查看 {{name}} 的全部条目",
+ "catalog.yourSkills": "你的技能",
"category.assistant.academic": "学术",
"category.assistant.all": "全部",
"category.assistant.career": "职业",
diff --git a/packages/locales/src/default/discover.ts b/packages/locales/src/default/discover.ts
index 3b84138140e..7272949c792 100644
--- a/packages/locales/src/default/discover.ts
+++ b/packages/locales/src/default/discover.ts
@@ -89,6 +89,11 @@ export default {
'assistants.withPlugin': 'This Agent includes Skills',
'back': 'Back to Discovery',
'catalog.add': 'Add',
+ 'catalog.agentDescription':
+ 'Find Agents and groups for tasks like writing, coding, and research.',
+ 'catalog.allAgents': 'All Agents',
+ 'catalog.allConnectors': 'All connectors',
+ 'catalog.allSkills': 'All skills',
'catalog.back': 'Back to Discover',
'catalog.installed': 'Installed',
'catalog.manageInstalledConnectors': 'Manage installed connectors',
@@ -97,9 +102,14 @@ export default {
'catalog.popular': 'Popular',
'catalog.recommended': 'Recommended',
'catalog.retry': 'Retry',
+ 'catalog.rowAction': '{{action}} {{name}}',
+ 'catalog.searchAgents': 'Search Agents',
+ 'catalog.searchIn': 'Search in {{name}}',
'catalog.searchResults': 'Results for “{{keyword}}”',
'catalog.sectionError': "Couldn't load this group",
'catalog.viewAll': 'View all',
+ 'catalog.viewAllIn': 'View all in {{name}}',
+ 'catalog.yourSkills': 'Your skills',
'category.assistant.academic': 'Academic',
'category.assistant.all': 'All',
'category.assistant.career': 'Career',
diff --git a/src/components/Skeleton/MarketplaceCatalog.tsx b/src/components/Skeleton/MarketplaceCatalog.tsx
new file mode 100644
index 00000000000..020b4412295
--- /dev/null
+++ b/src/components/Skeleton/MarketplaceCatalog.tsx
@@ -0,0 +1,50 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+
+import { catalogStyles } from '@/features/Marketplace/Catalog/styles';
+import type { RouteSkeletonProps } from '@/spa/router/routeMeta';
+
+import SkeletonBar from './Bar';
+import { CommunityPageChrome } from './CommunityList';
+
+export const CatalogRowsSkeleton = ({ count = 6 }: { count?: number }) => {
+ return (
+ <div aria-busy {...stylex.props(catalogStyles.grid)}>
+ {Array.from({ length: count }, (_, index) => (
+ <Flexbox horizontal align={'center'} gap={12} height={60} key={index} paddingInline={8}>
+ <SkeletonBar height={40} width={40} />
+ <Flexbox flex={1} gap={6}>
+ <SkeletonBar height={14} width={'40%'} />
+ <SkeletonBar height={12} width={'70%'} />
+ </Flexbox>
+ <SkeletonBar height={24} width={72} />
+ </Flexbox>
+ ))}
+ </div>
+ );
+};
+
+export const MarketplaceCatalogSkeleton = ({ chrome = 'page' }: RouteSkeletonProps) => (
+ <CommunityPageChrome chrome={chrome}>
+ <div {...stylex.props(catalogStyles.frame)}>
+ <Flexbox gap={24} style={{ paddingBlockStart: 24 }}>
+ <Flexbox gap={4}>
+ <SkeletonBar height={28} width={112} />
+ <SkeletonBar height={20} width={'min(100%, 420px)'} />
+ </Flexbox>
+ <Flexbox horizontal align={'center'} gap={8}>
+ <Flexbox flex={1} style={{ minWidth: 0 }}>
+ <SkeletonBar height={32} />
+ </Flexbox>
+ <SkeletonBar height={32} width={120} />
+ </Flexbox>
+ </Flexbox>
+ <div {...stylex.props(catalogStyles.section)}>
+ <SkeletonBar height={32} width={132} />
+ <CatalogRowsSkeleton />
+ </div>
+ </div>
+ </CommunityPageChrome>
+);
diff --git a/src/features/CommunityAgentList/assistantListQuery.ts b/src/features/CommunityAgentList/assistantListQuery.ts
index 955381c0b45..dd8b8507e1a 100644
--- a/src/features/CommunityAgentList/assistantListQuery.ts
+++ b/src/features/CommunityAgentList/assistantListQuery.ts
@@ -1,13 +1,13 @@
import { type AssistantQueryParams, AssistantSorts } from '@/types/discover';
-/** Keep the list and category sidebar on the same SWR request. */
+/** Request individual agents and groups together from the Marketplace. */
export const buildAssistantListQuery = (params: AssistantQueryParams): AssistantQueryParams => ({
category: params.category,
includeAgentGroup: true,
- includeCategoryCounts: Boolean(params.q?.trim()),
+ includeCategoryCounts: params.includeCategoryCounts ?? Boolean(params.q?.trim()),
order: params.order,
page: params.page,
- pageSize: 21,
+ pageSize: params.pageSize ?? 21,
q: params.q,
sort: params.sort ?? AssistantSorts.Recommended,
source: params.source,
diff --git a/src/features/MCPPluginDetail/MarketMcpInstallActions.tsx b/src/features/MCPPluginDetail/MarketMcpInstallActions.tsx
new file mode 100644
index 00000000000..c8e87606c6e
--- /dev/null
+++ b/src/features/MCPPluginDetail/MarketMcpInstallActions.tsx
@@ -0,0 +1,103 @@
+'use client';
+
+import { Button, Flexbox, Icon } from '@lobehub/ui';
+import { Trash2Icon } from 'lucide-react';
+import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import MCPInstallProgress from '@/features/MCP/MCPInstallProgress';
+import { usePermission } from '@/hooks/usePermission';
+import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
+import { useToolStore } from '@/store/tool';
+import { mcpStoreSelectors } from '@/store/tool/selectors';
+import { pluginSelectors } from '@/store/tool/slices/plugin/selectors';
+
+interface MarketMcpInstallActionsProps {
+ actionLabel?: string;
+ haveCloudEndpoint?: boolean;
+ identifier?: string;
+}
+
+export const MarketMcpInstallActions = ({
+ actionLabel,
+ haveCloudEndpoint,
+ identifier,
+}: MarketMcpInstallActionsProps) => {
+ const { t } = useTranslation(['discover', 'plugin']);
+ const [isLoading, setIsLoading] = useState(false);
+ const { allowed: canCreate } = usePermission('create_content');
+ const { allowed: canEdit } = usePermission('edit_own_content');
+ const { isAuthenticated, isLoading: isAuthLoading, signIn } = useMarketAuth();
+
+ const [installed, installMCPPlugin, uninstallMCPPlugin] = useToolStore((s) => [
+ pluginSelectors.isPluginInstalled(identifier ?? '')(s),
+ s.installMCPPlugin,
+ s.uninstallMCPPlugin,
+ ]);
+
+ const installing = useToolStore(mcpStoreSelectors.isMCPInstalling(identifier ?? ''));
+
+ const installPlugin = async () => {
+ if (!identifier || !canCreate || !canEdit || isLoading || installing) return;
+ setIsLoading(true);
+ try {
+ if (haveCloudEndpoint && !isAuthenticated) {
+ try {
+ await signIn('mcp');
+ } catch {
+ return;
+ }
+ }
+ await installMCPPlugin(identifier);
+ } finally {
+ setIsLoading(false);
+ }
+ };
+
+ if (!identifier) return null;
+
+ const buttonLoading = isLoading || isAuthLoading || installing;
+
+ return installed ? (
+ <Flexbox horizontal gap={8}>
+ <Button block disabled={buttonLoading} size={'large'} type={'default'}>
+ {t('plugins.installed')}
+ </Button>
+
+ <Button
+ disabled={!canEdit}
+ icon={<Icon icon={Trash2Icon} size={20} />}
+ loading={buttonLoading}
+ size={'large'}
+ style={{ minWidth: 45 }}
+ title={t('plugin:store.actions.uninstall')}
+ styles={{
+ icon: { height: 20 },
+ }}
+ onClick={async () => {
+ if (!canEdit) return;
+ setIsLoading(true);
+ try {
+ await uninstallMCPPlugin(identifier);
+ } finally {
+ setIsLoading(false);
+ }
+ }}
+ />
+ </Flexbox>
+ ) : (
+ <>
+ <Button
+ block
+ disabled={!canCreate || !canEdit}
+ loading={buttonLoading}
+ size={'large'}
+ type={'primary'}
+ onClick={installPlugin}
+ >
+ {actionLabel ?? t('plugins.install')}
+ </Button>
+ <MCPInstallProgress identifier={identifier} />
+ </>
+ );
+};
diff --git a/src/features/Marketplace/Catalog/AgentCatalog.tsx b/src/features/Marketplace/Catalog/AgentCatalog.tsx
new file mode 100644
index 00000000000..f3f59611736
--- /dev/null
+++ b/src/features/Marketplace/Catalog/AgentCatalog.tsx
@@ -0,0 +1,262 @@
+'use client';
+
+import { Avatar, Button, Tag } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+import { useTranslation } from 'react-i18next';
+import urlJoin from 'url-join';
+
+import AsyncBoundary from '@/components/AsyncBoundary';
+import { CatalogRowsSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
+import { buildAssistantListQuery } from '@/features/CommunityAgentList/assistantListQuery';
+import SkillListRow from '@/features/Settings/skill/features/SkillListRow';
+import { useQuery } from '@/hooks/useQuery';
+import Pagination from '@/routes/(main)/community/(list)/features/Pagination';
+import SortButton from '@/routes/(main)/community/(list)/features/SortButton';
+import AssistantEmpty from '@/routes/(main)/community/features/AssistantEmpty';
+import { discoverService } from '@/services/discover';
+import { useDiscoverStore } from '@/store/discover';
+import { assistantSelectors } from '@/store/discover/selectors';
+import {
+ AssistantCategory,
+ type AssistantMarketSource,
+ type AssistantQueryParams,
+ AssistantSorts,
+ type DiscoverAssistantItem,
+} from '@/types/discover';
+
+import { MARKETPLACE_AGENT_PATH, MARKETPLACE_PATH } from '../paths';
+import CatalogListView from './CatalogListView';
+import CatalogSection, { useSeenOnce } from './CatalogSection';
+import DiscoverCatalogHeader from './DiscoverCatalogHeader';
+import {
+ buildCatalogListUrl,
+ CATALOG_LIST_PAGE_SIZE,
+ CATALOG_SECTION_SIZE,
+ isCatalogListView,
+ orderCategoriesByCount,
+} from './sections';
+import { catalogStyles } from './styles';
+import { useCatalogDetailNavigate } from './useCatalogDetailNavigate';
+
+const BROWSE_CATEGORIES = Object.values(AssistantCategory).filter(
+ (category) => category !== AssistantCategory.All && category !== AssistantCategory.Discover,
+);
+
+const AgentCatalogRow = ({
+ item,
+ source,
+}: {
+ item: DiscoverAssistantItem;
+ source?: AssistantMarketSource;
+}) => {
+ const { t } = useTranslation('discover');
+ const navigate = useCatalogDetailNavigate();
+ const { avatar, backgroundColor, description, identifier, title, type = 'agent' } = item;
+ const isGroup = type === 'agent-group';
+ const name = title || identifier;
+ const label = t('assistants.detail');
+
+ const openDetail = () => {
+ const path = urlJoin(
+ isGroup ? `${MARKETPLACE_PATH}/group_agent` : MARKETPLACE_AGENT_PATH,
+ identifier,
+ );
+ discoverService
+ .reportAgentEvent({ event: 'click', identifier, source: location.pathname })
+ .catch(() => {});
+ navigate(buildCatalogListUrl(path, { source }));
+ };
+
+ return (
+ <SkillListRow
+ agentType={type}
+ summary={description}
+ testId={'assistant-item'}
+ title={name}
+ extra={
+ <>
+ {isGroup && <Tag size={'small'}>{t('groupAgents.tag')}</Tag>}
+ <Button
+ aria-label={t('catalog.rowAction', { action: label, name })}
+ size={'small'}
+ onClick={(event) => {
+ event.stopPropagation();
+ openDetail();
+ }}
+ >
+ {label}
+ </Button>
+ </>
+ }
+ icon={() => (
+ <Avatar avatar={avatar || name} background={backgroundColor} shape={'square'} size={32} />
+ )}
+ onClick={openDetail}
+ />
+ );
+};
+
+const useCatalogAgents = (query: AssistantQueryParams, enabled = true) => {
+ const useAssistantList = useDiscoverStore((s) => s.useFetchAssistantList);
+ const { queryKey, ...state } = useAssistantList(buildAssistantListQuery(query), { enabled });
+ return { ...state, data: useDiscoverStore(assistantSelectors.assistantList(queryKey)) };
+};
+
+const AgentCatalogGroup = ({
+ category,
+ count,
+ eager,
+ label,
+ q,
+ source,
+}: {
+ category: AssistantCategory;
+ count: number;
+ eager: boolean;
+ label: string;
+ q?: string;
+ source?: AssistantMarketSource;
+}) => {
+ const [sectionRef, seen] = useSeenOnce(eager);
+ const { data, error, mutate } = useCatalogAgents(
+ { category, includeCategoryCounts: false, pageSize: CATALOG_SECTION_SIZE, q, source },
+ seen,
+ );
+
+ if (data?.items.length === 0) return null;
+
+ return (
+ <CatalogSection
+ count={data?.totalCount ?? count}
+ error={data ? undefined : error}
+ label={label}
+ loading={!data}
+ sectionRef={sectionRef}
+ to={buildCatalogListUrl(MARKETPLACE_AGENT_PATH, { category, q, source })}
+ onRetry={() => void mutate()}
+ >
+ {data?.items.slice(0, CATALOG_SECTION_SIZE).map((item) => (
+ <AgentCatalogRow item={item} key={item.identifier} source={source} />
+ ))}
+ </CatalogSection>
+ );
+};
+
+const AgentCatalogGroups = ({ q, source }: Pick<AssistantQueryParams, 'q' | 'source'>) => {
+ const { t } = useTranslation('discover');
+ const { data, error, isLoading, mutate } = useCatalogAgents({
+ includeCategoryCounts: true,
+ pageSize: CATALOG_SECTION_SIZE,
+ q,
+ source,
+ });
+ const useAssistantCategories = useDiscoverStore((s) => s.useFetchAssistantCategories);
+ const { queryKey } = useAssistantCategories({ q, source }, { enabled: !data?.categoryCounts });
+ const fallbackCounts = useDiscoverStore(assistantSelectors.assistantCategories(queryKey));
+ const groups = orderCategoriesByCount(
+ BROWSE_CATEGORIES.map((key) => ({ key, label: t(`category.assistant.${key}`) })),
+ data?.categoryCounts ?? fallbackCounts,
+ );
+
+ return (
+ <div {...stylex.props(catalogStyles.sections)}>
+ <AsyncBoundary
+ data={data}
+ empty={<AssistantEmpty search={Boolean(q)} />}
+ error={error}
+ isEmpty={data?.items.length === 0 && groups.length === 0}
+ isLoading={isLoading}
+ loading={<CatalogRowsSkeleton />}
+ onRetry={() => void mutate()}
+ >
+ {data && data.items.length > 0 && (!q || groups.length === 0) && (
+ <CatalogSection
+ count={data.totalCount}
+ label={t(q ? 'catalog.allAgents' : 'catalog.recommended')}
+ loading={false}
+ to={buildCatalogListUrl(MARKETPLACE_AGENT_PATH, {
+ q,
+ sort: AssistantSorts.Recommended,
+ source,
+ })}
+ >
+ {data.items.slice(0, CATALOG_SECTION_SIZE).map((item) => (
+ <AgentCatalogRow item={item} key={item.identifier} source={source} />
+ ))}
+ </CatalogSection>
+ )}
+ {groups.map(({ count, key, label }, index) => (
+ <AgentCatalogGroup
+ category={key}
+ count={count}
+ eager={index < 2}
+ key={key}
+ label={label}
+ q={q}
+ source={source}
+ />
+ ))}
+ </AsyncBoundary>
+ </div>
+ );
+};
+
+const AgentCatalogList = ({ query }: { query: AssistantQueryParams }) => {
+ const { data, error, isLoading, mutate } = useCatalogAgents({
+ ...query,
+ includeCategoryCounts: false,
+ pageSize: CATALOG_LIST_PAGE_SIZE,
+ });
+
+ return (
+ <CatalogListView
+ empty={<AssistantEmpty search={Boolean(query.q)} />}
+ error={error}
+ hasData={Boolean(data)}
+ isEmpty={!data?.items.length}
+ loading={isLoading}
+ pagination={
+ data &&
+ data.totalPages > 1 && (
+ <Pagination
+ currentPage={data.currentPage}
+ pageSize={data.pageSize}
+ path={MARKETPLACE_AGENT_PATH}
+ total={data.totalCount}
+ />
+ )
+ }
+ onRetry={() => void mutate()}
+ >
+ {data?.items.map((item) => (
+ <AgentCatalogRow item={item} key={item.identifier} source={query.source} />
+ ))}
+ </CatalogListView>
+ );
+};
+
+export const AgentCatalog = () => {
+ const { t } = useTranslation('discover');
+ const query = useQuery() as AssistantQueryParams;
+ const { category, q, sort, source } = query;
+ const isGroup = isCatalogListView(query);
+ const categoryLabel = BROWSE_CATEGORIES.find((key) => key === category);
+ const title = categoryLabel
+ ? t(`category.assistant.${categoryLabel}`)
+ : t(sort === AssistantSorts.Recommended && !q ? 'catalog.recommended' : 'catalog.allAgents');
+
+ return (
+ <div {...stylex.props(catalogStyles.frame, isGroup && catalogStyles.groupFrame)}>
+ <DiscoverCatalogHeader
+ kind={'agent'}
+ sortControl={<SortButton resetPage />}
+ group={
+ isGroup
+ ? { backTo: buildCatalogListUrl(MARKETPLACE_AGENT_PATH, { q, source }), title }
+ : undefined
+ }
+ />
+ {isGroup ? <AgentCatalogList query={query} /> : <AgentCatalogGroups q={q} source={source} />}
+ </div>
+ );
+};
diff --git a/src/features/Marketplace/Catalog/CatalogListView.tsx b/src/features/Marketplace/Catalog/CatalogListView.tsx
index 3844b3300f3..f3cba578b8f 100644
--- a/src/features/Marketplace/Catalog/CatalogListView.tsx
+++ b/src/features/Marketplace/Catalog/CatalogListView.tsx
@@ -1,31 +1,16 @@
'use client';
-import { ActionIcon, Flexbox } from '@lobehub/ui';
-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import { Flexbox } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
-import { ChevronLeftIcon } from 'lucide-react';
import { memo, type ReactNode } from 'react';
-import { useTranslation } from 'react-i18next';
import AsyncBoundary from '@/components/AsyncBoundary';
+import { CatalogRowsSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
import { SkillListVariantProvider } from '@/features/Settings/skill/features/SkillListRow';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { CatalogRowsSkeleton } from './CatalogSection';
import { catalogStyles } from './styles';
-const styles = stylex.create({
- title: {
- marginBlock: 0,
- fontSize: cssVar.fontSizeHeading5,
- fontWeight: 600,
- color: cssVar.colorText,
- },
-});
-
interface CatalogListViewProps {
- /** The grouped Discover page this list narrows. */
- backTo: string;
children: ReactNode;
empty: ReactNode;
error?: unknown;
@@ -34,7 +19,6 @@ interface CatalogListViewProps {
loading: boolean;
onRetry: () => void;
pagination?: ReactNode;
- title: string;
}
/**
@@ -42,39 +26,25 @@ interface CatalogListViewProps {
* group heading: the same two-column rows as the groups, with a way back.
*/
const CatalogListView = memo<CatalogListViewProps>(
- ({ backTo, children, empty, error, hasData, isEmpty, loading, onRetry, pagination, title }) => {
- const { t } = useTranslation('discover');
- const navigate = useWorkspaceAwareNavigate();
-
+ ({ children, empty, error, hasData, isEmpty, loading, onRetry, pagination }) => {
return (
- <Flexbox gap={12} width={'100%'}>
- <Flexbox horizontal align={'center'} gap={4} paddingInline={4}>
- <ActionIcon
- icon={ChevronLeftIcon}
- size={'small'}
- title={t('catalog.back')}
- onClick={() => navigate(backTo)}
- />
- <h3 {...stylex.props(styles.title)}>{title}</h3>
+ <AsyncBoundary
+ data={hasData || undefined}
+ empty={empty}
+ error={error}
+ errorVariant={'page'}
+ isEmpty={isEmpty}
+ isLoading={loading}
+ loading={<CatalogRowsSkeleton count={12} />}
+ onRetry={onRetry}
+ >
+ <Flexbox gap={32} width={'100%'}>
+ <SkillListVariantProvider value={'catalog'}>
+ <div {...stylex.props(catalogStyles.grid)}>{children}</div>
+ </SkillListVariantProvider>
+ {pagination}
</Flexbox>
- <AsyncBoundary
- data={hasData || undefined}
- empty={empty}
- error={error}
- errorVariant={'page'}
- isEmpty={isEmpty}
- isLoading={loading}
- loading={<CatalogRowsSkeleton count={12} />}
- onRetry={onRetry}
- >
- <Flexbox gap={32} width={'100%'}>
- <SkillListVariantProvider value={'page'}>
- <div {...stylex.props(catalogStyles.grid)}>{children}</div>
- </SkillListVariantProvider>
- {pagination}
- </Flexbox>
- </AsyncBoundary>
- </Flexbox>
+ </AsyncBoundary>
);
},
);
diff --git a/src/features/Marketplace/Catalog/CatalogSection.tsx b/src/features/Marketplace/Catalog/CatalogSection.tsx
index b0d8383ae6e..e8852eb35c8 100644
--- a/src/features/Marketplace/Catalog/CatalogSection.tsx
+++ b/src/features/Marketplace/Catalog/CatalogSection.tsx
@@ -3,10 +3,10 @@
import { Button, Flexbox, Text } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
import { useInViewport } from 'ahooks';
-import { memo, type ReactNode, type RefObject, useRef, useState } from 'react';
+import { memo, type ReactNode, type RefObject, useId, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import SkeletonBar from '@/components/Skeleton/Bar';
+import { CatalogRowsSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
import { SkillListVariantProvider } from '@/features/Settings/skill/features/SkillListRow';
import SectionHeading from './SectionHeading';
@@ -32,43 +32,30 @@ export const useSeenOnce = (eager: boolean): [RefObject<HTMLElement | null>, boo
return [ref, seen];
};
-const RowSkeleton = () => (
- <Flexbox horizontal align={'center'} gap={12} paddingBlock={8} paddingInline={12}>
- <SkeletonBar height={36} width={36} />
- <Flexbox flex={1} gap={6}>
- <SkeletonBar height={14} width={'40%'} />
- <SkeletonBar height={12} width={'70%'} />
- </Flexbox>
- </Flexbox>
-);
-
-export const CatalogRowsSkeleton = ({ count = CATALOG_SECTION_SIZE }: { count?: number }) => (
- <div aria-busy {...stylex.props(catalogStyles.grid)}>
- {Array.from({ length: count }, (_, index) => (
- <RowSkeleton key={index} />
- ))}
- </div>
-);
-
interface CatalogSectionProps {
children?: ReactNode;
+ count?: number;
error?: unknown;
label: string;
loading: boolean;
onRetry?: () => void;
sectionRef?: RefObject<HTMLElement | null>;
- /** The full list behind the heading. */
- to: string;
+ to?: string;
}
-/** One Discover group: a linked heading over a two-column preview of its rows. */
const CatalogSection = memo<CatalogSectionProps>(
- ({ children, error, label, loading, onRetry, sectionRef, to }) => {
+ ({ children, count, error, label, loading, onRetry, sectionRef, to }) => {
const { t } = useTranslation('discover');
+ const id = useId();
return (
- <section ref={sectionRef} {...stylex.props(catalogStyles.section)}>
- <SectionHeading label={label} linkLabel={`${label} · ${t('catalog.viewAll')}`} to={to} />
+ <section aria-labelledby={id} ref={sectionRef} {...stylex.props(catalogStyles.section)}>
+ <SectionHeading
+ count={count}
+ id={id}
+ label={label}
+ to={count !== undefined && count > CATALOG_SECTION_SIZE ? to : undefined}
+ />
{error ? (
<Flexbox horizontal align={'center'} gap={8} paddingInline={12}>
<Text type={'secondary'}>{t('catalog.sectionError')}</Text>
@@ -81,7 +68,7 @@ const CatalogSection = memo<CatalogSectionProps>(
) : loading ? (
<CatalogRowsSkeleton />
) : (
- <SkillListVariantProvider value={'page'}>
+ <SkillListVariantProvider value={'catalog'}>
<div {...stylex.props(catalogStyles.grid)}>{children}</div>
</SkillListVariantProvider>
)}
diff --git a/src/features/Marketplace/Catalog/ConnectorCatalog.tsx b/src/features/Marketplace/Catalog/ConnectorCatalog.tsx
index 03263698e61..27847fa0ef4 100644
--- a/src/features/Marketplace/Catalog/ConnectorCatalog.tsx
+++ b/src/features/Marketplace/Catalog/ConnectorCatalog.tsx
@@ -3,17 +3,16 @@
import { Avatar, Icon } from '@lobehub/ui';
import { McpIcon } from '@lobehub/ui/icons';
import * as stylex from '@stylexjs/stylex';
-import { memo, useCallback, useMemo } from 'react';
+import { memo, type ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import urlJoin from 'url-join';
-import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
-import SkillList from '@/features/Settings/skill/features/SkillList';
-import SkillListRow, {
- SkillListVariantProvider,
-} from '@/features/Settings/skill/features/SkillListRow';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+import AsyncBoundary from '@/components/AsyncBoundary';
+import { CatalogRowsSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
+import SkillListRow from '@/features/Settings/skill/features/SkillListRow';
+import { useFetchInstalledPlugins } from '@/hooks/useFetchInstalledPlugins';
import { useCategory as useMcpCategory } from '@/hooks/useMCPCategory';
+import { usePermission } from '@/hooks/usePermission';
import { useQuery } from '@/hooks/useQuery';
import Pagination from '@/routes/(main)/community/(list)/features/Pagination';
import McpEmpty from '@/routes/(main)/community/features/McpEmpty';
@@ -25,11 +24,11 @@ import { pluginSelectors } from '@/store/tool/selectors';
import { type DiscoverMcpItem, McpCategory, type McpQueryParams, McpSorts } from '@/types/discover';
import CatalogViewTabs from '../CatalogViewTabs';
-import { buildInstalledDetailPath, getInstalledVisibility } from '../InstalledNav';
import { MARKETPLACE_CONNECTOR_PATH, MARKETPLACE_MCP_PATH } from '../paths';
import CatalogListView from './CatalogListView';
import CatalogSection, { useSeenOnce } from './CatalogSection';
import DiscoverCatalogHeader from './DiscoverCatalogHeader';
+import { openMcpConnectModal } from './McpConnectModal';
import RowAction from './RowAction';
import {
buildCatalogListUrl,
@@ -39,23 +38,25 @@ import {
orderCategoriesByCount,
} from './sections';
import { catalogStyles } from './styles';
+import { useCatalogDetailNavigate } from './useCatalogDetailNavigate';
+import { useCatalogIntegrations } from './useCatalogIntegrations';
-/**
- * A market MCP server as a Codex catalog row. Both the row and `+` open its
- * detail page: adding a server needs its connection settings, which live there.
- */
const McpCatalogRow = memo<{ item: DiscoverMcpItem }>(({ item }) => {
const { description, icon, identifier, name } = item;
const { t } = useTranslation('discover');
- const navigate = useWorkspaceAwareNavigate();
+ const { t: ts } = useTranslation('setting');
+ const navigate = useCatalogDetailNavigate();
+ const { allowed: canCreate } = usePermission('create_content');
+ const { allowed: canEdit } = usePermission('edit_own_content');
+ const connectLabel = ts('connectorMarket.action.connect');
const installed = useToolStore(pluginSelectors.isPluginInstalled(identifier));
- const openDetail = useCallback(() => {
+ const openDetail = () => {
discoverService
.reportMcpEvent({ event: 'click', identifier, source: location.pathname })
.catch(() => {});
navigate(urlJoin(MARKETPLACE_MCP_PATH, identifier));
- }, [identifier, navigate]);
+ };
return (
<SkillListRow
@@ -64,10 +65,14 @@ const McpCatalogRow = memo<{ item: DiscoverMcpItem }>(({ item }) => {
title={name}
extra={
<RowAction
- addLabel={t('catalog.add')}
+ addLabel={connectLabel}
+ disabled={!canCreate || !canEdit}
installed={installed}
installedLabel={t('catalog.installed')}
- onAdd={openDetail}
+ name={name}
+ onAdd={() =>
+ openMcpConnectModal(item, t('catalog.rowAction', { action: connectLabel, name }))
+ }
/>
}
icon={() =>
@@ -85,134 +90,96 @@ const McpCatalogRow = memo<{ item: DiscoverMcpItem }>(({ item }) => {
McpCatalogRow.displayName = 'MarketplaceMcpCatalogRow';
interface McpGroup {
+ category: McpCategory;
+ count: number;
eager: boolean;
label: string;
- params: McpQueryParams;
- to: string;
+ q?: string;
}
-/** One Discover group: fetches its preview once it nears the viewport. */
-const McpCatalogGroup = memo<McpGroup>(({ eager, label, params, to }) => {
+const McpCatalogGroup = ({ category, count, eager, label, q }: McpGroup) => {
const [sectionRef, seen] = useSeenOnce(eager);
const useMcpList = useDiscoverStore((s) => s.useFetchMcpList);
const { error, mutate, queryKey } = useMcpList(
- { ...params, page: 1, pageSize: CATALOG_SECTION_SIZE },
+ { category, page: 1, pageSize: CATALOG_SECTION_SIZE, q, sort: McpSorts.Recommended },
{ enabled: seen },
);
const data = useDiscoverStore(mcpSelectors.mcpList(queryKey));
- // A group with nothing in it is not worth a heading.
- if (data && data.items.length === 0) return null;
+ if (data?.items.length === 0) return null;
return (
<CatalogSection
+ count={data?.totalCount ?? count}
error={data ? undefined : error}
label={label}
loading={!data}
sectionRef={sectionRef}
- to={to}
- onRetry={() => mutate()}
+ to={buildCatalogListUrl(MARKETPLACE_CONNECTOR_PATH, { category, q })}
+ onRetry={() => void mutate()}
>
- {data?.items.map((item) => (
+ {data?.items.slice(0, CATALOG_SECTION_SIZE).map((item) => (
<McpCatalogRow item={item} key={item.identifier} />
))}
</CatalogSection>
);
-});
-
-McpCatalogGroup.displayName = 'MarketplaceMcpCatalogGroup';
-
-/**
- * LobeHub's own OAuth connectors (Gmail, GitHub, Linear …) lead the Discover
- * page, before the MCP catalog. The rows are the installed manager's: `+`
- * starts the OAuth connection in place, a connected one keeps its status and
- * menu; opening a row shows its detail on the installed page. In a workspace
- * the group lists the shared pool, the tab the detail link opens.
- */
-const LobehubConnectorsGroup = memo(() => {
- const navigate = useWorkspaceAwareNavigate();
- const visibility = getInstalledVisibility('connector', useActiveWorkspaceId(), null);
-
- return (
- <SkillListVariantProvider value={'page'}>
- <SkillList
- lobehubConnectors
- viewMode={'connector'}
- visibility={visibility}
- onSelect={(identifier, type) =>
- navigate(buildInstalledDetailPath('connector', identifier, type, visibility))
- }
- />
- </SkillListVariantProvider>
- );
-});
-
-LobehubConnectorsGroup.displayName = 'MarketplaceLobehubConnectorsGroup';
-
-/** The sorts that open the page as their own groups, before the categories. */
-const useFeaturedMcpGroups = () => {
- const { t } = useTranslation('discover');
- return useMemo(
- () => [
- { label: t('catalog.recommended'), sort: McpSorts.Recommended },
- { label: t('catalog.new'), sort: McpSorts.CreatedAt },
- ],
- [t],
- );
};
-/** `discover` and `all` are views of the whole catalog, not groups of their own. */
const MCP_PSEUDO_CATEGORIES = [McpCategory.All, McpCategory.Discover];
-/** The bare Discover page: Recommended, New, then every category with servers. */
-const McpCatalogGroups = memo(() => {
+const McpCatalogGroups = ({
+ integrationSection,
+ q,
+}: {
+ integrationSection?: ReactNode;
+ q?: string;
+}) => {
const categories = useMcpCategory();
- const featured = useFeaturedMcpGroups();
const useMcpCategories = useDiscoverStore((s) => s.useMcpCategories);
- const { queryKey } = useMcpCategories({});
+ const { error, isLoading, mutate, queryKey } = useMcpCategories({ q });
const counts = useDiscoverStore(mcpSelectors.mcpCategories(queryKey));
-
- const groups = useMemo(
- () => [
- ...featured.map(({ label, sort }) => ({
- key: sort,
- label,
- params: { sort },
- to: buildCatalogListUrl(MARKETPLACE_CONNECTOR_PATH, { sort }),
- })),
- ...orderCategoriesByCount(categories, counts, MCP_PSEUDO_CATEGORIES).map(
- ({ key, label }) => ({
- key,
- label,
- params: { category: key, sort: McpSorts.Recommended },
- to: buildCatalogListUrl(MARKETPLACE_CONNECTOR_PATH, { category: key }),
- }),
- ),
- ],
- [categories, counts, featured],
- );
+ const groups = orderCategoriesByCount(categories, counts, MCP_PSEUDO_CATEGORIES);
return (
<div {...stylex.props(catalogStyles.sections)}>
- <LobehubConnectorsGroup />
- {groups.map(({ key, ...group }, index) => (
- <McpCatalogGroup eager={index < 2} key={key} {...group} />
- ))}
+ {integrationSection}
+ <AsyncBoundary
+ data={counts.length > 0 ? counts : undefined}
+ error={error}
+ isLoading={isLoading}
+ loading={<CatalogRowsSkeleton />}
+ onRetry={() => void mutate()}
+ >
+ {groups.length === 0 ? (
+ <McpCatalogList query={{ q }} showEmpty={!integrationSection} />
+ ) : (
+ groups.map(({ count, key, label }, index) => (
+ <McpCatalogGroup
+ category={key}
+ count={count}
+ eager={index < 2}
+ key={key}
+ label={label}
+ q={q}
+ />
+ ))
+ )}
+ </AsyncBoundary>
</div>
);
-});
-
-McpCatalogGroups.displayName = 'MarketplaceMcpCatalogGroups';
+};
-/** Every server of one category, sort or search, behind a group heading. */
-const McpCatalogList = memo(() => {
- const { t } = useTranslation('discover');
- const { q, page, category, sort, order } = useQuery() as McpQueryParams;
- const categories = useMcpCategory();
- const featured = useFeaturedMcpGroups();
+const McpCatalogList = ({
+ query: { category, connectionType, order, page, q, sort },
+ showEmpty = true,
+}: {
+ query: McpQueryParams;
+ showEmpty?: boolean;
+}) => {
const useMcpList = useDiscoverStore((s) => s.useFetchMcpList);
const { error, isLoading, mutate, queryKey } = useMcpList({
category,
+ connectionType,
order,
page,
pageSize: CATALOG_LIST_PAGE_SIZE,
@@ -222,23 +189,16 @@ const McpCatalogList = memo(() => {
const data = useDiscoverStore(mcpSelectors.mcpList(queryKey));
const items = data?.items ?? [];
- const title = q
- ? t('catalog.searchResults', { keyword: q })
- : (categories.find((item) => item.key === category)?.label ??
- featured.find((item) => item.sort === sort)?.label ??
- t(`mcp.sorts.${sort}` as any));
-
return (
<CatalogListView
- backTo={MARKETPLACE_CONNECTOR_PATH}
- empty={<McpEmpty />}
+ empty={showEmpty && <McpEmpty search={Boolean(q)} />}
error={error}
hasData={!!data}
isEmpty={items.length === 0}
loading={isLoading}
- title={title}
pagination={
- data && (
+ data &&
+ data.totalPages > 1 && (
<Pagination
currentPage={data.currentPage}
pageSize={data.pageSize}
@@ -247,35 +207,77 @@ const McpCatalogList = memo(() => {
/>
)
}
- onRetry={() => mutate()}
+ onRetry={() => void mutate()}
>
{items.map((item) => (
<McpCatalogRow item={item} key={item.identifier} />
))}
</CatalogListView>
);
-});
+};
-McpCatalogList.displayName = 'MarketplaceMcpCatalogList';
+const ConnectorCatalog = () => {
+ const { t } = useTranslation('discover');
+ const { group, ...query } = useQuery() as McpQueryParams & { group?: string };
+ const { category, q, sort } = query;
+ const categories = useMcpCategory();
+ const integrations = useCatalogIntegrations(q);
+ const useFetchConnectors = useToolStore((s) => s.useFetchConnectors);
+ const connections = useFetchConnectors(true);
+ useFetchInstalledPlugins();
-/**
- * `/marketplace/connector`: the Discover half of Connectors, which merges the
- * former MCP list into the connector entry. Laid out like Codex Plugins: groups
- * (Recommended, New, then each category) previewing a few rows; a group
- * heading opens its full list. Installed connectors are the other tab.
- */
-const ConnectorCatalog = memo(() => {
- const query = useQuery() as McpQueryParams;
+ const isIntegrationGroup = group === 'integrations';
+ const isMarketGroup = isCatalogListView(query) || Boolean(query.connectionType);
+ const backTo = buildCatalogListUrl(MARKETPLACE_CONNECTOR_PATH, { q });
+ const title = isIntegrationGroup
+ ? integrations.label
+ : (categories.find((item) => item.key === category)?.label ??
+ (sort === McpSorts.CreatedAt ? t('catalog.new') : t('catalog.allConnectors')));
return (
- <>
- <DiscoverCatalogHeader kind={'connector'} query={query.q} />
+ <div
+ {...stylex.props(
+ catalogStyles.frame,
+ (isIntegrationGroup || isMarketGroup) && catalogStyles.groupFrame,
+ )}
+ >
+ <DiscoverCatalogHeader
+ group={isIntegrationGroup || isMarketGroup ? { backTo, title } : undefined}
+ kind={'connector'}
+ />
<CatalogViewTabs active={'discover'} kind={'connector'} />
- {isCatalogListView(query) ? <McpCatalogList /> : <McpCatalogGroups />}
- </>
+ {isIntegrationGroup ? (
+ <CatalogListView
+ empty={<McpEmpty search={Boolean(q)} />}
+ error={connections.error}
+ hasData={integrations.count > 0}
+ isEmpty={integrations.count === 0}
+ loading={connections.isLoading}
+ onRetry={() => void connections.mutate()}
+ >
+ {integrations.rows()}
+ </CatalogListView>
+ ) : isMarketGroup ? (
+ <McpCatalogList query={query} />
+ ) : (
+ <McpCatalogGroups
+ q={q}
+ integrationSection={
+ integrations.count > 0 ? (
+ <CatalogSection
+ count={integrations.count}
+ label={integrations.label}
+ loading={false}
+ to={buildCatalogListUrl(MARKETPLACE_CONNECTOR_PATH, { group: 'integrations', q })}
+ >
+ {integrations.rows(CATALOG_SECTION_SIZE)}
+ </CatalogSection>
+ ) : undefined
+ }
+ />
+ )}
+ </div>
);
-});
-
-ConnectorCatalog.displayName = 'MarketplaceConnectorCatalog';
+};
export default ConnectorCatalog;
diff --git a/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsx b/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsx
index ace0068e9f0..10253520154 100644
--- a/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsx
+++ b/src/features/Marketplace/Catalog/DiscoverCatalogHeader.tsx
@@ -1,84 +1,182 @@
'use client';
-import { memo, useState } from 'react';
+import { Button, Flexbox, SearchBar, Text, Tooltip } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { useDebounceFn } from 'ahooks';
+import { ChevronLeft, Plus } from 'lucide-react';
+import { type ReactNode, useEffect, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useLocation, useSearchParams } from 'react-router';
-import CatalogPageHeader from '@/features/Settings/skill/features/CatalogPageHeader';
-import { useQueryRoute } from '@/hooks/useQueryRoute';
-import { revalidateReplica } from '@/libs/replica';
-import { mcpCategoriesResource, mcpListResource } from '@/store/discover/slices/mcp/projection';
-import {
- skillCategoriesResource,
- skillListResource,
-} from '@/store/discover/slices/skill/projection';
-import { getToolStoreState } from '@/store/tool';
-import { composioServersResource } from '@/store/tool/slices/composioStore/projection';
-import { lobehubSkillServersResource } from '@/store/tool/slices/lobehubSkillStore/projection';
+import { CustomConnectorModal } from '@/features/Connectors';
+import { openSkillImportModal } from '@/features/SkillStore/SkillImportModal';
+import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
+import { useConnectorManageable } from '@/hooks/useConnectorManagePolicy';
+import { usePermission } from '@/hooks/usePermission';
+import { SCROLL_PARENT_ID } from '@/routes/(main)/community/features/const';
import { isMobileSurface } from '@/utils/mobileSurface';
-import { CATALOG_VIEW_PATHS, type CatalogKind } from '../CatalogViewTabs';
+import type { CatalogKind } from '../CatalogViewTabs';
+import { catalogSearchParams } from './sections';
+
+const styles = stylex.create({
+ back: {
+ alignItems: 'center',
+ alignSelf: 'flex-start',
+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },
+ display: 'inline-flex',
+ gap: 4,
+ },
+ header: {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 24,
+ paddingBlockStart: 24,
+ },
+ headerMobile: { paddingBlockStart: 4 },
+ search: { flexGrow: '1', flexShrink: '1', flexBasis: '160px', minWidth: 0 },
+ title: {
+ color: cssVar.colorText,
+ fontSize: cssVar.fontSizeHeading3,
+ fontWeight: 600,
+ lineHeight: 1.3,
+ marginBlock: 0,
+ },
+});
+
+const ConnectorAddAction = () => {
+ const { t } = useTranslation('setting');
+ const [open, setOpen] = useState(false);
+ const { canManage, isPending } = useConnectorManageable();
+
+ return (
+ <>
+ <Tooltip
+ title={!canManage && !isPending ? t('tools.connectorFeedback.manageOnly') : undefined}
+ >
+ <Button
+ disabled={!canManage || isPending}
+ icon={Plus}
+ type={'primary'}
+ onClick={() => setOpen(true)}
+ >
+ {t('connectorMarket.add.custom')}
+ </Button>
+ </Tooltip>
+ {open && <CustomConnectorModal open onClose={() => setOpen(false)} />}
+ </>
+ );
+};
+
+const SkillImportAction = () => {
+ const { t } = useTranslation('setting');
+ const { allowed: canCreate } = usePermission('create_content');
+
+ return (
+ <Button disabled={!canCreate} icon={Plus} type={'primary'} onClick={openSkillImportModal}>
+ {t('agentSkillModal.title')}
+ </Button>
+ );
+};
interface DiscoverCatalogHeaderProps {
- kind: CatalogKind;
- query?: string;
+ group?: { backTo: string; title: string };
+ kind: CatalogKind | 'agent';
+ sortControl?: ReactNode;
}
-const DiscoverCatalogHeader = memo<DiscoverCatalogHeaderProps>(({ kind, query = '' }) => {
- const router = useQueryRoute();
- const [keyword, setKeyword] = useState(query);
- const [lastQuery, setLastQuery] = useState(query);
- const [refreshing, setRefreshing] = useState(false);
- // Browser history and the catalog's Back action can both change the submitted search.
- if (query !== lastQuery) {
- setLastQuery(query);
- setKeyword(query);
+const DiscoverCatalogHeader = ({ group, kind, sortControl }: DiscoverCatalogHeaderProps) => {
+ const { t } = useTranslation('discover');
+ const { t: ts } = useTranslation('setting');
+ const location = useLocation();
+ const headingRef = useRef<HTMLHeadingElement>(null);
+ const groupTitle = group?.title;
+ const view = useRef(groupTitle);
+ useEffect(() => {
+ if (view.current === groupTitle) return;
+ view.current = groupTitle;
+ document.getElementById(SCROLL_PARENT_ID)?.scrollTo({ top: 0 });
+ headingRef.current?.focus({ preventScroll: true });
+ }, [groupTitle]);
+ const [params, setParams] = useSearchParams();
+ const query = params.get('q') ?? '';
+ const [draft, setDraft] = useState({ locationKey: location.key, value: query });
+ if (draft.locationKey !== location.key) {
+ setDraft({
+ locationKey: location.key,
+ value: draft.value.trim() === query ? draft.value : query,
+ });
}
+ const isConnector = kind === 'connector';
+ const isAgent = kind === 'agent';
- const search = (value: string) => {
- const q = value.trim();
- router.push(CATALOG_VIEW_PATHS[kind].discover, { query: q ? { q } : {}, replace: true });
+ const search = (keyword: string) => {
+ if (keyword.trim() === query) return;
+ setParams(catalogSearchParams(params, keyword), { replace: true });
};
+ const { cancel, run } = useDebounceFn(search, { wait: 250 });
- const refresh = async () => {
- if (refreshing) return;
- setRefreshing(true);
- try {
- const tools = getToolStoreState();
- await Promise.allSettled(
- kind === 'skill'
- ? [
- revalidateReplica(skillCategoriesResource),
- revalidateReplica(skillListResource),
- tools.refreshAgentSkills(),
- ]
- : [
- revalidateReplica(mcpCategoriesResource),
- revalidateReplica(mcpListResource),
- revalidateReplica(lobehubSkillServersResource),
- revalidateReplica(composioServersResource),
- tools.fetchConnectors(),
- tools.refreshPlugins(),
- ],
- );
- } finally {
- setRefreshing(false);
- }
- };
+ useEffect(() => cancel, [cancel, location.key]);
+
+ const title = isAgent
+ ? t('tab.assistant')
+ : ts(isConnector ? 'skillView.connectors' : 'skillView.skills');
+ const description = isAgent
+ ? t('catalog.agentDescription')
+ : ts(isConnector ? 'skillView.connectorsDesc' : 'skillView.skillsDesc');
+ const searchLabel = group
+ ? t('catalog.searchIn', { name: group.title })
+ : isAgent
+ ? t('catalog.searchAgents')
+ : ts(isConnector ? 'connectorMarket.search.placeholder' : 'skillView.search.placeholder');
return (
- <CatalogPageHeader
- compact={isMobileSurface()}
- keyword={keyword}
- refreshing={refreshing}
- viewMode={kind}
- onRefresh={refresh}
- onSearch={search}
- onKeywordChange={(value) => {
- setKeyword(value);
- if (!value && query) search('');
- }}
- />
+ <header {...stylex.props(styles.header, isMobileSurface() && styles.headerMobile)}>
+ <Flexbox gap={4}>
+ {group && (
+ <WorkspaceLink replace to={group.backTo} {...stylex.props(styles.back)}>
+ <ChevronLeft aria-hidden size={16} />
+ {title}
+ </WorkspaceLink>
+ )}
+ <h1 ref={headingRef} tabIndex={-1} {...stylex.props(styles.title)}>
+ {groupTitle ?? title}
+ </h1>
+ {!group && <Text type={'secondary'}>{description}</Text>}
+ </Flexbox>
+ <Flexbox horizontal align={'center'} gap={8} style={{ flexWrap: 'wrap' }}>
+ <SearchBar
+ allowClear
+ aria-label={searchLabel}
+ className={stylex.props(styles.search).className}
+ data-testid={'search-bar'}
+ placeholder={searchLabel}
+ value={draft.value}
+ variant={'filled'}
+ onInputChange={(value) => {
+ setDraft({ locationKey: location.key, value });
+ if (value.trim()) run(value);
+ else {
+ cancel();
+ search('');
+ }
+ }}
+ onSearch={(value) => {
+ cancel();
+ search(value);
+ }}
+ />
+ {group || isAgent ? (
+ sortControl
+ ) : isConnector ? (
+ <ConnectorAddAction />
+ ) : (
+ <SkillImportAction />
+ )}
+ </Flexbox>
+ </header>
);
-});
+};
-DiscoverCatalogHeader.displayName = 'DiscoverCatalogHeader';
export default DiscoverCatalogHeader;
diff --git a/src/features/Marketplace/Catalog/McpConnectModal.tsx b/src/features/Marketplace/Catalog/McpConnectModal.tsx
new file mode 100644
index 00000000000..84e441343b0
--- /dev/null
+++ b/src/features/Marketplace/Catalog/McpConnectModal.tsx
@@ -0,0 +1,41 @@
+'use client';
+
+import { createModal, Flexbox, Text } from '@lobehub/ui';
+import { useTranslation } from 'react-i18next';
+
+import { MarketMcpInstallActions } from '@/features/MCPPluginDetail/MarketMcpInstallActions';
+import type { DiscoverMcpItem } from '@/types/discover';
+
+type ConnectableMcp = Pick<DiscoverMcpItem, 'description' | 'haveCloudEndpoint' | 'identifier'>;
+
+const McpConnectContent = ({ description, haveCloudEndpoint, identifier }: ConnectableMcp) => {
+ const { t } = useTranslation('setting');
+
+ return (
+ <Flexbox gap={16}>
+ {description && <Text type={'secondary'}>{description}</Text>}
+ <MarketMcpInstallActions
+ actionLabel={t('connectorMarket.action.connect')}
+ haveCloudEndpoint={haveCloudEndpoint}
+ identifier={identifier}
+ />
+ </Flexbox>
+ );
+};
+
+export const openMcpConnectModal = (
+ { description, haveCloudEndpoint, identifier }: ConnectableMcp,
+ title: string,
+) =>
+ createModal({
+ content: (
+ <McpConnectContent
+ description={description}
+ haveCloudEndpoint={haveCloudEndpoint}
+ identifier={identifier}
+ />
+ ),
+ footer: null,
+ title,
+ width: 520,
+ });
diff --git a/src/features/Marketplace/Catalog/RowAction.tsx b/src/features/Marketplace/Catalog/RowAction.tsx
index 13b7f762b05..8da82bd89c7 100644
--- a/src/features/Marketplace/Catalog/RowAction.tsx
+++ b/src/features/Marketplace/Catalog/RowAction.tsx
@@ -1,9 +1,9 @@
'use client';
-import { ActionIcon, Center, Icon, Tooltip } from '@lobehub/ui';
+import { Button, Flexbox, Icon, Text } from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import { CheckIcon, PlusIcon } from 'lucide-react';
-import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
interface RowActionProps {
addLabel: string;
@@ -11,40 +11,46 @@ interface RowActionProps {
installed?: boolean;
installedLabel: string;
loading?: boolean;
+ name: string;
onAdd: () => void;
}
-/**
- * The one trailing action of a catalog row, as in Codex: `+` adds the item,
- * a check says it is already in the library. Its clicks never reach the row
- * (which opens the detail).
- */
-const RowAction = memo<RowActionProps>(
- ({ addLabel, disabled, installed, installedLabel, loading, onAdd }) => {
- if (installed)
- return (
- <Tooltip title={installedLabel}>
- <Center aria-label={installedLabel} height={28} role={'img'} width={28}>
- <Icon icon={CheckIcon} size={18} style={{ color: cssVar.colorSuccess }} />
- </Center>
- </Tooltip>
- );
+const RowAction = ({
+ addLabel,
+ disabled,
+ installed,
+ installedLabel,
+ loading,
+ name,
+ onAdd,
+}: RowActionProps) => {
+ const { t } = useTranslation('discover');
+ if (installed)
return (
- <ActionIcon
- disabled={disabled}
- icon={PlusIcon}
- loading={loading}
- title={addLabel}
- onClick={(e) => {
- e.stopPropagation();
- onAdd();
- }}
- />
+ <Flexbox horizontal align={'center'} gap={4}>
+ <Icon icon={CheckIcon} size={14} style={{ color: cssVar.colorSuccess }} />
+ <Text fontSize={12} type={'secondary'}>
+ {installedLabel}
+ </Text>
+ </Flexbox>
);
- },
-);
-RowAction.displayName = 'MarketplaceCatalogRowAction';
+ return (
+ <Button
+ aria-label={t('catalog.rowAction', { action: addLabel, name })}
+ disabled={disabled || loading}
+ icon={PlusIcon}
+ loading={loading}
+ size={'small'}
+ onClick={(event) => {
+ event.stopPropagation();
+ onAdd();
+ }}
+ >
+ {addLabel}
+ </Button>
+ );
+};
export default RowAction;
diff --git a/src/features/Marketplace/Catalog/SectionHeading.tsx b/src/features/Marketplace/Catalog/SectionHeading.tsx
index ddcc0057823..00f1401c8bc 100644
--- a/src/features/Marketplace/Catalog/SectionHeading.tsx
+++ b/src/features/Marketplace/Catalog/SectionHeading.tsx
@@ -1,60 +1,73 @@
'use client';
-import { Icon } from '@lobehub/ui';
+import { Icon, Text } from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
-import { ChevronRightIcon } from 'lucide-react';
-import { memo } from 'react';
+import { ChevronRight } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
const styles = stylex.create({
- // The Codex group heading (`Popular >`): 16px semibold, inset 12px so it
- // shares a left edge with the rows' icon tiles.
heading: {
+ alignItems: 'baseline',
+ color: cssVar.colorText,
display: 'flex',
- alignItems: 'center',
- marginBlock: 0,
- paddingInline: '12px',
+ flexWrap: 'wrap',
fontSize: cssVar.fontSizeHeading5,
fontWeight: 600,
- color: cssVar.colorText,
+ gap: 8,
+ marginBlock: 0,
},
link: {
- display: 'inline-flex',
- gap: '4px',
alignItems: 'center',
- borderRadius: cssVar.borderRadiusSM,
- color: { 'default': 'inherit', ':hover': cssVar.colorText },
+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },
+ display: 'inline-flex',
+ flexShrink: 0,
+ gap: 4,
+ minHeight: 32,
},
- chevron: {
- transitionDuration: '150ms',
- transitionProperty: 'transform',
- color: cssVar.colorTextSecondary,
+ root: {
+ alignItems: 'center',
+ display: 'flex',
+ gap: 12,
+ justifyContent: 'space-between',
+ minHeight: 32,
},
});
interface SectionHeadingProps {
+ count?: number;
+ id: string;
label: string;
- /** Accessible name for the link, e.g. "Developer · View all". */
- linkLabel: string;
- /** The full list behind the preview (a category or a sort of the catalog). */
- to: string;
+ to?: string;
}
-/**
- * A catalog group heading: like Codex's `Popular >`, the heading itself links
- * to every item of the group; the preview under it shows the first few.
- */
-const SectionHeading = memo<SectionHeadingProps>(({ label, linkLabel, to }) => (
- <h3 {...stylex.props(styles.heading)}>
- <WorkspaceLink aria-label={linkLabel} title={linkLabel} to={to} {...stylex.props(styles.link)}>
- {label}
- <Icon icon={ChevronRightIcon} size={16} {...stylex.props(styles.chevron)} />
- </WorkspaceLink>
- </h3>
-));
+const SectionHeading = ({ count, id, label, to }: SectionHeadingProps) => {
+ const { t, i18n } = useTranslation('discover');
-SectionHeading.displayName = 'MarketplaceCatalogSectionHeading';
+ return (
+ <div {...stylex.props(styles.root)}>
+ <h2 id={id} {...stylex.props(styles.heading)}>
+ {label}
+ {count !== undefined && (
+ <Text as={'span'} type={'secondary'} weight={400}>
+ {count.toLocaleString(i18n.language)}
+ </Text>
+ )}
+ </h2>
+ {to && (
+ <WorkspaceLink
+ aria-label={t('catalog.viewAllIn', { name: label })}
+ to={to}
+ {...stylex.props(styles.link)}
+ >
+ {t('catalog.viewAll')}
+ <Icon icon={ChevronRight} size={16} />
+ </WorkspaceLink>
+ )}
+ </div>
+ );
+};
export default SectionHeading;
diff --git a/src/features/Marketplace/Catalog/SkillCatalog.tsx b/src/features/Marketplace/Catalog/SkillCatalog.tsx
index 03a7b7ffcf5..318119a8a98 100644
--- a/src/features/Marketplace/Catalog/SkillCatalog.tsx
+++ b/src/features/Marketplace/Catalog/SkillCatalog.tsx
@@ -2,20 +2,27 @@
import { Avatar } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
-import { memo, useCallback, useMemo } from 'react';
+import isEqual from 'fast-deep-equal';
+import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import urlJoin from 'url-join';
-import { createSkillDetailModal } from '@/features/CommunitySkillDetail';
+import AsyncBoundary from '@/components/AsyncBoundary';
+import { CatalogRowsSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
import { useMarketSkillInstall } from '@/features/CommunitySkillDetail/useMarketSkillInstall';
+import AgentSkillItem from '@/features/Settings/skill/features/AgentSkillItem';
+import { matchesConnectorKeyword } from '@/features/Settings/skill/features/connectorSections';
import SkillListRow from '@/features/Settings/skill/features/SkillListRow';
import { useQuery } from '@/hooks/useQuery';
import { useSkillCategory } from '@/hooks/useSkillCategory';
import Pagination from '@/routes/(main)/community/(list)/features/Pagination';
+import SortButton from '@/routes/(main)/community/(list)/features/SortButton';
import SkillEmpty from '@/routes/(main)/community/features/SkillEmpty';
import { discoverService } from '@/services/discover';
import { useDiscoverStore } from '@/store/discover';
import { skillSelectors } from '@/store/discover/selectors';
import { useToolStore } from '@/store/tool';
+import { agentSkillsSelectors } from '@/store/tool/selectors';
import {
type DiscoverSkillItem,
SkillCategory,
@@ -24,6 +31,7 @@ import {
} from '@/types/discover';
import CatalogViewTabs from '../CatalogViewTabs';
+import { buildInstalledDetailPath } from '../InstalledNav';
import { MARKETPLACE_SKILL_PATH } from '../paths';
import CatalogListView from './CatalogListView';
import CatalogSection, { useSeenOnce } from './CatalogSection';
@@ -37,20 +45,14 @@ import {
orderCategoriesByCount,
} from './sections';
import { catalogStyles } from './styles';
+import { useCatalogDetailNavigate } from './useCatalogDetailNavigate';
-/** A market skill as a Codex catalog row: open its detail, `+` installs it. */
const SkillCatalogRow = memo<{ item: DiscoverSkillItem }>(({ item }) => {
const { description, icon, identifier, name } = item;
const { t } = useTranslation('discover');
const { t: tp } = useTranslation('plugin');
const { canCreate, install, installed, installing } = useMarketSkillInstall(identifier, name);
-
- const openDetail = useCallback(() => {
- discoverService
- .reportSkillEvent({ event: 'click', identifier, source: location.pathname })
- .catch(() => {});
- createSkillDetailModal({ identifier });
- }, [identifier]);
+ const navigate = useCatalogDetailNavigate();
return (
<SkillListRow
@@ -65,10 +67,16 @@ const SkillCatalogRow = memo<{ item: DiscoverSkillItem }>(({ item }) => {
installed={installed}
installedLabel={t('skills.details.header.installed')}
loading={installing}
+ name={name}
onAdd={install}
/>
}
- onClick={openDetail}
+ onClick={() => {
+ discoverService
+ .reportSkillEvent({ event: 'click', identifier, source: location.pathname })
+ .catch(() => {});
+ navigate(urlJoin(MARKETPLACE_SKILL_PATH, identifier));
+ }}
/>
);
});
@@ -76,98 +84,90 @@ const SkillCatalogRow = memo<{ item: DiscoverSkillItem }>(({ item }) => {
SkillCatalogRow.displayName = 'MarketplaceSkillCatalogRow';
interface SkillGroup {
+ category: SkillCategory;
+ count: number;
eager: boolean;
label: string;
- params: SkillQueryParams;
- to: string;
+ q?: string;
}
-/** One Discover group: fetches its preview once it nears the viewport. */
-const SkillCatalogGroup = memo<SkillGroup>(({ eager, label, params, to }) => {
+const SkillCatalogGroup = ({ category, count, eager, label, q }: SkillGroup) => {
const [sectionRef, seen] = useSeenOnce(eager);
const useSkillList = useDiscoverStore((s) => s.useFetchSkillList);
const { error, mutate, queryKey } = useSkillList(
- { ...params, page: 1, pageSize: CATALOG_SECTION_SIZE },
+ { category, page: 1, pageSize: CATALOG_SECTION_SIZE, q, sort: SkillSorts.InstallCount },
{ enabled: seen },
);
const data = useDiscoverStore(skillSelectors.skillList(queryKey));
- // A group with nothing in it is not worth a heading.
- if (data && data.items.length === 0) return null;
+ if (data?.items.length === 0) return null;
return (
<CatalogSection
+ count={data?.totalCount ?? count}
error={data ? undefined : error}
label={label}
loading={!data}
sectionRef={sectionRef}
- to={to}
- onRetry={() => mutate()}
+ to={buildCatalogListUrl(MARKETPLACE_SKILL_PATH, { category, q })}
+ onRetry={() => void mutate()}
>
- {data?.items.map((item) => (
+ {data?.items.slice(0, CATALOG_SECTION_SIZE).map((item) => (
<SkillCatalogRow item={item} key={item.identifier} />
))}
</CatalogSection>
);
-});
-
-SkillCatalogGroup.displayName = 'MarketplaceSkillCatalogGroup';
-
-/** The sorts that open the page as their own groups, before the categories. */
-const useFeaturedSkillGroups = () => {
- const { t } = useTranslation('discover');
- return useMemo(
- () => [
- { label: t('catalog.popular'), sort: SkillSorts.InstallCount },
- { label: t('catalog.new'), sort: SkillSorts.CreatedAt },
- ],
- [t],
- );
};
-/** The bare Discover page: Popular, New, then every category with skills. */
-const SkillCatalogGroups = memo(() => {
+const SkillCatalogGroups = ({
+ installedSection,
+ q,
+}: {
+ installedSection?: React.ReactNode;
+ q?: string;
+}) => {
const categories = useSkillCategory();
- const featured = useFeaturedSkillGroups();
const useSkillCategories = useDiscoverStore((s) => s.useSkillCategories);
- const { queryKey } = useSkillCategories({});
+ const { error, isLoading, mutate, queryKey } = useSkillCategories({ q });
const counts = useDiscoverStore(skillSelectors.skillCategories(queryKey));
-
- const groups = useMemo(
- () => [
- ...featured.map(({ label, sort }) => ({
- key: sort,
- label,
- params: { sort },
- to: buildCatalogListUrl(MARKETPLACE_SKILL_PATH, { sort }),
- })),
- ...orderCategoriesByCount(categories, counts, [SkillCategory.All]).map(({ key, label }) => ({
- key,
- label,
- params: { category: key, sort: SkillSorts.InstallCount },
- to: buildCatalogListUrl(MARKETPLACE_SKILL_PATH, { category: key }),
- })),
- ],
- [categories, counts, featured],
- );
+ const groups = orderCategoriesByCount(categories, counts, [SkillCategory.All]);
return (
<div {...stylex.props(catalogStyles.sections)}>
- {groups.map(({ key, ...group }, index) => (
- <SkillCatalogGroup eager={index < 2} key={key} {...group} />
- ))}
+ {installedSection}
+ <AsyncBoundary
+ data={counts.length > 0 ? counts : undefined}
+ error={error}
+ isLoading={isLoading}
+ loading={<CatalogRowsSkeleton />}
+ onRetry={() => void mutate()}
+ >
+ {groups.length === 0 ? (
+ <SkillCatalogList query={{ q }} showEmpty={!installedSection} />
+ ) : (
+ groups.map(({ count, key, label }, index) => (
+ <SkillCatalogGroup
+ category={key}
+ count={count}
+ eager={index < 2}
+ key={key}
+ label={label}
+ q={q}
+ />
+ ))
+ )}
+ </AsyncBoundary>
</div>
);
-});
-
-SkillCatalogGroups.displayName = 'MarketplaceSkillCatalogGroups';
+};
-/** Every skill of one category, sort or search, behind a group heading. */
-const SkillCatalogList = memo(() => {
- const { t } = useTranslation('discover');
- const { q, page, category, sort, order } = useQuery() as SkillQueryParams;
- const categories = useSkillCategory();
- const featured = useFeaturedSkillGroups();
+const SkillCatalogList = ({
+ query: { category, order, page, q, sort },
+ showEmpty = true,
+}: {
+ query: SkillQueryParams;
+ showEmpty?: boolean;
+}) => {
const useSkillList = useDiscoverStore((s) => s.useFetchSkillList);
const { error, isLoading, mutate, queryKey } = useSkillList({
category,
@@ -180,23 +180,16 @@ const SkillCatalogList = memo(() => {
const data = useDiscoverStore(skillSelectors.skillList(queryKey));
const items = data?.items ?? [];
- const title = q
- ? t('catalog.searchResults', { keyword: q })
- : (categories.find((item) => item.key === category)?.label ??
- featured.find((item) => item.sort === sort)?.label ??
- t(`skills.sorts.${sort}` as any));
-
return (
<CatalogListView
- backTo={MARKETPLACE_SKILL_PATH}
- empty={<SkillEmpty />}
+ empty={showEmpty && <SkillEmpty search={Boolean(q)} />}
error={error}
hasData={!!data}
isEmpty={items.length === 0}
loading={isLoading}
- title={title}
pagination={
- data && (
+ data &&
+ data.totalPages > 1 && (
<Pagination
currentPage={data.currentPage}
pageSize={data.pageSize}
@@ -205,37 +198,90 @@ const SkillCatalogList = memo(() => {
/>
)
}
- onRetry={() => mutate()}
+ onRetry={() => void mutate()}
>
{items.map((item) => (
<SkillCatalogRow item={item} key={item.identifier} />
))}
</CatalogListView>
);
-});
-
-SkillCatalogList.displayName = 'MarketplaceSkillCatalogList';
+};
-/**
- * `/marketplace/skill`: the skills catalog laid out like Codex Plugins. With no
- * filter it is a page of groups (Popular, New, then each category) previewing
- * a few rows; a group heading opens that group's full list.
- */
-const SkillCatalog = memo(() => {
- const query = useQuery() as SkillQueryParams;
- // Rows show whether each skill is already installed.
+const SkillCatalog = () => {
+ const { t } = useTranslation('discover');
+ const { group, ...query } = useQuery() as SkillQueryParams & { group?: string };
+ const { category, q, sort } = query;
+ const categories = useSkillCategory();
+ const openDetail = useCatalogDetailNavigate();
const useFetchAgentSkills = useToolStore((s) => s.useFetchAgentSkills);
- useFetchAgentSkills(true);
+ const skillLibrary = useFetchAgentSkills(true);
+ const installed = useToolStore(agentSkillsSelectors.getAgentSkills, isEqual);
+ const localSkills = installed.filter((skill) =>
+ matchesConnectorKeyword(q, [skill.name, skill.identifier, skill.description]),
+ );
+
+ const isInstalledGroup = group === 'installed';
+ const isMarketGroup = isCatalogListView(query);
+ const backTo = buildCatalogListUrl(MARKETPLACE_SKILL_PATH, { q });
+ const localLabel = t('catalog.yourSkills');
+ const title = isInstalledGroup
+ ? localLabel
+ : (categories.find((item) => item.key === category)?.label ??
+ (sort === SkillSorts.CreatedAt ? t('catalog.new') : t('catalog.allSkills')));
+ const renderLocalSkills = (skills: typeof localSkills) =>
+ skills.map((skill) => (
+ <AgentSkillItem
+ key={skill.id}
+ skill={skill}
+ onSelect={() => openDetail(buildInstalledDetailPath('skill', skill.id, 'agent-skill'))}
+ />
+ ));
return (
- <>
- <DiscoverCatalogHeader kind={'skill'} query={query.q} />
+ <div
+ {...stylex.props(
+ catalogStyles.frame,
+ (isInstalledGroup || isMarketGroup) && catalogStyles.groupFrame,
+ )}
+ >
+ <DiscoverCatalogHeader
+ group={isInstalledGroup || isMarketGroup ? { backTo, title } : undefined}
+ kind={'skill'}
+ sortControl={isMarketGroup && !isInstalledGroup ? <SortButton resetPage /> : undefined}
+ />
<CatalogViewTabs active={'discover'} kind={'skill'} />
- {isCatalogListView(query) ? <SkillCatalogList /> : <SkillCatalogGroups />}
- </>
+ {isInstalledGroup ? (
+ <CatalogListView
+ empty={<SkillEmpty search={Boolean(q)} />}
+ error={skillLibrary.error}
+ hasData={installed.length > 0}
+ isEmpty={localSkills.length === 0}
+ loading={skillLibrary.isLoading}
+ onRetry={() => void skillLibrary.mutate()}
+ >
+ {renderLocalSkills(localSkills)}
+ </CatalogListView>
+ ) : isMarketGroup ? (
+ <SkillCatalogList query={query} />
+ ) : (
+ <SkillCatalogGroups
+ q={q}
+ installedSection={
+ localSkills.length > 0 ? (
+ <CatalogSection
+ count={localSkills.length}
+ label={localLabel}
+ loading={false}
+ to={buildCatalogListUrl(MARKETPLACE_SKILL_PATH, { group: 'installed', q })}
+ >
+ {renderLocalSkills(localSkills.slice(0, CATALOG_SECTION_SIZE))}
+ </CatalogSection>
+ ) : undefined
+ }
+ />
+ )}
+ </div>
);
-});
-
-SkillCatalog.displayName = 'MarketplaceSkillCatalog';
+};
export default SkillCatalog;
diff --git a/src/features/Marketplace/Catalog/sections.test.ts b/src/features/Marketplace/Catalog/sections.test.ts
index aff3212e66f..09a01320f41 100644
--- a/src/features/Marketplace/Catalog/sections.test.ts
+++ b/src/features/Marketplace/Catalog/sections.test.ts
@@ -1,6 +1,11 @@
import { describe, expect, it } from 'vitest';
-import { buildCatalogListUrl, isCatalogListView, orderCategoriesByCount } from './sections';
+import {
+ buildCatalogListUrl,
+ catalogSearchParams,
+ isCatalogListView,
+ orderCategoriesByCount,
+} from './sections';
const categories = [
{ key: 'all', label: 'All' },
@@ -45,14 +50,39 @@ describe('buildCatalogListUrl', () => {
});
describe('isCatalogListView', () => {
- it('shows groups on the bare Discover page', () => {
+ it('shows groups on the bare Discover page and when searching across the catalog', () => {
+ const queryWithSearch = { category: undefined, q: 'pdf' };
expect(isCatalogListView({})).toBe(false);
+ expect(isCatalogListView(queryWithSearch)).toBe(false);
});
- it.each([{ category: 'docs' }, { q: 'pdf' }, { sort: 'createdAt' }, { page: 2 }])(
+ it.each([{ category: 'docs' }, { sort: 'createdAt' }, { page: 2 }])(
'shows one full list once narrowed by %o',
(query) => {
expect(isCatalogListView(query)).toBe(true);
},
);
});
+
+describe('catalogSearchParams', () => {
+ it('keeps category and ordering when searching from a later page', () => {
+ const params = new URLSearchParams('category=docs&sort=name&order=asc&page=3&q=old');
+
+ expect(catalogSearchParams(params, ' pdf parser ').toString()).toBe(
+ 'category=docs&sort=name&order=asc&q=pdf+parser',
+ );
+ expect(params.get('page')).toBe('3');
+ });
+
+ it('clears only the text and page inside a local group', () => {
+ const params = new URLSearchParams('group=integrations&q=github&page=2');
+
+ expect(catalogSearchParams(params, ' ').toString()).toBe('group=integrations');
+ });
+
+ it('includes the active search when linking to a category', () => {
+ expect(
+ buildCatalogListUrl('/marketplace/connector', { category: 'productivity', q: 'files' }),
+ ).toBe('/marketplace/connector?category=productivity&q=files');
+ });
+});
diff --git a/src/features/Marketplace/Catalog/sections.ts b/src/features/Marketplace/Catalog/sections.ts
index 963f106cc92..ab4c4e0da11 100644
--- a/src/features/Marketplace/Catalog/sections.ts
+++ b/src/features/Marketplace/Catalog/sections.ts
@@ -40,16 +40,25 @@ export const orderCategoriesByCount = <K extends string>(
/** The full list behind a group heading: the Discover path with its query. */
export const buildCatalogListUrl = (
path: string,
- query: { category?: string; sort?: string },
+ query: { category?: string; group?: string; q?: string; sort?: string; source?: string },
): string => qs.stringifyUrl({ query, url: path }, { skipEmptyString: true, skipNull: true });
/**
* The Discover page shows groups until the user narrows it: a category, a sort,
- * a search or a page number turns it into one full list.
+ * or a page number turns it into one full list.
*/
export const isCatalogListView = (query: {
category?: string;
page?: number | string;
- q?: string;
sort?: string;
-}): boolean => Boolean(query.category || query.q || query.sort || query.page);
+}): boolean => Boolean(query.category || query.sort || query.page);
+
+/** Editing a search keeps its current group and sort, but starts at page one. */
+export const catalogSearchParams = (params: URLSearchParams, keyword: string): URLSearchParams => {
+ const next = new URLSearchParams(params);
+ const query = keyword.trim();
+ next.delete('page');
+ if (query) next.set('q', query);
+ else next.delete('q');
+ return next;
+};
diff --git a/src/features/Marketplace/Catalog/styles.ts b/src/features/Marketplace/Catalog/styles.ts
index 4664b666c55..6119218fe0a 100644
--- a/src/features/Marketplace/Catalog/styles.ts
+++ b/src/features/Marketplace/Catalog/styles.ts
@@ -1,24 +1,35 @@
-import { media } from '@lobehub/ui/stylex/media.stylex';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
-/**
- * The Codex catalog geometry, shared with the installed list
- * (`Settings/skill/features/SkillList` page groups): a 16px group heading, then
- * a two-column grid of borderless rows; groups are separated by 32px of
- * whitespace, not rules.
- */
export const catalogStyles = stylex.create({
+ frame: {
+ alignSelf: 'center',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 32,
+ maxWidth: 880,
+ minWidth: 0,
+ width: { 'default': 'calc(100% - 16px)', '@media (max-width: 860px)': '100%' },
+ },
+ groupFrame: { gap: 16 },
grid: {
+ columnGap: 24,
display: 'grid',
- gridTemplateColumns: { default: 'repeat(2, minmax(0, 1fr))', [media.lg]: 'minmax(0, 1fr)' },
- columnGap: '16px',
- rowGap: '4px',
+ gridTemplateColumns: 'repeat(auto-fill, minmax(min(100%, 320px), 1fr))',
+ rowGap: 4,
+ },
+ section: {
+ borderBlockStartColor: cssVar.colorBorderSecondary,
+ borderBlockStartStyle: 'solid',
+ borderBlockStartWidth: 1,
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 12,
+ paddingBlockStart: 16,
},
- section: { display: 'flex', flexDirection: 'column', gap: '12px' },
sections: {
display: 'flex',
flexDirection: 'column',
- gap: '32px',
- paddingBlockStart: '8px',
+ gap: 24,
},
});
diff --git a/src/features/Marketplace/Catalog/useCatalogDetailNavigate.ts b/src/features/Marketplace/Catalog/useCatalogDetailNavigate.ts
new file mode 100644
index 00000000000..f73371d4634
--- /dev/null
+++ b/src/features/Marketplace/Catalog/useCatalogDetailNavigate.ts
@@ -0,0 +1,10 @@
+import { useLocation } from 'react-router';
+
+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+
+/** The detail header can return to the same category, query and page that opened it. */
+export const useCatalogDetailNavigate = () => {
+ const navigate = useWorkspaceAwareNavigate();
+ const { pathname, search } = useLocation();
+ return (to: string) => navigate(to, { state: { marketplaceCatalog: pathname + search } });
+};
diff --git a/src/features/Marketplace/Catalog/useCatalogIntegrations.tsx b/src/features/Marketplace/Catalog/useCatalogIntegrations.tsx
new file mode 100644
index 00000000000..676fa237e40
--- /dev/null
+++ b/src/features/Marketplace/Catalog/useCatalogIntegrations.tsx
@@ -0,0 +1,93 @@
+'use client';
+
+import isEqual from 'fast-deep-equal';
+import { useTranslation } from 'react-i18next';
+
+import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
+import ComposioSkillItem from '@/features/Settings/skill/features/ComposioSkillItem';
+import {
+ buildIntegrationItems,
+ matchesIntegrationKeyword,
+} from '@/features/Settings/skill/features/connectorSections';
+import LobehubSkillItem from '@/features/Settings/skill/features/LobehubSkillItem';
+import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';
+import { useToolStore } from '@/store/tool';
+import { composioStoreSelectors, lobehubSkillStoreSelectors } from '@/store/tool/selectors';
+import { ComposioServerStatus } from '@/store/tool/slices/composioStore';
+import { connectorSelectors, isIntegrationInConnectorTab } from '@/store/tool/slices/connector';
+import { LobehubSkillStatus } from '@/store/tool/slices/lobehubSkillStore/types';
+
+import { buildInstalledDetailPath, getInstalledVisibility } from '../InstalledNav';
+import { useCatalogDetailNavigate } from './useCatalogDetailNavigate';
+
+export const useCatalogIntegrations = (keyword?: string) => {
+ const { t } = useTranslation('setting');
+ const navigate = useCatalogDetailNavigate();
+ const visibility = getInstalledVisibility('connector', useActiveWorkspaceId(), null);
+ const composio = useServerConfigStore(serverConfigSelectors.enableComposio);
+ const lobehub = useServerConfigStore(serverConfigSelectors.enableLobehubSkill);
+
+ const useLobehubConnections = useToolStore((s) => s.useFetchLobehubSkillConnections);
+ const useComposioConnections = useToolStore((s) => s.useFetchUserComposioConnections);
+ useLobehubConnections(lobehub);
+ useComposioConnections(composio);
+
+ const connectors = useToolStore(connectorSelectors.connectorList, isEqual);
+ const lobehubServers = useToolStore(lobehubSkillStoreSelectors.getServers, isEqual);
+ const composioServers = useToolStore(composioStoreSelectors.getServers, isEqual);
+ const lobehubById = new Map(lobehubServers.map((server) => [server.identifier, server]));
+ const composioById = new Map(composioServers.map((server) => [server.identifier, server]));
+
+ const matches = buildIntegrationItems({
+ connectorAvailability: { composio, lobehub },
+ isComposioActive: (id) => composioById.get(id)?.status === ComposioServerStatus.ACTIVE,
+ isLobehubConnected: (id) => lobehubById.get(id)?.status === LobehubSkillStatus.CONNECTED,
+ }).filter((item) => {
+ if (!matchesIntegrationKeyword(item, keyword, t)) return false;
+ if (item.type === 'lobehub')
+ return isIntegrationInConnectorTab(item.provider.id, connectors, visibility);
+
+ const id = item.serverType.identifier;
+ return isIntegrationInConnectorTab(
+ id,
+ connectors,
+ visibility,
+ composioById.get(id)?.connectedAccountId,
+ );
+ });
+
+ return {
+ count: matches.length,
+ label: t('connectorMarket.section.lobehub'),
+ rows: (limit?: number) =>
+ matches.slice(0, limit).map((item) => {
+ if (item.type === 'lobehub') {
+ const id = item.provider.id;
+ return (
+ <LobehubSkillItem
+ showConnectLabel
+ key={id}
+ provider={item.provider}
+ server={lobehubById.get(id)}
+ onSelect={() =>
+ navigate(buildInstalledDetailPath('connector', id, 'lobehub-connector', visibility))
+ }
+ />
+ );
+ }
+
+ const id = item.serverType.identifier;
+ return (
+ <ComposioSkillItem
+ showConnectLabel
+ key={id}
+ server={composioById.get(id)}
+ serverType={item.serverType}
+ onSelect={() =>
+ navigate(buildInstalledDetailPath('connector', id, 'plugin', visibility))
+ }
+ />
+ );
+ }),
+ };
+};
diff --git a/src/features/Marketplace/InstalledNav.test.ts b/src/features/Marketplace/InstalledNav.test.ts
index 11defdedd75..80e8b78b380 100644
--- a/src/features/Marketplace/InstalledNav.test.ts
+++ b/src/features/Marketplace/InstalledNav.test.ts
@@ -5,29 +5,7 @@ vi.mock('@/business/client/hooks/useActiveWorkspaceId', () => ({
useActiveWorkspaceId: () => null,
}));
-const { buildInstalledDetailPath, getInstalledKind, getInstalledVisibility } =
- await import('./InstalledNav');
-
-describe('getInstalledKind', () => {
- it.each([
- ['skill', 'skill'],
- ['skill/installed', 'skill'],
- ['skill/some-skill', 'skill'],
- ['connector', 'connector'],
- ['connector/installed', 'connector'],
- // MCP detail pages belong to Connectors, which absorbed the MCP list.
- ['mcp/notion', 'connector'],
- ])('lists the installed library of %s', (subPath, kind) => {
- expect(getInstalledKind(subPath)).toBe(kind);
- });
-
- it.each([undefined, '', 'agent', 'model', 'provider/openai'])(
- 'lists nothing on %s',
- (subPath) => {
- expect(getInstalledKind(subPath)).toBeUndefined();
- },
- );
-});
+const { buildInstalledDetailPath, getInstalledVisibility } = await import('./InstalledNav');
describe('buildInstalledDetailPath', () => {
it('opens one installed item on its installed page', () => {
diff --git a/src/features/Marketplace/InstalledNav.tsx b/src/features/Marketplace/InstalledNav.tsx
index 15b29d6b4fe..30fbf821dd0 100644
--- a/src/features/Marketplace/InstalledNav.tsx
+++ b/src/features/Marketplace/InstalledNav.tsx
@@ -33,24 +33,6 @@ const INSTALLED_PATHS: Record<InstalledKind, string> = {
skill: MARKETPLACE_INSTALLED_SKILLS_PATH,
};
-/** The same pages as sub paths of the Marketplace root (`getMarketplaceSubPath`). */
-const INSTALLED_SUB_PATHS: Record<InstalledKind, string> = {
- connector: 'connector/installed',
- skill: 'skill/installed',
-};
-
-/**
- * Which library the sidebar lists for a Marketplace sub path: Skills pages
- * show installed skills; Connectors and MCP pages show installed connectors;
- * every other section (Home, Agents) has none.
- */
-export const getInstalledKind = (subPath?: string): InstalledKind | undefined => {
- const section = subPath?.split('/')[0];
- if (section === 'skill') return 'skill';
- if (section === 'connector' || section === 'mcp') return 'connector';
- return undefined;
-};
-
/**
* The workspace connector tab the sidebar lists, mirroring the installed page
* (`ToolSettings`): the shared pool unless that page is on its Private tab.
@@ -85,10 +67,7 @@ export const buildInstalledDetailPath = (
};
/**
- * The sidebar's `Installed` section, as in Codex Customize: under the
- * Skills / Connectors entries it lists what is already in the library for the
- * entry in view. A row opens that item's detail on the installed page; the
- * header action opens the full installed manager (search, import, add).
+ * Installed connectors stay in the Marketplace sidebar when the main section changes.
*/
const InstalledNav = memo(() => {
const { t } = useTranslation('discover');
@@ -98,30 +77,22 @@ const InstalledNav = memo(() => {
const sectionTriggerStyle = useSectionTriggerStyle();
const subPath = getMarketplaceSubPath(pathname);
- const kind = getInstalledKind(subPath);
- const onInstalledPage = !!kind && subPath === INSTALLED_SUB_PATHS[kind];
+ const onInstalledPage = subPath === getMarketplaceSubPath(MARKETPLACE_INSTALLED_CONNECTORS_PATH);
const selectedIdentifier = onInstalledPage
? parseMobileSelection(searchParams.get(MOBILE_SELECTION_PARAM))?.identifier
: undefined;
const workspaceId = useActiveWorkspaceId();
const visibility = getInstalledVisibility(
- kind,
+ 'connector',
workspaceId,
onInstalledPage ? searchParams.get('visibility') : null,
);
const handleSelect = useCallback(
(identifier: string, type: ToolDetailType) => {
- if (!kind) return;
- navigate(buildInstalledDetailPath(kind, identifier, type, visibility));
+ navigate(buildInstalledDetailPath('connector', identifier, type, visibility));
},
- [kind, navigate, visibility],
- );
-
- if (!kind) return null;
-
- const manageLabel = t(
- kind === 'skill' ? 'catalog.manageInstalledSkills' : 'catalog.manageInstalledConnectors',
+ [navigate, visibility],
);
return (
@@ -132,12 +103,12 @@ const InstalledNav = memo(() => {
active={onInstalledPage && !selectedIdentifier}
icon={SlidersHorizontalIcon}
size={'small'}
- title={manageLabel}
+ title={t('catalog.manageInstalledConnectors')}
onClick={() =>
navigate(
visibility === 'private'
- ? `${INSTALLED_PATHS[kind]}?visibility=private`
- : INSTALLED_PATHS[kind],
+ ? `${MARKETPLACE_INSTALLED_CONNECTORS_PATH}?visibility=private`
+ : MARKETPLACE_INSTALLED_CONNECTORS_PATH,
)
}
/>
@@ -145,10 +116,8 @@ const InstalledNav = memo(() => {
<SkillListVariantProvider value={'nav'}>
<SkillList
installedOnly
- // Remount per library so the connector and skill lists keep no state across.
- key={kind}
selectedIdentifier={selectedIdentifier}
- viewMode={kind}
+ viewMode={'connector'}
visibility={visibility}
onSelect={handleSelect}
/>
diff --git a/src/features/Marketplace/paths.test.ts b/src/features/Marketplace/paths.test.ts
index 98ed5e46fde..49a5c33a86d 100644
--- a/src/features/Marketplace/paths.test.ts
+++ b/src/features/Marketplace/paths.test.ts
@@ -34,7 +34,8 @@ describe('hasCatalogPageHeader', () => {
['/marketplace/skill', true],
['/workspace/marketplace/connector/', true],
['/marketplace', false],
- ['/marketplace/agent', false],
+ ['/marketplace/agent', true],
+ ['/workspace/marketplace/agent/example', false],
['/marketplace/skill/installed', false],
['/marketplace/skill/example', false],
['/marketplace/mcp/example', false],
diff --git a/src/features/Marketplace/paths.ts b/src/features/Marketplace/paths.ts
index 120de5ec87c..cbc62b1277e 100644
--- a/src/features/Marketplace/paths.ts
+++ b/src/features/Marketplace/paths.ts
@@ -48,10 +48,10 @@ export const getMarketplaceSubPath = (pathname: string): string | undefined => {
return segments.slice(index + 1).join('/');
};
-// These two catalog pages render their own search and actions in the content header.
+// The catalog pages render their own search and actions in the content header.
export const hasCatalogPageHeader = (pathname: string): boolean => {
const section = getMarketplaceSubPath(pathname);
- return section === 'skill' || section === 'connector';
+ return section === 'agent' || section === 'skill' || section === 'connector';
};
/**
diff --git a/src/features/Settings/skill/features/ComposioSkillItem.tsx b/src/features/Settings/skill/features/ComposioSkillItem.tsx
index faced463fd5..47271fff1dc 100644
--- a/src/features/Settings/skill/features/ComposioSkillItem.tsx
+++ b/src/features/Settings/skill/features/ComposioSkillItem.tsx
@@ -36,15 +36,17 @@ const POLL_INTERVAL_MS = 1000;
const POLL_TIMEOUT_MS = 15_000;
interface ComposioSkillItemProps {
+ hideConnectedStatus?: boolean;
isSelected?: boolean;
onDelete?: () => void;
onSelect?: () => void;
server?: ComposioServer;
serverType: ComposioAppType;
+ showConnectLabel?: boolean;
}
const ComposioSkillItem = memo<ComposioSkillItemProps>(
- ({ serverType, server, isSelected, onSelect }) => {
+ ({ hideConnectedStatus, serverType, server, isSelected, onSelect, showConnectLabel }) => {
const { t } = useTranslation('setting');
const isPage = useSkillListVariant() === 'page';
const { allowed: canCreate, reason: createReason } = usePermission('create_content');
@@ -387,6 +389,8 @@ const ComposioSkillItem = memo<ComposioSkillItemProps>(
// A restricted or stale (pending / errored) connection keeps its explicit
// control, since a bare `+` would not say why the first try did not stick.
const renderPageExtra = () => {
+ if (isConnected && showConnectLabel)
+ return <ConnectedStatus label={t('tools.composio.connected')} />;
if (isConnected)
return (
<RowMoreMenu
@@ -409,6 +413,7 @@ const ComposioSkillItem = memo<ComposioSkillItemProps>(
disabledReason={!canCreate ? createReason : editReason}
label={t('connectorMarket.action.connect')}
loading={isConnecting || isWaitingAuth}
+ showLabel={showConnectLabel}
onClick={handleConnect}
/>
);
@@ -421,6 +426,7 @@ const ComposioSkillItem = memo<ComposioSkillItemProps>(
return <Button disabled loading size="small" type="text" />;
}
if (isConnected) {
+ if (hideConnectedStatus) return null;
return <ConnectedStatus label={t('tools.composio.connected')} />;
}
if (isRestricted) {
diff --git a/src/features/Settings/skill/features/LobehubSkillItem.tsx b/src/features/Settings/skill/features/LobehubSkillItem.tsx
index 3837e0effc9..b13e3d8ab8b 100644
--- a/src/features/Settings/skill/features/LobehubSkillItem.tsx
+++ b/src/features/Settings/skill/features/LobehubSkillItem.tsx
@@ -35,15 +35,17 @@ const POLL_INTERVAL_MS = 1000;
const POLL_TIMEOUT_MS = 15_000;
interface LobehubSkillItemProps {
+ hideConnectedStatus?: boolean;
isSelected?: boolean;
onDelete?: () => void;
onSelect?: () => void;
provider: LobehubSkillProviderType;
server?: LobehubSkillServer;
+ showConnectLabel?: boolean;
}
const LobehubSkillItem = memo<LobehubSkillItemProps>(
- ({ provider, server, isSelected, onSelect, onDelete }) => {
+ ({ hideConnectedStatus, provider, server, isSelected, onSelect, onDelete, showConnectLabel }) => {
const { t } = useTranslation('setting');
const isPage = useSkillListVariant() === 'page';
const { allowed: canCreate, reason: createReason } = usePermission('create_content');
@@ -323,6 +325,8 @@ const LobehubSkillItem = memo<LobehubSkillItemProps>(
// Page row: a quiet `+` connects in place; once connected the row's state
// reads from its position (Installed) and the action becomes the manage menu.
const renderPageExtra = () => {
+ if (isConnected && showConnectLabel)
+ return <ConnectedStatus label={t('tools.lobehubSkill.connected')} />;
if (isConnected)
return (
<RowMoreMenu
@@ -345,6 +349,7 @@ const LobehubSkillItem = memo<LobehubSkillItemProps>(
disabledReason={!canCreate ? createReason : editReason}
label={t('connectorMarket.action.connect')}
loading={isConnecting || isWaitingAuth}
+ showLabel={showConnectLabel}
onClick={handleConnect}
/>
);
@@ -356,6 +361,7 @@ const LobehubSkillItem = memo<LobehubSkillItemProps>(
return <Button disabled loading size="small" type="text" />;
}
if (isConnected) {
+ if (hideConnectedStatus) return null;
return (
<ConnectedStatus
label={t('tools.lobehubSkill.connected', { defaultValue: 'Connected' })}
diff --git a/src/features/Settings/skill/features/RowActions.tsx b/src/features/Settings/skill/features/RowActions.tsx
index f86166ab58e..0ee7c3cb306 100644
--- a/src/features/Settings/skill/features/RowActions.tsx
+++ b/src/features/Settings/skill/features/RowActions.tsx
@@ -1,6 +1,6 @@
'use client';
-import { ActionIcon, type DropdownItem, DropdownMenu, Icon } from '@lobehub/ui';
+import { ActionIcon, Button, type DropdownItem, DropdownMenu, Icon } from '@lobehub/ui';
import { MoreHorizontalIcon, PanelRightOpen, Plus } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -13,6 +13,7 @@ interface RowAddActionProps {
label: string;
loading?: boolean;
onClick: () => void;
+ showLabel?: boolean;
}
/**
@@ -20,19 +21,37 @@ interface RowAddActionProps {
* that connects or installs in place. Once added it becomes {@link RowMoreMenu}.
*/
export const RowAddAction = memo<RowAddActionProps>(
- ({ disabled, disabledReason, label, loading, onClick }) => (
- <ActionIcon
- aria-label={label}
- disabled={disabled || loading}
- icon={Plus}
- loading={loading}
- title={disabled && disabledReason ? disabledReason : label}
- onClick={(event) => {
- event.stopPropagation();
- onClick();
- }}
- />
- ),
+ ({ disabled, disabledReason, label, loading, onClick, showLabel }) => {
+ const handleClick = (event: React.MouseEvent) => {
+ event.stopPropagation();
+ onClick();
+ };
+
+ if (showLabel)
+ return (
+ <Button
+ disabled={disabled || loading}
+ icon={Plus}
+ loading={loading}
+ size={'small'}
+ title={disabled ? disabledReason : undefined}
+ onClick={handleClick}
+ >
+ {label}
+ </Button>
+ );
+
+ return (
+ <ActionIcon
+ aria-label={label}
+ disabled={disabled || loading}
+ icon={Plus}
+ loading={loading}
+ title={disabled && disabledReason ? disabledReason : label}
+ onClick={handleClick}
+ />
+ );
+ },
);
RowAddAction.displayName = 'RowAddAction';
diff --git a/src/features/Settings/skill/features/SkillList.tsx b/src/features/Settings/skill/features/SkillList.tsx
index 9eeecb07df8..e79e18249df 100644
--- a/src/features/Settings/skill/features/SkillList.tsx
+++ b/src/features/Settings/skill/features/SkillList.tsx
@@ -111,12 +111,6 @@ interface SkillListProps {
installedOnly?: boolean;
/** Page search: filters every group by name, identifier and description. */
keyword?: string;
- /**
- * Page mode for the Connectors Discover page: only LobeHub's own OAuth
- * connectors (LobeHub / Composio integrations), connected or not, as one
- * group. The installed manager then leaves out the ones not connected yet.
- */
- lobehubConnectors?: boolean;
onClearKeyword?: () => void;
onDeleteSelected?: () => void;
onSelect?: (identifier: string, type: ToolDetailType) => void;
@@ -135,7 +129,6 @@ interface SkillListProps {
const SkillList = memo<SkillListProps>(
({
installedOnly,
- lobehubConnectors,
keyword,
onClearKeyword,
onSelect,
@@ -362,8 +355,6 @@ const SkillList = memo<SkillListProps>(
}
if (!hasAnySkills) {
- // The Discover group has nothing to lead with; the page's other groups carry on.
- if (lobehubConnectors) return null;
return (
<>
{header}
@@ -414,6 +405,7 @@ const SkillList = memo<SkillListProps>(
case 'lobehub': {
return (
<LobehubSkillItem
+ hideConnectedStatus={installedOnly}
isSelected={selectedIdentifier === item.provider.id}
key={item.provider.id}
provider={item.provider}
@@ -428,6 +420,7 @@ const SkillList = memo<SkillListProps>(
case 'composio': {
return (
<ComposioSkillItem
+ hideConnectedStatus={installedOnly}
isSelected={selectedIdentifier === item.serverType.identifier}
key={item.serverType.identifier}
server={getComposioServerByIdentifier(item.serverType.identifier)}
@@ -534,38 +527,6 @@ const SkillList = memo<SkillListProps>(
const isConnected = (item: IntegrationItem) => isIntegrationConnected(item, connectionState);
const oauth = partitionByInstalled(communitySkillItems, isConnected);
- // Connectors Discover: LobeHub's OAuth connectors lead the page as one
- // group, connected ones keeping their status and menu (Codex `⋯`).
- if (lobehubConnectors) {
- if (communitySkillItems.length === 0) return null;
- const key = 'lobehubConnectors';
- const isExpanded = expanded.has(key);
- const { hiddenCount, visible } = getVisibleSectionItems(
- communitySkillItems.map(renderIntegration),
- isExpanded,
- );
- return (
- <section {...stylex.props(styles.pageSection)}>
- <PageSectionHeading
- expanded={isExpanded}
- label={t('connectorMarket.section.lobehub')}
- expandable={isSectionExpandable({
- expanded: isExpanded,
- hiddenCount,
- searching: false,
- })}
- toggleLabel={
- isExpanded
- ? t('connectorMarket.section.showLess')
- : `${t('connectorMarket.section.showAll')} (${communitySkillItems.length})`
- }
- onToggle={() => toggleExpanded(key)}
- />
- <div {...stylex.props(styles.pageGrid)}>{visible}</div>
- </section>
- );
- }
-
const sections = (
isConnectorView
? [
@@ -576,7 +537,7 @@ const SkillList = memo<SkillListProps>(
},
{
// With the market on, the ones left to connect lead the
- // Connectors Discover page (`lobehubConnectors`) instead.
+ // Connectors Discover page instead.
items: showMarket ? [] : oauth.available.map(renderIntegration),
key: 'communityConnectors',
label: t('skillGroup.communityConnectors', 'OAuth Connectors'),
diff --git a/src/features/Settings/skill/features/SkillListRow.tsx b/src/features/Settings/skill/features/SkillListRow.tsx
index 7643c9e62d6..a8d4487280b 100644
--- a/src/features/Settings/skill/features/SkillListRow.tsx
+++ b/src/features/Settings/skill/features/SkillListRow.tsx
@@ -11,15 +11,15 @@ import { useInterfaceDensity } from '@/styles/density';
/**
* `nav` is the compact sidebar row beside a detail pane; `page` is the
- * full-width list a row opens a second-level page from.
+ * full-width management list, and `catalog` is the Marketplace discovery list.
*/
-export type SkillListVariant = 'nav' | 'page';
+type SkillListVariant = 'nav' | 'page' | 'catalog';
const SkillListVariantContext = createContext<SkillListVariant>('nav');
export const SkillListVariantProvider = SkillListVariantContext.Provider;
-export const useSkillListVariant = () => use(SkillListVariantContext);
+export const useSkillListVariant = () => (use(SkillListVariantContext) === 'nav' ? 'nav' : 'page');
const styles = stylex.create({
// A borderless row in a two-column catalog (the Codex Plugins row): a 36px
@@ -41,6 +41,10 @@ const styles = stylex.create({
height: 32,
width: 32,
},
+ iconTileCatalog: {
+ height: 40,
+ width: 40,
+ },
row: {
minHeight: 64,
minWidth: 0,
@@ -48,6 +52,9 @@ const styles = stylex.create({
rowCompact: {
minHeight: 48,
},
+ rowCatalog: {
+ minHeight: 60,
+ },
trailing: {
alignItems: 'center',
display: 'flex',
@@ -58,6 +65,7 @@ const styles = stylex.create({
interface SkillListRowProps {
active?: boolean;
+ agentType?: 'agent' | 'agent-group';
/** Feedback line (connect error, ask an admin); shown in both variants. */
description?: ReactNode;
extra?: ReactNode;
@@ -72,8 +80,20 @@ interface SkillListRowProps {
}
const SkillListRow = memo<SkillListRowProps>(
- ({ active, description, extra, icon, onClick, summary, testId, title, titleColor }) => {
- const variant = useSkillListVariant();
+ ({
+ active,
+ agentType,
+ description,
+ extra,
+ icon,
+ onClick,
+ summary,
+ testId,
+ title,
+ titleColor,
+ }) => {
+ const variant = use(SkillListVariantContext);
+ const isCatalog = variant === 'catalog';
const compact = useInterfaceDensity() === 'compact';
if (variant === 'nav')
@@ -95,18 +115,23 @@ const SkillListRow = memo<SkillListRowProps>(
<Block
horizontal
align={'center'}
- {...stylex.props(styles.row, compact && styles.rowCompact)}
+ {...stylex.props(styles.row, compact && styles.rowCompact, isCatalog && styles.rowCatalog)}
clickable={!!onClick}
+ data-agent-type={agentType}
data-testid={testId}
gap={12}
- // 8px around the 22 + 2 + 22px text stack sits inside the 64px floor,
- // so rows repeat every 68px (64 + the grid's 4px gap) as in Codex.
- paddingBlock={compact ? 6 : 8}
- paddingInline={12}
+ paddingBlock={compact && !isCatalog ? 6 : 8}
+ paddingInline={isCatalog ? 8 : 12}
variant={'borderless'}
onClick={onClick}
>
- <Center {...stylex.props(styles.iconTile, compact && styles.iconTileCompact)}>
+ <Center
+ {...stylex.props(
+ styles.iconTile,
+ compact && styles.iconTileCompact,
+ isCatalog && styles.iconTileCatalog,
+ )}
+ >
<IconNode />
</Center>
<Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>
diff --git a/src/features/Settings/skill/index.tsx b/src/features/Settings/skill/index.tsx
index ddd0cc274fe..67c92f30eb9 100644
--- a/src/features/Settings/skill/index.tsx
+++ b/src/features/Settings/skill/index.tsx
@@ -126,7 +126,8 @@ export const ToolSettings = memo<ToolSettingsProps>(({ headerExtra, viewMode })
const closeStackedDetail = () => {
// Pop the entry this page pushed, so history keeps one list entry; a
// deep-linked detail has none to pop and is replaced by the list instead.
- if ((location.state as Record<string, unknown> | null)?.[PUSHED_DETAIL_STATE]) {
+ const state = location.state as Record<string, unknown> | null;
+ if (state?.[PUSHED_DETAIL_STATE] || typeof state?.marketplaceCatalog === 'string') {
navigate(-1);
return;
}
diff --git a/src/routes/(main)/community/(detail)/_layout/Header.tsx b/src/routes/(main)/community/(detail)/_layout/Header.tsx
index f66e40362b2..8a8bba8cbd6 100644
--- a/src/routes/(main)/community/(detail)/_layout/Header.tsx
+++ b/src/routes/(main)/community/(detail)/_layout/Header.tsx
@@ -4,10 +4,11 @@ import { ActionIcon, cssVar, Flexbox } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
import { ArrowLeft } from 'lucide-react';
import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
import { useLocation } from 'react-router';
import urlJoin from 'url-join';
-import { MARKETPLACE_SEGMENT } from '@/features/Marketplace/paths';
+import { MARKETPLACE_CONNECTOR_PATH, MARKETPLACE_SEGMENT } from '@/features/Marketplace/paths';
import NavHeader from '@/features/NavHeader';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import StoreSearchBar from '@/routes/(main)/community/features/Search';
@@ -18,6 +19,7 @@ import { userSelectors } from '@/store/discover/selectors';
import { styles } from './Header/style';
const Header = memo(() => {
+ const { t } = useTranslation('common');
const location = useLocation();
const navigate = useWorkspaceAwareNavigate();
const path = location.pathname.split('/').filter(Boolean);
@@ -37,6 +39,15 @@ const Header = memo(() => {
detailProfile?.user.avatarUrl || detailProfile?.user.userName || detailProfile?.user.namespace;
const handleGoBack = () => {
+ const catalog = location.state?.marketplaceCatalog;
+ if (typeof catalog === 'string') {
+ navigate(catalog, { escape: true, replace: true });
+ return;
+ }
+ if (detailType === 'mcp') {
+ navigate(MARKETPLACE_CONNECTOR_PATH);
+ return;
+ }
// group_agent goes back to agent list page
if (detailType === 'group_agent') {
navigate('/marketplace/agent');
@@ -65,7 +76,7 @@ const Header = memo(() => {
style={cssVariables}
left={
<Flexbox horizontal align={'center'} flex={1} gap={8}>
- <ActionIcon icon={ArrowLeft} size={'small'} onClick={handleGoBack} />
+ <ActionIcon icon={ArrowLeft} size={'small'} title={t('back')} onClick={handleGoBack} />
<StoreSearchBar />
</Flexbox>
}
diff --git a/src/routes/(main)/community/(detail)/mcp/features/Sidebar/ActionButton/index.tsx b/src/routes/(main)/community/(detail)/mcp/features/Sidebar/ActionButton/index.tsx
index 10ae96f2a5c..3b3403a2b16 100644
--- a/src/routes/(main)/community/(detail)/mcp/features/Sidebar/ActionButton/index.tsx
+++ b/src/routes/(main)/community/(detail)/mcp/features/Sidebar/ActionButton/index.tsx
@@ -1,97 +1,11 @@
'use client';
-import { Button, Flexbox, Icon } from '@lobehub/ui';
-import { Trash2Icon } from 'lucide-react';
-import { memo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import MCPInstallProgress from '@/features/MCP/MCPInstallProgress';
import { useDetailContext } from '@/features/MCPPluginDetail/DetailProvider';
-import { usePermission } from '@/hooks/usePermission';
-import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
-import { useToolStore } from '@/store/tool';
-import { pluginSelectors } from '@/store/tool/slices/plugin/selectors';
-
-const ActionButton = memo(() => {
- const { t } = useTranslation(['discover', 'plugin']);
- const detailContext = useDetailContext();
- const { identifier, haveCloudEndpoint } = detailContext;
- const [isLoading, setIsLoading] = useState(false);
- const { allowed: canCreate } = usePermission('create_content');
- const { allowed: canEdit } = usePermission('edit_own_content');
- const { isAuthenticated, isLoading: isAuthLoading, signIn } = useMarketAuth();
-
- const [installed, installMCPPlugin, uninstallMCPPlugin] = useToolStore((s) => [
- pluginSelectors.isPluginInstalled(identifier!)(s),
- s.installMCPPlugin,
- s.uninstallMCPPlugin,
- ]);
-
- // Check if this is a cloud MCP plugin
- const isCloudMcp = haveCloudEndpoint;
-
- const installPlugin = async () => {
- if (!canCreate || !canEdit) return;
- if (!identifier) return;
-
- // If this is a cloud MCP and user is not authenticated, request authorization first
- if (isCloudMcp && !isAuthenticated) {
- try {
- await signIn('mcp');
- } catch {
- return; // Don't proceed with installation if auth fails
- }
- }
-
- // Proceed with installation
- setIsLoading(true);
- try {
- await installMCPPlugin(identifier);
- } finally {
- setIsLoading(false);
- }
- };
-
- const buttonLoading = isLoading || isAuthLoading;
-
- return installed ? (
- <Flexbox horizontal gap={8}>
- <Button block disabled={buttonLoading} size={'large'} type={'default'}>
- {t('plugins.installed')}
- </Button>
+import { MarketMcpInstallActions } from '@/features/MCPPluginDetail/MarketMcpInstallActions';
- <Button
- disabled={!canEdit}
- icon={<Icon icon={Trash2Icon} size={20} />}
- loading={buttonLoading}
- size={'large'}
- style={{ minWidth: 45 }}
- styles={{
- icon: { height: 20 },
- }}
- onClick={async () => {
- if (!canEdit) return;
- setIsLoading(true);
- await uninstallMCPPlugin(identifier!);
- setIsLoading(false);
- }}
- />
- </Flexbox>
- ) : (
- <>
- <Button
- block
- disabled={!canCreate || !canEdit}
- loading={buttonLoading}
- size={'large'}
- type={'primary'}
- onClick={installPlugin}
- >
- {t('plugins.install')}
- </Button>
- <MCPInstallProgress identifier={identifier!} />
- </>
- );
-});
+const ActionButton = () => {
+ const { haveCloudEndpoint, identifier } = useDetailContext();
+ return <MarketMcpInstallActions haveCloudEndpoint={haveCloudEndpoint} identifier={identifier} />;
+};
export default ActionButton;
diff --git a/src/routes/(main)/community/(detail)/skill/index.tsx b/src/routes/(main)/community/(detail)/skill/index.tsx
index 83593c528d0..bf15f967a98 100644
--- a/src/routes/(main)/community/(detail)/skill/index.tsx
+++ b/src/routes/(main)/community/(detail)/skill/index.tsx
@@ -2,7 +2,7 @@
import { Flexbox } from '@lobehub/ui';
import { memo, useCallback } from 'react';
-import { useParams, useSearchParams } from 'react-router';
+import { useLocation, useParams, useSearchParams } from 'react-router';
import AsyncError from '@/components/AsyncError';
import { RouteLoading } from '@/components/Skeleton/RouteSegment';
@@ -32,6 +32,7 @@ const SkillDetailPage = memo<SkillDetailPageProps>(({ mobile }) => {
const { version } = useQuery() as { version?: string };
const [searchParams, setSearchParams] = useSearchParams();
+ const { state } = useLocation();
const activeTabParam = searchParams.get('activeTab');
const activeTab = Object.values(SkillNavKey).includes(activeTabParam as SkillNavKey)
? (activeTabParam as SkillNavKey)
@@ -45,9 +46,9 @@ const SkillDetailPage = memo<SkillDetailPageProps>(({ mobile }) => {
} else {
next.set('activeTab', tab);
}
- setSearchParams(next, { replace: true });
+ setSearchParams(next, { replace: true, state });
},
- [searchParams, setSearchParams],
+ [searchParams, setSearchParams, state],
);
const useSkillDetail = useDiscoverStore((s) => s.useFetchSkillDetail);
diff --git a/src/routes/(main)/community/(list)/_layout/index.tsx b/src/routes/(main)/community/(list)/_layout/index.tsx
index 3aaeb4b2c2b..92f1f6683f3 100644
--- a/src/routes/(main)/community/(list)/_layout/index.tsx
+++ b/src/routes/(main)/community/(list)/_layout/index.tsx
@@ -5,7 +5,7 @@ import { Outlet } from 'react-router';
import WideScreenContainer from '@/features/WideScreenContainer';
import { RouteSkeletonChromeProvider } from '@/spa/router/routeSkeletonChrome';
-import { MAX_WIDTH } from '../../features/const';
+import { MAX_WIDTH, SCROLL_PARENT_ID } from '../../features/const';
import Footer from './Footer';
import Header from './Header';
import { styles } from './style';
@@ -17,6 +17,7 @@ const Layout = () => {
<Flexbox
className={stylex.props(styles.mainContainer).className}
height={'100%'}
+ id={SCROLL_PARENT_ID}
width={'100%'}
>
<WideScreenContainer
diff --git a/src/routes/(main)/community/(list)/agent/_layout/index.tsx b/src/routes/(main)/community/(list)/agent/_layout/index.tsx
deleted file mode 100644
index ef40d5c69a5..00000000000
--- a/src/routes/(main)/community/(list)/agent/_layout/index.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { Flexbox } from '@lobehub/ui';
-import * as stylex from '@stylexjs/stylex';
-import { Outlet } from 'react-router';
-
-import CategoryContainer from '../../../components/CategoryContainer';
-import Category from '../features/Category';
-import { styles } from './style';
-
-const Layout = () => {
- return (
- <Flexbox
- horizontal
- className={stylex.props(styles.mainContainer).className}
- gap={24}
- width={'100%'}
- >
- <CategoryContainer>
- <Category />
- </CategoryContainer>
- <Flexbox flex={1} gap={16}>
- <Outlet />
- </Flexbox>
- </Flexbox>
- );
-};
-
-export default Layout;
diff --git a/src/routes/(main)/community/(list)/agent/_layout/style.ts b/src/routes/(main)/community/(list)/agent/_layout/style.ts
deleted file mode 100644
index 733bb4280ea..00000000000
--- a/src/routes/(main)/community/(list)/agent/_layout/style.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import * as stylex from '@stylexjs/stylex';
-
-export const styles = stylex.create({
- // Main container
- mainContainer: { position: 'relative' },
-});
diff --git a/src/routes/(main)/community/(list)/agent/features/Category/index.tsx b/src/routes/(main)/community/(list)/agent/features/Category/index.tsx
deleted file mode 100644
index 22a82894700..00000000000
--- a/src/routes/(main)/community/(list)/agent/features/Category/index.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-'use client';
-
-import { Icon, Tag } from '@lobehub/ui';
-import qs from 'query-string';
-import { memo, useMemo } from 'react';
-
-import { withSuspense } from '@/components/withSuspense';
-import { buildAssistantListQuery } from '@/features/CommunityAgentList/assistantListQuery';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-import { useQuery } from '@/hooks/useQuery';
-import { SCROLL_PARENT_ID } from '@/routes/(main)/community/features/const';
-import { useDiscoverStore } from '@/store/discover';
-import { assistantSelectors } from '@/store/discover/selectors';
-import { AssistantCategory, type AssistantQueryParams, AssistantSorts } from '@/types/discover';
-
-import CategoryMenu from '../../../../components/CategoryMenu';
-import { useCategory } from './useCategory';
-
-const Category = memo(() => {
- const useAssistantCategories = useDiscoverStore((s) => s.useFetchAssistantCategories);
- const useAssistantList = useDiscoverStore((s) => s.useFetchAssistantList);
- const query = useQuery() as AssistantQueryParams;
- const { category = AssistantCategory.Discover, q, source } = query;
- const { queryKey } = useAssistantList(buildAssistantListQuery(query));
- const data = useDiscoverStore(assistantSelectors.assistantList(queryKey));
- // Fallback counts while the list entry converges: the categories query is
- // keyed by `q` + `source` only, so switching category keeps its rows on screen
- // (the replica replacement for the old SWR `keepPreviousData`).
- const shouldLoadFallbackCategories = data?.categoryCounts === undefined;
- const { queryKey: categoriesQueryKey } = useAssistantCategories(
- { q, source },
- { enabled: shouldLoadFallbackCategories },
- );
- const fallbackItems = useDiscoverStore(
- assistantSelectors.assistantCategories(categoriesQueryKey),
- );
- const items = data?.categoryCounts ?? fallbackItems;
- const navigate = useWorkspaceAwareNavigate();
- const cates = useCategory();
-
- const genUrl = (key: AssistantCategory) =>
- qs.stringifyUrl(
- {
- query: {
- category: key === AssistantCategory.Discover ? null : key,
- q,
- sort: key === AssistantCategory.Discover ? AssistantSorts.Recommended : null,
- },
- url: '/marketplace/agent',
- },
- { skipNull: true },
- );
-
- const handleClick = (key: AssistantCategory) => {
- navigate(genUrl(key));
- const scrollableElement = document?.querySelector(`#${SCROLL_PARENT_ID}`);
- if (!scrollableElement) return;
- scrollableElement.scrollTo({ behavior: 'smooth', top: 0 });
- };
-
- const total = useMemo(() => items.reduce((acc, item) => acc + item.count, 0), [items]);
-
- return (
- <CategoryMenu
- mode={'inline'}
- selectedKeys={[category]}
- items={cates.map((item) => {
- const itemData = items.find((i) => i.category === item.key);
- return {
- extra:
- item.key === 'all'
- ? total > 0 && (
- <Tag
- size={'small'}
- style={{
- borderRadius: 12,
- paddingInline: 6,
- }}
- >
- {total}
- </Tag>
- )
- : itemData && (
- <Tag
- size={'small'}
- style={{
- borderRadius: 12,
- paddingInline: 6,
- }}
- >
- {itemData.count}
- </Tag>
- ),
- ...item,
- icon: <Icon icon={item.icon} size={18} />,
- label: <WorkspaceLink to={genUrl(item.key)}>{item.label}</WorkspaceLink>,
- };
- })}
- onClick={(v) => handleClick(v.key as AssistantCategory)}
- />
- );
-});
-
-export default withSuspense(Category);
diff --git a/src/routes/(main)/community/(list)/agent/index.tsx b/src/routes/(main)/community/(list)/agent/index.tsx
index dee57f43a46..7443753b81c 100644
--- a/src/routes/(main)/community/(list)/agent/index.tsx
+++ b/src/routes/(main)/community/(list)/agent/index.tsx
@@ -1,54 +1 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { memo } from 'react';
-
-import AsyncBoundary from '@/components/AsyncBoundary';
-import { RouteLoading } from '@/components/Skeleton/RouteSegment';
-import { buildAssistantListQuery } from '@/features/CommunityAgentList/assistantListQuery';
-import { useQuery } from '@/hooks/useQuery';
-import { useDiscoverStore } from '@/store/discover';
-import { assistantSelectors } from '@/store/discover/selectors';
-import { type AssistantQueryParams } from '@/types/discover';
-import { DiscoverTab } from '@/types/discover';
-
-import AssistantEmpty from '../../features/AssistantEmpty';
-import Pagination from '../features/Pagination';
-import List from './features/List';
-
-const AssistantPage = memo(() => {
- const query = useQuery() as AssistantQueryParams;
- const useAssistantList = useDiscoverStore((s) => s.useFetchAssistantList);
- const { error, isLoading, mutate, queryKey } = useAssistantList(buildAssistantListQuery(query));
- // The replica view of this query; the sync hook only reports the fetch flags.
- const data = useDiscoverStore(assistantSelectors.assistantList(queryKey));
-
- const items = data?.items ?? [];
-
- return (
- <AsyncBoundary
- data={data}
- empty={<AssistantEmpty />}
- error={error}
- errorVariant={'page'}
- isEmpty={items.length === 0}
- isLoading={isLoading}
- loading={<RouteLoading />}
- onRetry={() => mutate()}
- >
- {data && (
- <Flexbox gap={32} width={'100%'}>
- <List data={items} />
- <Pagination
- currentPage={data.currentPage}
- pageSize={data.pageSize}
- tab={DiscoverTab.Assistants}
- total={data.totalCount}
- />
- </Flexbox>
- )}
- </AsyncBoundary>
- );
-});
-
-export default AssistantPage;
+export { AgentCatalog as default } from '@/features/Marketplace/Catalog/AgentCatalog';
diff --git a/src/routes/(main)/community/(list)/features/SortButton/index.tsx b/src/routes/(main)/community/(list)/features/SortButton/index.tsx
index ade58e8584e..561a0fa33e7 100644
--- a/src/routes/(main)/community/(list)/features/SortButton/index.tsx
+++ b/src/routes/(main)/community/(list)/features/SortButton/index.tsx
@@ -1,7 +1,7 @@
import { type DropdownItem, type DropdownMenuCheckboxItem } from '@lobehub/ui';
import { Button, DropdownMenu, Icon } from '@lobehub/ui';
import { ArrowDownWideNarrow, ChevronDown } from 'lucide-react';
-import { memo, useMemo } from 'react';
+import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { getMarketplaceSubPath } from '@/features/Marketplace/paths';
@@ -19,7 +19,7 @@ import {
import { MARKETPLACE_CONNECTOR_TAB } from '../../../features/useNav';
-const SortButton = memo(() => {
+const SortButton = memo<{ resetPage?: boolean }>(({ resetPage }) => {
const { t } = useTranslation('discover');
const pathname = usePathname();
const { sort } = useQuery();
@@ -183,9 +183,12 @@ const SortButton = memo(() => {
return items[0];
}, [items, sort]);
- const handleSort = (config: string) => {
- router.push(pathname, { query: { sort: config } });
- };
+ const handleSort = useCallback(
+ (config: string) => {
+ router.push(pathname, { query: { ...(resetPage ? { page: null } : {}), sort: config } });
+ },
+ [pathname, resetPage, router],
+ );
const menuItems = useMemo<DropdownMenuCheckboxItem[]>(
() =>
diff --git a/src/routes/(mobile)/community/(detail)/_layout/Header.tsx b/src/routes/(mobile)/community/(detail)/_layout/Header.tsx
index c756fe0d897..8add65b7c01 100644
--- a/src/routes/(mobile)/community/(detail)/_layout/Header.tsx
+++ b/src/routes/(mobile)/community/(detail)/_layout/Header.tsx
@@ -14,11 +14,17 @@ const Header = memo(() => {
// Extract the path segment (assistant, model, provider, mcp)
const path = location.pathname.split('/').find(Boolean);
+ const catalog = location.state?.marketplaceCatalog;
+
return (
<ChatHeader
showBackButton
style={mobileHeaderSticky}
- onBackClick={() => navigate(`/${path}`)}
+ onBackClick={() =>
+ typeof catalog === 'string'
+ ? navigate(catalog, { escape: true, replace: true })
+ : navigate(`/${path}`)
+ }
/>
);
});
diff --git a/src/spa/router/marketplaceRoutes.tsx b/src/spa/router/marketplaceRoutes.tsx
index bfc65d96883..fdfd868cb40 100644
--- a/src/spa/router/marketplaceRoutes.tsx
+++ b/src/spa/router/marketplaceRoutes.tsx
@@ -4,6 +4,7 @@ import { Blocks, ShapesIcon } from 'lucide-react';
import type { RouteObject } from 'react-router';
import CommunityListSkeleton from '@/components/Skeleton/CommunityList';
+import { MarketplaceCatalogSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';
import {
getMarketplaceEntryPath,
@@ -102,25 +103,17 @@ export const marketplaceRoute: RouteObject = {
{
children: [
{
- children: [
- {
- element: dynamicElement(
- () => import('@/routes/(main)/community/(list)/agent'),
- 'Desktop > Discover > List > Agent',
- ),
- handle: {
- meta: routeMeta({
- icon: ShapesIcon,
- titleKey: 'navigation.marketplaceAgents',
- }),
- },
- index: true,
- },
- ],
element: dynamicElement(
- () => import('@/routes/(main)/community/(list)/agent/_layout'),
- 'Desktop > Discover > List > Agent > Layout',
+ () => import('@/routes/(main)/community/(list)/agent'),
+ 'Desktop > Discover > List > Agent',
),
+ handle: {
+ meta: routeMeta({
+ icon: ShapesIcon,
+ Skeleton: MarketplaceCatalogSkeleton,
+ titleKey: 'navigation.marketplaceAgents',
+ }),
+ },
path: 'agent',
},
{
@@ -158,7 +151,11 @@ export const marketplaceRoute: RouteObject = {
'Desktop > Discover > List > Skill',
),
handle: {
- meta: routeMeta({ icon: ShapesIcon, titleKey: 'navigation.marketplaceSkills' }),
+ meta: routeMeta({
+ icon: ShapesIcon,
+ Skeleton: MarketplaceCatalogSkeleton,
+ titleKey: 'navigation.marketplaceSkills',
+ }),
},
path: 'skill',
},
@@ -168,7 +165,11 @@ export const marketplaceRoute: RouteObject = {
'Desktop > Discover > List > Connector',
),
handle: {
- meta: routeMeta({ icon: Blocks, titleKey: 'navigation.marketplaceConnectors' }),
+ meta: routeMeta({
+ icon: Blocks,
+ Skeleton: MarketplaceCatalogSkeleton,
+ titleKey: 'navigation.marketplaceConnectors',
+ }),
},
path: 'connector',
},
diff --git a/src/spa/router/mobileRouter.config.tsx b/src/spa/router/mobileRouter.config.tsx
index e31a87296cd..d5132e4bd94 100644
--- a/src/spa/router/mobileRouter.config.tsx
+++ b/src/spa/router/mobileRouter.config.tsx
@@ -10,6 +10,7 @@ import {
import AppsSkeleton from '@/components/Skeleton/Apps';
import CommunityListSkeleton from '@/components/Skeleton/CommunityList';
import { delayed } from '@/components/Skeleton/Delayed';
+import { MarketplaceCatalogSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';
import { acceptanceRouteMeta } from '@/features/Acceptance/routeMeta';
import { MARKETPLACE_SEGMENT } from '@/features/Marketplace/paths';
@@ -138,7 +139,11 @@ export const sharedMainAreaChildren: RouteObject[] = [
'Mobile > Discover > List > Agent',
),
handle: {
- meta: routeMeta({ icon: ShapesIcon, titleKey: 'navigation.marketplaceAgents' }),
+ meta: routeMeta({
+ icon: ShapesIcon,
+ Skeleton: MarketplaceCatalogSkeleton,
+ titleKey: 'navigation.marketplaceAgents',
+ }),
},
path: 'agent',
},
@@ -174,7 +179,11 @@ export const sharedMainAreaChildren: RouteObject[] = [
'Mobile > Discover > List > Connector',
),
handle: {
- meta: routeMeta({ icon: Blocks, titleKey: 'navigation.marketplaceConnectors' }),
+ meta: routeMeta({
+ icon: Blocks,
+ Skeleton: MarketplaceCatalogSkeleton,
+ titleKey: 'navigation.marketplaceConnectors',
+ }),
},
path: 'connector',
},
@@ -184,7 +193,11 @@ export const sharedMainAreaChildren: RouteObject[] = [
'Mobile > Discover > List > Skill',
),
handle: {
- meta: routeMeta({ icon: ShapesIcon, titleKey: 'navigation.marketplaceSkills' }),
+ meta: routeMeta({
+ icon: ShapesIcon,
+ Skeleton: MarketplaceCatalogSkeleton,
+ titleKey: 'navigation.marketplaceSkills',
+ }),
},
path: 'skill',
},