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): Lobot's Apps design — app tiles, category pages, and app pages in cards (#23689)

Lobehub Coder7ba95dd62fa0
diff --git a/locales/en-US/discover.json b/locales/en-US/discover.json
index bfc51add96a..3ea5fbf927f 100644
--- a/locales/en-US/discover.json
+++ b/locales/en-US/discover.json
@@ -1,5 +1,6 @@
{
"apps.addMcp": "Add custom MCP server",
+ "apps.back": "Back",
"apps.category.chat": "Chat platforms",
"apps.category.developer": "Developer tools",
"apps.category.documents": "Documents & storage",
@@ -10,6 +11,12 @@
"apps.connected": "Connected apps",
"apps.continue": "Continue setup",
"apps.description": "Connect the apps you use to chat with your Agent or give it tools.",
+ "apps.detail.category": "Category",
+ "apps.detail.connected": "Connected",
+ "apps.detail.developer": "Developer",
+ "apps.detail.info": "Information",
+ "apps.detail.integrator": "Integrated by",
+ "apps.detail.website": "Website",
"apps.empty": "No apps available",
"apps.manage": "Manage",
"apps.mcpDescription": "Find MCP servers and connect custom servers to your Agents.",
diff --git a/locales/en-US/tool.json b/locales/en-US/tool.json
index ae647c1fb14..315fe054632 100644
--- a/locales/en-US/tool.json
+++ b/locales/en-US/tool.json
@@ -168,6 +168,8 @@
"connector.authError": "Authorization error",
"connector.connected": "Connected",
"connector.createTools": "Create tools",
+ "connector.dangerZone.desc": "Disconnecting or removing {{name}} takes its tools away from every Agent that uses them.",
+ "connector.dangerZone.title": "Danger zone",
"connector.delete": "Delete",
"connector.deleteAccountConfirmContent": "This removes the connector and its authorization from your account. Any agent that uses it will need to be re-authorized afterwards.",
"connector.deleteAgentConfirmContent": "This connector belongs to the agent “{{agent}}”. Deleting it will also remove this tool from that agent.",
diff --git a/locales/zh-CN/discover.json b/locales/zh-CN/discover.json
index efb410ebb17..14c2d12e5d9 100644
--- a/locales/zh-CN/discover.json
+++ b/locales/zh-CN/discover.json
@@ -1,5 +1,6 @@
{
"apps.addMcp": "添加自定义 MCP 服务器",
+ "apps.back": "返回",
"apps.category.chat": "聊天平台",
"apps.category.developer": "开发工具",
"apps.category.documents": "文档与存储",
@@ -10,6 +11,12 @@
"apps.connected": "已连接的应用",
"apps.continue": "继续绑定",
"apps.description": "连接常用应用,与 Agent 对话或为它添加工具。",
+ "apps.detail.category": "分类",
+ "apps.detail.connected": "已连接",
+ "apps.detail.developer": "开发者",
+ "apps.detail.info": "信息",
+ "apps.detail.integrator": "集成方",
+ "apps.detail.website": "网站",
"apps.empty": "暂无可用应用",
"apps.manage": "管理",
"apps.mcpDescription": "发现 MCP 服务器,或为 Agent 添加自定义服务器。",
diff --git a/locales/zh-CN/tool.json b/locales/zh-CN/tool.json
index 578da00697f..3947133ec15 100644
--- a/locales/zh-CN/tool.json
+++ b/locales/zh-CN/tool.json
@@ -168,6 +168,8 @@
"connector.authError": "授权异常",
"connector.connected": "已连接",
"connector.createTools": "创建类工具",
+ "connector.dangerZone.desc": "断开或移除 {{name}} 后,所有用到它的助理都会失去这些工具。",
+ "connector.dangerZone.title": "危险操作",
"connector.delete": "删除",
"connector.deleteAccountConfirmContent": "此操作会移除该连接器及其在你账号下的授权。之后任何使用它的助理都需要重新授权。",
"connector.deleteAgentConfirmContent": "该连接器归属于助理「{{agent}}」。删除它会同时把这个工具从该助理中移除。",
diff --git a/packages/locales/src/default/discover.ts b/packages/locales/src/default/discover.ts
index 7316e6ead23..a634a578ead 100644
--- a/packages/locales/src/default/discover.ts
+++ b/packages/locales/src/default/discover.ts
@@ -89,6 +89,13 @@ export default {
'assistants.withPlugin': 'This Agent includes Skills',
'back': 'Back to Discovery',
'apps.addMcp': 'Add custom MCP server',
+ 'apps.back': 'Back',
+ 'apps.detail.category': 'Category',
+ 'apps.detail.connected': 'Connected',
+ 'apps.detail.developer': 'Developer',
+ 'apps.detail.info': 'Information',
+ 'apps.detail.integrator': 'Integrated by',
+ 'apps.detail.website': 'Website',
'apps.category.chat': 'Chat platforms',
'apps.category.developer': 'Developer tools',
'apps.category.documents': 'Documents & storage',
diff --git a/packages/locales/src/default/tool.ts b/packages/locales/src/default/tool.ts
index 892b5a98091..d84cbcdaf20 100644
--- a/packages/locales/src/default/tool.ts
+++ b/packages/locales/src/default/tool.ts
@@ -167,6 +167,9 @@ export default {
'connector.account.title': 'Accounts',
'connector.account.usingAccount': 'Account: {{name}}',
'connector.actionFailed': 'Operation failed, please try again',
+ 'connector.dangerZone.desc':
+ 'Disconnecting or removing {{name}} takes its tools away from every Agent that uses them.',
+ 'connector.dangerZone.title': 'Danger zone',
'connector.error.network':
'The network connection was interrupted. Check your connection and try again.',
'connector.error.stdioDesktopOnly':
diff --git a/src/features/Connectors/ConnectorDetail/Section.tsx b/src/features/Connectors/ConnectorDetail/Section.tsx
index 3adfe3ec85f..514fbd65c1d 100644
--- a/src/features/Connectors/ConnectorDetail/Section.tsx
+++ b/src/features/Connectors/ConnectorDetail/Section.tsx
@@ -1,19 +1,15 @@
-import { Flexbox } from '@lobehub/ui';
-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import { Flexbox, Text } from '@lobehub/ui';
+import { Surface } from '@lobehub/ui/dashboard';
import * as stylex from '@stylexjs/stylex';
import type { ReactNode } from 'react';
const styles = stylex.create({
- // A page heading over a thin rule, so the detail reads as one scrolling page.
- label: {
- borderBlockEndColor: cssVar.colorBorderSecondary,
- borderBlockEndStyle: 'solid',
- borderBlockEndWidth: 1,
- color: cssVar.colorText,
- flex: '1',
- fontSize: cssVar.fontSizeHeading5,
- fontWeight: 600,
- paddingBlockEnd: 8,
+ body: {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 12,
+ minWidth: 0,
+ padding: 16,
},
});
@@ -24,18 +20,18 @@ interface SectionProps {
label: ReactNode;
}
-/** One labelled block of the connector detail page. */
+/** One labelled block of the connector detail page: the label above, the content in a Surface card. */
const Section = ({ children, extra, label }: SectionProps) => (
- <Flexbox gap={12}>
- {extra ? (
- <Flexbox horizontal align={'center'} gap={12} justify={'space-between'}>
- <span {...stylex.props(styles.label)}>{label}</span>
- {extra}
- </Flexbox>
- ) : (
- <span {...stylex.props(styles.label)}>{label}</span>
- )}
- {children}
+ <Flexbox gap={8}>
+ <Flexbox horizontal align={'center'} gap={12} justify={'space-between'}>
+ <Text as={'div'} weight={600}>
+ {label}
+ </Text>
+ {extra}
+ </Flexbox>
+ <Surface>
+ <div {...stylex.props(styles.body)}>{children}</div>
+ </Surface>
</Flexbox>
);
diff --git a/src/features/Connectors/ConnectorDetail/index.tsx b/src/features/Connectors/ConnectorDetail/index.tsx
index 91de8d4181d..4f36c74e1ee 100644
--- a/src/features/Connectors/ConnectorDetail/index.tsx
+++ b/src/features/Connectors/ConnectorDetail/index.tsx
@@ -8,7 +8,7 @@ import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
import { PencilIcon, RefreshCwIcon, Trash2 } from 'lucide-react';
import type { ReactNode } from 'react';
-import { memo, useCallback, useState } from 'react';
+import { createContext, memo, use, useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
import type { ConnectorToolPermission } from '@/database/schemas';
@@ -31,6 +31,13 @@ import ManageTooltip from './ManageTooltip';
import Section from './Section';
import ToolPermissionGroup from './ToolPermissionGroup';
+/**
+ * Set by a page that already shows the connector's icon and name (the
+ * Marketplace app page), so a connector detail rendered anywhere below it —
+ * however many wrappers deep — drops its own and keeps only the actions.
+ */
+export const ConnectorDetailEmbeddedContext = createContext(false);
+
interface ConnectorDetailProps {
/**
* Title of the owning agent when this is an agent-dimension connector. Drives
@@ -39,6 +46,11 @@ interface ConnectorDetailProps {
*/
agentTitle?: string | null;
connectorId: string;
+ /**
+ * The page around it already shows the connector's icon and name (the
+ * Marketplace app page): drop them here and keep only the actions.
+ */
+ hideIdentity?: boolean;
lifecycleActions?: ReactNode;
/**
* Extra content rendered in the Overview tab, below the connector facts.
@@ -50,6 +62,12 @@ interface ConnectorDetailProps {
}
const styles = stylex.create({
+ // Inside a page that scrolls on its own: no second scroller, no inset.
+ bodyEmbedded: {
+ overflowY: 'visible',
+ paddingBlock: 0,
+ paddingInline: 0,
+ },
body: {
flex: '1',
minHeight: 0,
@@ -91,7 +109,15 @@ const styles = stylex.create({
});
const ConnectorDetail = memo<ConnectorDetailProps>(
- ({ agentTitle, connectorId, lifecycleActions, middleSlot, onDelete }) => {
+ ({
+ agentTitle,
+ connectorId,
+ hideIdentity: hideIdentityProp,
+ lifecycleActions,
+ middleSlot,
+ onDelete,
+ }) => {
+ const hideIdentity = use(ConnectorDetailEmbeddedContext) || !!hideIdentityProp;
const { t } = useTranslation('tool');
const { t: ts } = useTranslation('setting');
@@ -316,6 +342,15 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
</Button>
</ManageTooltip>
)}
+ </>
+ );
+
+ const hasDangerActions =
+ lifecycleActions !== undefined ? !!lifecycleActions : isMcpConnector || isMarketplace;
+
+ // Disconnect / delete / uninstall sit apart at the bottom, in their own card.
+ const dangerActions = (
+ <>
{lifecycleActions !== undefined ? (
lifecycleActions
) : (
@@ -399,7 +434,17 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
</Section>
)}
- <Section label={ts('connectorMarket.detail.information')}>
+ <Section
+ label={ts('connectorMarket.detail.information')}
+ extra={
+ // Embedded, there is no header row: its actions join the first card's label.
+ hideIdentity ? (
+ <Flexbox horizontal gap={8} wrap={'wrap'}>
+ {actions}
+ </Flexbox>
+ ) : undefined
+ }
+ >
<ConnectorOverviewInfo connector={connector} />
</Section>
@@ -484,41 +529,43 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
return (
<div {...stylex.props(styles.root)}>
- <Flexbox
- horizontal
- align={'center'}
- gap={16}
- justify={'space-between'}
- {...stylex.props(styles.header)}
- >
- <Flexbox horizontal align={'center'} gap={16} style={{ minWidth: 0 }}>
- <ConnectorDetailIcon connector={connector} size={'large'} />
- <Flexbox gap={4} style={{ minWidth: 0 }}>
- <h2 {...stylex.props(styles.title)}>{connectorName}</h2>
- <Flexbox horizontal align={'center'} gap={6} {...stylex.props(styles.meta)}>
- {author && (
- <>
- <span>{ts('connectorMarket.detail.byAuthor', { author })}</span>
- <span aria-hidden>·</span>
- </>
- )}
- <span>{t(`connector.kind.${getConnectorKind(connector)}`)}</span>
- {hasTools && (
- <>
- <span aria-hidden>·</span>
- <span>{t('connector.toolCount', { count: toolCount })}</span>
- </>
- )}
+ {!hideIdentity && (
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={16}
+ justify={'space-between'}
+ {...stylex.props(styles.header)}
+ >
+ <Flexbox horizontal align={'center'} gap={16} style={{ minWidth: 0 }}>
+ <ConnectorDetailIcon connector={connector} size={'large'} />
+ <Flexbox gap={4} style={{ minWidth: 0 }}>
+ <h2 {...stylex.props(styles.title)}>{connectorName}</h2>
+ <Flexbox horizontal align={'center'} gap={6} {...stylex.props(styles.meta)}>
+ {author && (
+ <>
+ <span>{ts('connectorMarket.detail.byAuthor', { author })}</span>
+ <span aria-hidden>·</span>
+ </>
+ )}
+ <span>{t(`connector.kind.${getConnectorKind(connector)}`)}</span>
+ {hasTools && (
+ <>
+ <span aria-hidden>·</span>
+ <span>{t('connector.toolCount', { count: toolCount })}</span>
+ </>
+ )}
+ </Flexbox>
</Flexbox>
</Flexbox>
+ <Flexbox horizontal align={'center'} flex={'none'} gap={8} wrap={'wrap'}>
+ {actions}
+ </Flexbox>
</Flexbox>
- <Flexbox horizontal align={'center'} flex={'none'} gap={8} wrap={'wrap'}>
- {actions}
- </Flexbox>
- </Flexbox>
+ )}
{/* One page: what it is and who authorized it, then what its tools may do. */}
- <div {...stylex.props(styles.body)}>
+ <div {...stylex.props(styles.body, hideIdentity && styles.bodyEmbedded)}>
<Flexbox gap={32}>
{overview}
<Section
@@ -535,6 +582,24 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
>
{tools}
</Section>
+ {hasDangerActions && (
+ <Section label={t('connector.dangerZone.title')}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={16}
+ justify={'space-between'}
+ wrap={'wrap'}
+ >
+ <Text style={{ minWidth: 0 }} type={'secondary'}>
+ {t('connector.dangerZone.desc', { name: connectorName })}
+ </Text>
+ <Flexbox horizontal align={'center'} flex={'none'} gap={8}>
+ {dangerActions}
+ </Flexbox>
+ </Flexbox>
+ </Section>
+ )}
</Flexbox>
{/* Edit modal for an http or stdio custom connector */}
diff --git a/src/features/Marketplace/Apps/AppCatalog.tsx b/src/features/Marketplace/Apps/AppCatalog.tsx
index 5007147e16e..1ac7654bb11 100644
--- a/src/features/Marketplace/Apps/AppCatalog.tsx
+++ b/src/features/Marketplace/Apps/AppCatalog.tsx
@@ -9,14 +9,11 @@ import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspace
import AsyncBoundary from '@/components/AsyncBoundary';
import AsyncError from '@/components/AsyncError';
import { CatalogRowsSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
-import ComposioSkillItem from '@/features/Settings/skill/features/ComposioSkillItem';
import {
matchesConnectorKeyword,
matchesIntegrationKeyword,
} from '@/features/Settings/skill/features/connectorSections';
-import LobehubSkillItem from '@/features/Settings/skill/features/LobehubSkillItem';
-import { RowAddAction, RowMoreMenu } from '@/features/Settings/skill/features/RowActions';
-import SkillListRow from '@/features/Settings/skill/features/SkillListRow';
+import { RowAddAction } from '@/features/Settings/skill/features/RowActions';
import { useToolStore } from '@/store/tool';
import { isMobileSurface } from '@/utils/mobileSurface';
@@ -24,11 +21,32 @@ import CatalogSection from '../Catalog/CatalogSection';
import DiscoverCatalogHeader from '../Catalog/DiscoverCatalogHeader';
import { catalogStyles } from '../Catalog/styles';
import { useCatalogDetailNavigate } from '../Catalog/useCatalogDetailNavigate';
-import { AppIcon } from './AppIcon';
-import { appCategories, getAppHome, getInlineConnectTool, hasAppConnection } from './catalog';
+import { MARKETPLACE_APPS_PATH } from '../paths';
+import AppRow from './AppRow';
+import AppRowMenu from './AppRowMenu';
+import {
+ appCategories,
+ appUrl,
+ CATEGORY_PREVIEW_COUNT,
+ getAppHome,
+ getInlineConnectTool,
+ hasAppConnection,
+ isAppCategory,
+} from './catalog';
import OfficialMcpItem from './OfficialMcpItem';
+import { useAppSummary } from './useAppSummary';
import { useMarketplaceApps } from './useMarketplaceApps';
+/** `?connect=1` on an app's page starts connecting it as the page opens. */
+export const CONNECT_ON_OPEN_PARAM = 'connect';
+
+/**
+ * The Apps catalog: apps grouped by category in two columns. Each group previews
+ * its first rows; its arrow opens the category's own page (`?category=`), and a
+ * search lists every match. A row opens the app's page; its `+` opens that page
+ * and starts connecting there, so the page is already showing when the sign-in
+ * lands. A connected row's `…` holds Details and Disconnect.
+ */
export default function AppCatalog() {
const { t } = useTranslation('discover');
const { t: ts } = useTranslation('setting');
@@ -36,39 +54,18 @@ export default function AppCatalog() {
const [params, setParams] = useSearchParams();
const connected = params.get('view') === 'connected';
const keyword = params.get('q') ?? '';
+ const categoryParam = params.get('category');
+ const category = isAppCategory(categoryParam) ? categoryParam : undefined;
const navigate = useCatalogDetailNavigate();
- const {
- apps,
- composioServers,
- lobehubServers,
- lobehubEnabled,
- loading,
- refreshing,
- error,
- retry,
- } = useMarketplaceApps();
+ const summaryOf = useAppSummary();
+ const { apps, lobehubEnabled, loading, refreshing, error, retry } = useMarketplaceApps();
const workspace = useActiveWorkspaceId();
const useFetchConnectors = useToolStore((s) => s.useFetchConnectors);
const connectorsSync = useFetchConnectors(!!workspace);
- const connectorsReady = useToolStore((s) => s.isConnectorsInit);
- const composioReady = useToolStore((s) => s.isComposioServersInit);
- const lobehubReady = useToolStore((s) => s.lobehubSkillServers !== undefined);
const rows = apps
.filter((app) => !connected || hasAppConnection(app))
- .map((app) => {
- const { channel, tool } = app;
- const summary = channel
- ? t(`apps.summary.channel.${channel.id}`, {
- defaultValue: tm(`messenger.list.${channel.id}.description`),
- })
- : t(`apps.summary.tool.${app.id}`, {
- defaultValue:
- (tool?.type === 'lobehub'
- ? tool.provider.description
- : (tool?.serverType.description ?? app.officialMcp?.description)) ?? '',
- });
- return { ...app, summary };
- })
+ .filter((app) => !category || app.category === category)
+ .map((app) => ({ ...app, summary: summaryOf(app) }))
.filter(
(app) =>
matchesConnectorKeyword(keyword, [
@@ -80,11 +77,75 @@ export default function AppCatalog() {
]) ||
(app.tool && matchesIntegrationKeyword(app.tool, keyword, ts)),
);
+ const renderRows = (items: typeof rows) =>
+ items.map((app) => {
+ const isConnected = hasAppConnection(app);
+ const home = getAppHome(app);
+ const open = () => navigate(home);
+ const inlineTool = getInlineConnectTool(app, lobehubEnabled);
+ const label = t('catalog.rowAction', {
+ action: isConnected
+ ? t('apps.manage')
+ : app.channelPending
+ ? t('apps.continue')
+ : t('apps.connect'),
+ name: app.name,
+ });
+ if (app.officialMcp)
+ return (
+ <OfficialMcpItem app={app} key={app.id} server={app.officialMcp} summary={app.summary} />
+ );
+ return (
+ <AppRow
+ app={app}
+ key={app.id}
+ summary={app.summary}
+ action={
+ <>
+ {app.channel?.access?.requiredPlan === 'paid' && (
+ <Tag size={'small'}>{tm('messenger.paidBadge')}</Tag>
+ )}
+ {isConnected ? (
+ <AppRowMenu app={app} label={label} onOpenDetail={open} />
+ ) : (
+ <RowAddAction
+ label={label}
+ onClick={() =>
+ navigate(
+ inlineTool
+ ? appUrl(home, {
+ [CONNECT_ON_OPEN_PARAM]: '1',
+ })
+ : home,
+ )
+ }
+ />
+ )}
+ </>
+ }
+ onOpen={open}
+ />
+ );
+ });
+
+ // A category page and a search show every row; the catalog previews each category.
+ const full = Boolean(category) || Boolean(keyword.trim());
return (
<div {...stylex.props(catalogStyles.frame)}>
<DiscoverCatalogHeader
kind={'app'}
+ group={
+ category
+ ? {
+ backTo: appUrl(MARKETPLACE_APPS_PATH, {
+ q: keyword || undefined,
+ view: connected ? 'connected' : undefined,
+ }),
+ title: t(`apps.category.${category}`),
+ }
+ : undefined
+ }
titleExtra={
isMobileSurface() && (
<Button
@@ -122,81 +183,33 @@ export default function AppCatalog() {
</Text>
}
>
- {appCategories.map((category) => {
- const group = rows.filter((app) => app.category === category);
- if (!group.length) return null;
+ {appCategories.map((group) => {
+ const items = rows.filter((app) => app.category === group);
+ if (!items.length) return null;
+ // The category's own page is titled by the header: just its rows.
+ if (category)
+ return (
+ <div key={group} {...stylex.props(catalogStyles.grid)}>
+ {renderRows(items)}
+ </div>
+ );
+ const visible = full ? items : items.slice(0, CATEGORY_PREVIEW_COUNT);
return (
<CatalogSection
- count={group.length}
- key={category}
- label={t(`apps.category.${category}`)}
+ count={items.length}
+ key={group}
+ label={t(`apps.category.${group}`)}
loading={false}
+ to={
+ full || items.length <= CATEGORY_PREVIEW_COUNT
+ ? undefined
+ : appUrl(MARKETPLACE_APPS_PATH, {
+ category: group,
+ view: connected ? 'connected' : undefined,
+ })
+ }
>
- {group.map((app) => {
- const isConnected = hasAppConnection(app);
- const label = t('catalog.rowAction', {
- action: isConnected
- ? t('apps.manage')
- : app.channelPending
- ? t('apps.continue')
- : t('apps.connect'),
- name: app.name,
- });
- const open = () => navigate(getAppHome(app));
- const row = {
- icon: () => <AppIcon app={app} size={20} />,
- onClick: open,
- summary: app.summary,
- title: app.name,
- };
- if (app.officialMcp)
- return <OfficialMcpItem catalogRow={row} key={app.id} server={app.officialMcp} />;
- const tool = getInlineConnectTool(app, lobehubEnabled);
- if (tool) {
- const ready = tool.type === 'composio' ? composioReady : lobehubReady;
- if (!ready || (workspace && !connectorsReady))
- return (
- <SkillListRow
- {...row}
- extra={<RowAddAction disabled label={label} onClick={open} />}
- key={app.id}
- />
- );
- return tool.type === 'composio' ? (
- <ComposioSkillItem
- catalogRow={row}
- key={app.id}
- server={composioServers.find((s) => s.identifier === app.id)}
- serverType={tool.serverType}
- />
- ) : (
- <LobehubSkillItem
- catalogRow={row}
- key={app.id}
- provider={tool.provider}
- server={lobehubServers.find((s) => s.identifier === app.id)}
- />
- );
- }
- return (
- <SkillListRow
- {...row}
- key={app.id}
- extra={
- <>
- {app.channel?.access?.requiredPlan === 'paid' && (
- <Tag size={'small'}>{tm('messenger.paidBadge')}</Tag>
- )}
- {isConnected ? (
- <RowMoreMenu label={label} onOpenDetail={open} />
- ) : (
- <RowAddAction label={label} onClick={open} />
- )}
- </>
- }
- />
- );
- })}
+ {renderRows(visible)}
</CatalogSection>
);
})}
diff --git a/src/features/Marketplace/Apps/AppDetail.tsx b/src/features/Marketplace/Apps/AppDetail.tsx
index bd53148dad3..a125ed20453 100644
--- a/src/features/Marketplace/Apps/AppDetail.tsx
+++ b/src/features/Marketplace/Apps/AppDetail.tsx
@@ -1,48 +1,201 @@
'use client';
-import { Button, Flexbox, Segmented, Text } from '@lobehub/ui';
+import { Button, Flexbox, Icon, Segmented, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
import isEqual from 'fast-deep-equal';
-import { ChevronLeft } from 'lucide-react';
+import { ExternalLink, PlusIcon } from 'lucide-react';
+import { memo, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { useLocation, useParams, useSearchParams } from 'react-router';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
import AsyncBoundary from '@/components/AsyncBoundary';
import { CatalogRowsSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
+import { ConnectorDetailEmbeddedContext } from '@/features/Connectors/ConnectorDetail';
import { hasConnectorPage } from '@/features/Integrations/connectorPage';
import InstallResult from '@/features/Messenger/InstallResult';
import IntegrationDetail from '@/features/Messenger/IntegrationDetail';
import ComposioSkillItem from '@/features/Settings/skill/features/ComposioSkillItem';
-import LobehubSkillItem from '@/features/Settings/skill/features/LobehubSkillItem';
import SkillDetail from '@/features/Settings/skill/features/SkillDetail';
+import { useSkillConnect } from '@/features/SkillStore/SkillList/LobeHub/useSkillConnect';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+import { usePermission } from '@/hooks/usePermission';
import { useToolStore } from '@/store/tool';
import { connectorSelectors, isIntegrationInConnectorTab } from '@/store/tool/slices/connector';
import { catalogStyles } from '../Catalog/styles';
import { MARKETPLACE_APPS_PATH } from '../paths';
+import { CONNECT_ON_OPEN_PARAM } from './AppCatalog';
+import AppTile from './AppTile';
+import BackLink from './BackLink';
+import {
+ getAppFacts,
+ getInlineConnectTool,
+ hasAppConnection,
+ type MarketplaceApp,
+} from './catalog';
+import { CardSection } from './MarketCard';
+import { useAppSummary } from './useAppSummary';
import { useMarketplaceApps } from './useMarketplaceApps';
+const styles = stylex.create({
+ facts: {
+ display: 'grid',
+ gridTemplateColumns: '120px minmax(0, 1fr)',
+ rowGap: 10,
+ },
+ link: {
+ display: 'inline-flex',
+ alignItems: 'center',
+ gap: 6,
+ minWidth: 0,
+ color: {
+ 'default': cssVar.colorText,
+ ':hover': cssVar.colorPrimary,
+ },
+ },
+ status: {
+ display: 'inline-flex',
+ flex: 'none',
+ alignItems: 'center',
+ gap: 6,
+ paddingBlock: 2,
+ paddingInline: 8,
+ borderRadius: 999,
+ fontSize: 12,
+ lineHeight: '18px',
+ color: cssVar.colorSuccess,
+ backgroundColor: cssVar.colorSuccessBg,
+ },
+});
+
+const hostOf = (url: string) => {
+ try {
+ return new URL(url).host;
+ } catch {
+ return url;
+ }
+};
+
+/**
+ * "+ Connect" for an app connected as a LobeHub or Composio tool. Arriving with
+ * `?connect=1` (the catalog's `+`) starts it once, then drops the flag so a
+ * reload or Back does not sign in again.
+ */
+const ConnectButton = memo<{
+ app: MarketplaceApp & { tool: NonNullable<MarketplaceApp['tool']> };
+}>(({ app }) => {
+ const { t } = useTranslation('discover');
+ const [params, setParams] = useSearchParams();
+ const location = useLocation();
+ const { allowed: canCreate } = usePermission('create_content');
+ const { allowed: canEdit } = usePermission('edit_own_content');
+ const allowed = canCreate && canEdit;
+ const { handleConnect, isConnecting } = useSkillConnect({
+ identifier: app.id,
+ serverName: app.name,
+ type: app.tool.type,
+ });
+ const started = useRef(false);
+
+ useEffect(() => {
+ if (started.current || params.get(CONNECT_ON_OPEN_PARAM) !== '1') return;
+ started.current = true;
+ const next = new URLSearchParams(params);
+ next.delete(CONNECT_ON_OPEN_PARAM);
+ setParams(next, { replace: true, state: location.state });
+ if (allowed) void handleConnect();
+ // Once per arrival; `handleConnect` changes identity on every render.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ return (
+ <Button
+ disabled={!allowed}
+ icon={<Icon icon={PlusIcon} />}
+ loading={isConnecting}
+ type={'fill'}
+ onClick={() => void handleConnect()}
+ >
+ {t('apps.connect')}
+ </Button>
+ );
+});
+
+ConnectButton.displayName = 'MarketplaceAppConnectButton';
+
+/** What the app is and who makes it: its guide, then developer, integrator, category, website. */
+const InfoCard = memo<{ app: MarketplaceApp }>(({ app }) => {
+ const { t } = useTranslation(['discover', 'setting']);
+ const { integrator, vendor, vendorUrl } = getAppFacts(app);
+ const { tool } = app;
+ const readme =
+ tool?.type === 'lobehub'
+ ? t(`tools.lobehubSkill.providers.${tool.provider.id}.readme`, {
+ defaultValue: tool.provider.readme,
+ ns: 'setting',
+ })
+ : tool
+ ? t(`tools.composio.servers.${tool.serverType.identifier}.readme`, {
+ defaultValue: tool.serverType.readme,
+ ns: 'setting',
+ })
+ : undefined;
+
+ return (
+ <CardSection title={t('apps.detail.info')}>
+ {readme && <Text style={{ lineHeight: 1.7 }}>{readme}</Text>}
+ <div {...stylex.props(styles.facts)}>
+ <Text type={'secondary'}>{t('apps.detail.developer')}</Text>
+ <Text>{vendor}</Text>
+ {integrator && (
+ <>
+ <Text type={'secondary'}>{t('apps.detail.integrator')}</Text>
+ <Text>{integrator}</Text>
+ </>
+ )}
+ <Text type={'secondary'}>{t('apps.detail.category')}</Text>
+ <Text>{t(`apps.category.${app.category}`)}</Text>
+ {vendorUrl && (
+ <>
+ <Text type={'secondary'}>{t('apps.detail.website')}</Text>
+ <a href={vendorUrl} rel={'noreferrer'} target={'_blank'} {...stylex.props(styles.link)}>
+ {hostOf(vendorUrl)}
+ <Icon icon={ExternalLink} size={14} />
+ </a>
+ </>
+ )}
+ </div>
+ </CardSection>
+ );
+});
+
+InfoCard.displayName = 'MarketplaceAppInfoCard';
+
+/**
+ * An app's own page: a back link, then the header — its tile, name, a
+ * Connected pill once connected, what it does, and "+ Connect" while it is not.
+ * Below it, an app that is both a chat channel and a tool switches between the
+ * two. A connected tool (and GitHub / Linear, which manage an integration)
+ * shows its connector page in cards; otherwise an Information card says what
+ * the app is and who makes it.
+ */
export default function AppDetail() {
const { appId } = useParams();
const [params, setParams] = useSearchParams();
const location = useLocation();
const navigate = useWorkspaceAwareNavigate();
const { t } = useTranslation(['discover', 'setting']);
- const { apps, composioServers, lobehubServers, toolSync, loading, error, retry } =
- useMarketplaceApps();
+ const summaryOf = useAppSummary();
+ const { apps, composioServers, lobehubEnabled, loading, error, retry } = useMarketplaceApps();
const app = apps.find((entry) => entry.id === appId);
const tool = app?.tool;
const channel = app?.channel;
const workspace = useActiveWorkspaceId();
const useConnectors = useToolStore((s) => s.useFetchConnectors);
- const connectorsSync = useConnectors(!!tool);
+ useConnectors(!!tool);
const connectors = useToolStore(connectorSelectors.connectorList, isEqual);
- const initialized = useToolStore((s) => s.isConnectorsInit);
- const toolInitialized = useToolStore((s) =>
- tool?.type === 'composio' ? s.isComposioServersInit : s.lobehubSkillServers !== undefined,
- );
const composioServer = composioServers.find((s) => s.identifier === appId);
const account = tool?.type === 'composio' ? composioServer?.connectedAccountId : undefined;
const inPublic = app && isIntegrationInConnectorTab(app.id, connectors, 'public', account);
@@ -60,112 +213,108 @@ export default function AppDetail() {
if (location.state?.marketplaceCatalog) navigate(-1);
else navigate(MARKETPLACE_APPS_PATH);
};
+
+ const connectorPage = !!app && (hasConnectorPage(app.id) || app.toolConnected);
+ const inlineTool = app && getInlineConnectTool(app, lobehubEnabled);
+
return (
<div {...stylex.props(catalogStyles.frame)}>
{(appId === 'slack' || appId === 'discord') && <InstallResult key={appId} platform={appId} />}
- <Flexbox align={'flex-start'}>
- <Button icon={ChevronLeft} size={'small'} type={'text'} onClick={onBack}>
- {t('tab.apps')}
- </Button>
- </Flexbox>
- <AsyncBoundary
- data={app}
- empty={<Text type={'secondary'}>{t('apps.unavailable')}</Text>}
- error={error}
- isEmpty={!app}
- isLoading={loading}
- loading={<CatalogRowsSkeleton />}
- onRetry={retry}
- >
- {app && (
- <>
- {channel && tool && (
- <Segmented<'channel' | 'tools'>
- value={selected}
- options={[
- { label: t('apps.chatCapability'), value: 'channel' },
- { label: t('apps.toolCapability'), value: 'tools' },
- ]}
- onChange={(next) => updateParam('capability', next)}
- />
- )}
- {selected === 'channel' && channel && (
- <IntegrationDetail
- access={channel.access}
- appId={channel.appId}
- botUsername={channel.botUsername}
- name={app.name}
- platform={channel.id}
- />
- )}
- {selected === 'tools' && tool && (
- <>
- {workspace && inPublic && inPrivate && (
- <Segmented<'public' | 'private'>
- value={visibility}
- options={[
- {
- value: 'public',
- label: t('skillView.connectorTabs.workspace', { ns: 'setting' }),
- },
- {
- value: 'private',
- label: t('skillView.connectorTabs.private', { ns: 'setting' }),
- },
- ]}
- onChange={(next) => updateParam('visibility', next)}
- />
- )}
- {hasConnectorPage(app.id) || app.toolConnected ? (
- <>
- {tool.type === 'composio' && (
- <ComposioSkillItem server={composioServer} serverType={tool.serverType} />
+ <Flexbox gap={12}>
+ <BackLink onClick={onBack} />
+ <AsyncBoundary
+ data={app}
+ empty={<Text type={'secondary'}>{t('apps.unavailable')}</Text>}
+ error={error}
+ isEmpty={!app}
+ isLoading={loading}
+ loading={<CatalogRowsSkeleton />}
+ onRetry={retry}
+ >
+ {app && (
+ <Flexbox gap={24}>
+ <Flexbox horizontal align={'center'} gap={16}>
+ <AppTile app={app} size={56} />
+ <Flexbox flex={1} gap={4} style={{ minWidth: 0 }}>
+ <Flexbox horizontal align={'center'} gap={8}>
+ <Text as={'h1'} fontSize={18} style={{ margin: 0 }} weight={600}>
+ {app.name}
+ </Text>
+ {hasAppConnection(app) && (
+ <span {...stylex.props(styles.status)}>{t('apps.detail.connected')}</span>
)}
- <SkillDetail
- identifier={app.id}
- type={tool.type === 'lobehub' ? 'lobehub-connector' : 'plugin'}
- visibility={visibility}
+ </Flexbox>
+ <Text ellipsis type={'secondary'}>
+ {summaryOf(app)}
+ </Text>
+ </Flexbox>
+ {inlineTool && <ConnectButton app={{ ...app, tool: inlineTool }} />}
+ </Flexbox>
+ {channel && tool && (
+ <Segmented<'channel' | 'tools'>
+ style={{ alignSelf: 'flex-start' }}
+ value={selected}
+ options={[
+ { label: t('apps.chatCapability'), value: 'channel' },
+ { label: t('apps.toolCapability'), value: 'tools' },
+ ]}
+ onChange={(next) => updateParam('capability', next)}
+ />
+ )}
+ {selected === 'channel' && channel && (
+ <>
+ <IntegrationDetail
+ access={channel.access}
+ appId={channel.appId}
+ botUsername={channel.botUsername}
+ name={app.name}
+ platform={channel.id}
+ />
+ {!tool && <InfoCard app={app} />}
+ </>
+ )}
+ {selected === 'tools' && tool && (
+ <>
+ {workspace && inPublic && inPrivate && (
+ <Segmented<'public' | 'private'>
+ style={{ alignSelf: 'flex-start' }}
+ value={visibility}
+ options={[
+ {
+ value: 'public',
+ label: t('skillView.connectorTabs.workspace', { ns: 'setting' }),
+ },
+ {
+ value: 'private',
+ label: t('skillView.connectorTabs.private', { ns: 'setting' }),
+ },
+ ]}
+ onChange={(next) => updateParam('visibility', next)}
/>
- </>
- ) : (
- <AsyncBoundary
- data={(toolInitialized && (!workspace || initialized)) || undefined}
- error={toolSync[tool.type].error ?? connectorsSync.error}
- loading={<CatalogRowsSkeleton count={1} />}
- isLoading={
- toolSync[tool.type].isValidating || (!initialized && connectorsSync.isLoading)
- }
- onRetry={() => {
- retry();
- void connectorsSync.mutate();
- }}
- >
- {tool.type === 'lobehub' ? (
- <LobehubSkillItem
- provider={tool.provider}
- server={lobehubServers.find((s) => s.identifier === app.id)}
- />
- ) : (
- <ComposioSkillItem server={composioServer} serverType={tool.serverType} />
- )}
- <Text as={'p'}>
- {tool.type === 'lobehub'
- ? t(`tools.lobehubSkill.providers.${tool.provider.id}.readme`, {
- ns: 'setting',
- defaultValue: tool.provider.readme,
- })
- : t(`tools.composio.servers.${tool.serverType.identifier}.readme`, {
- ns: 'setting',
- defaultValue: tool.serverType.readme,
- })}
- </Text>
- </AsyncBoundary>
- )}
- </>
- )}
- </>
- )}
- </AsyncBoundary>
+ )}
+ {connectorPage ? (
+ <>
+ {/* Its status row carries Reauthorize when Composio asks again. */}
+ {tool.type === 'composio' && (
+ <ComposioSkillItem server={composioServer} serverType={tool.serverType} />
+ )}
+ <ConnectorDetailEmbeddedContext value>
+ <SkillDetail
+ identifier={app.id}
+ type={tool.type === 'lobehub' ? 'lobehub-connector' : 'plugin'}
+ visibility={visibility}
+ />
+ </ConnectorDetailEmbeddedContext>
+ </>
+ ) : (
+ <InfoCard app={app} />
+ )}
+ </>
+ )}
+ </Flexbox>
+ )}
+ </AsyncBoundary>
+ </Flexbox>
</div>
);
}
diff --git a/src/features/Marketplace/Apps/AppRow.tsx b/src/features/Marketplace/Apps/AppRow.tsx
new file mode 100644
index 00000000000..8587759ddd3
--- /dev/null
+++ b/src/features/Marketplace/Apps/AppRow.tsx
@@ -0,0 +1,74 @@
+import { Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { memo, type ReactNode } from 'react';
+
+import AppTile from './AppTile';
+import type { MarketplaceApp } from './catalog';
+
+const styles = stylex.create({
+ action: {
+ display: 'flex',
+ flex: 'none',
+ alignItems: 'center',
+ gap: 8,
+ },
+ row: {
+ display: 'flex',
+ alignItems: 'center',
+ gap: 12,
+ minWidth: 0,
+ paddingBlock: 8,
+ paddingInline: 8,
+ borderRadius: cssVar.borderRadiusLG,
+ cursor: 'pointer',
+ backgroundColor: {
+ 'default': 'transparent',
+ ':hover': cssVar.colorFillQuaternary,
+ },
+ },
+ text: {
+ display: 'flex',
+ flex: '1',
+ flexDirection: 'column',
+ minWidth: 0,
+ },
+});
+
+/**
+ * One catalog cell: the app's tile, name and what it does, and one action at
+ * the end (`+` to add, `…` once added). The row itself opens the app's page;
+ * the action keeps its clicks to itself.
+ */
+const AppRow = memo<{
+ action?: ReactNode;
+ app: MarketplaceApp;
+ error?: ReactNode;
+ onOpen: () => void;
+ summary: string;
+}>(({ action, app, error, onOpen, summary }) => (
+ // lobe-design-ignore LOBE-DIV-CLICK: the row is a pointer shortcut; its action and the app name link stay keyboard reachable on the detail page
+ <div {...stylex.props(styles.row)} onClick={onOpen}>
+ <AppTile app={app} size={40} />
+ <span {...stylex.props(styles.text)}>
+ <Text ellipsis weight={500}>
+ {app.name}
+ </Text>
+ {error ?? (
+ <Text ellipsis fontSize={12} type={'secondary'}>
+ {summary}
+ </Text>
+ )}
+ </span>
+ {action && (
+ // lobe-design-ignore LOBE-DIV-CLICK: not a control; only stops propagation to the row
+ <span {...stylex.props(styles.action)} onClick={(event) => event.stopPropagation()}>
+ {action}
+ </span>
+ )}
+ </div>
+));
+
+AppRow.displayName = 'MarketplaceAppRow';
+
+export default AppRow;
diff --git a/src/features/Marketplace/Apps/AppRowMenu.tsx b/src/features/Marketplace/Apps/AppRowMenu.tsx
new file mode 100644
index 00000000000..4de8c5185e4
--- /dev/null
+++ b/src/features/Marketplace/Apps/AppRowMenu.tsx
@@ -0,0 +1,70 @@
+import { confirmModal, Icon } from '@lobehub/ui';
+import { Unplug } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { RowMoreMenu } from '@/features/Settings/skill/features/RowActions';
+import { useSkillConnect } from '@/features/SkillStore/SkillList/LobeHub/useSkillConnect';
+import { usePermission } from '@/hooks/usePermission';
+
+import type { MarketplaceApp } from './catalog';
+
+/** Disconnect for an app connected as a LobeHub or Composio tool, behind a confirmation. */
+const ToolMenu = memo<{
+ app: MarketplaceApp & { tool: NonNullable<MarketplaceApp['tool']> };
+ label: string;
+ onOpenDetail: () => void;
+}>(({ app, label, onOpenDetail }) => {
+ const { t } = useTranslation('setting');
+ const { allowed: canEdit } = usePermission('edit_own_content');
+ const { handleDisconnect } = useSkillConnect({
+ identifier: app.id,
+ serverName: app.name,
+ type: app.tool.type,
+ });
+
+ return (
+ <RowMoreMenu
+ label={label}
+ items={[
+ {
+ danger: true,
+ disabled: !canEdit,
+ icon: <Icon icon={Unplug} />,
+ key: 'disconnect',
+ label: t('tools.lobehubSkill.disconnect'),
+ onClick: () =>
+ confirmModal({
+ cancelText: t('cancel', { ns: 'common' }),
+ content: t('tools.lobehubSkill.disconnectConfirm.desc', { name: app.name }),
+ okButtonProps: { danger: true },
+ okText: t('tools.lobehubSkill.disconnect'),
+ onOk: () => handleDisconnect(),
+ title: t('tools.lobehubSkill.disconnectConfirm.title', { name: app.name }),
+ }),
+ },
+ ]}
+ onOpenDetail={onOpenDetail}
+ />
+ );
+});
+
+ToolMenu.displayName = 'MarketplaceAppToolMenu';
+
+/**
+ * A connected row's `…`: Details, and Disconnect when the app is connected as a
+ * tool. A chat channel or an integration (GitHub App, Linear workspace) is
+ * managed on its page, so its menu only opens that.
+ */
+const AppRowMenu = memo<{ app: MarketplaceApp; label: string; onOpenDetail: () => void }>(
+ ({ app, label, onOpenDetail }) => {
+ const { tool } = app;
+ if (tool && app.toolConnected)
+ return <ToolMenu app={{ ...app, tool }} label={label} onOpenDetail={onOpenDetail} />;
+ return <RowMoreMenu label={label} onOpenDetail={onOpenDetail} />;
+ },
+);
+
+AppRowMenu.displayName = 'MarketplaceAppRowMenu';
+
+export default AppRowMenu;
diff --git a/src/features/Marketplace/Apps/AppTile.tsx b/src/features/Marketplace/Apps/AppTile.tsx
new file mode 100644
index 00000000000..787e6692cb6
--- /dev/null
+++ b/src/features/Marketplace/Apps/AppTile.tsx
@@ -0,0 +1,27 @@
+import { Center } from '@lobehub/ui';
+import { Surface } from '@lobehub/ui/dashboard';
+import { memo } from 'react';
+
+import { AppIcon } from './AppIcon';
+import type { MarketplaceApp } from './catalog';
+
+/** The app's logo on a Surface tile, like an app icon: catalog rows use 40, the detail header 56. */
+const AppTile = memo<{ app: MarketplaceApp; size: number }>(({ app, size }) => (
+ <Surface
+ style={{
+ borderRadius: Math.round(size * 0.25),
+ flex: 'none',
+ height: size,
+ overflow: 'hidden',
+ width: size,
+ }}
+ >
+ <Center height={'100%'} width={'100%'}>
+ <AppIcon app={app} size={Math.round(size * 0.6)} />
+ </Center>
+ </Surface>
+));
+
+AppTile.displayName = 'MarketplaceAppTile';
+
+export default AppTile;
diff --git a/src/features/Marketplace/Apps/BackLink.tsx b/src/features/Marketplace/Apps/BackLink.tsx
new file mode 100644
index 00000000000..7bd4fbca527
--- /dev/null
+++ b/src/features/Marketplace/Apps/BackLink.tsx
@@ -0,0 +1,44 @@
+import { Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { ChevronLeft } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+const styles = stylex.create({
+ link: {
+ display: 'inline-flex',
+ alignItems: 'center',
+ alignSelf: 'flex-start',
+ gap: 2,
+ height: 24,
+ paddingInlineStart: 0,
+ paddingInlineEnd: 6,
+ marginInlineStart: -4,
+ borderWidth: 0,
+ borderRadius: cssVar.borderRadiusSM,
+ font: 'inherit',
+ fontSize: 13,
+ color: {
+ 'default': cssVar.colorTextSecondary,
+ ':hover': cssVar.colorText,
+ },
+ backgroundColor: 'transparent',
+ cursor: 'pointer',
+ },
+});
+
+/** "‹ Back" above a sub-page (an app, a category): quiet, and one size on every page. */
+const BackLink = memo<{ onClick: () => void }>(({ onClick }) => {
+ const { t } = useTranslation('discover');
+ return (
+ <button type={'button'} {...stylex.props(styles.link)} onClick={onClick}>
+ <Icon icon={ChevronLeft} size={16} />
+ {t('apps.back')}
+ </button>
+ );
+});
+
+BackLink.displayName = 'MarketplaceBackLink';
+
+export default BackLink;
diff --git a/src/features/Marketplace/Apps/MarketCard.tsx b/src/features/Marketplace/Apps/MarketCard.tsx
new file mode 100644
index 00000000000..b91e4841c78
--- /dev/null
+++ b/src/features/Marketplace/Apps/MarketCard.tsx
@@ -0,0 +1,42 @@
+import { Flexbox, Text } from '@lobehub/ui';
+import { Surface } from '@lobehub/ui/dashboard';
+import * as stylex from '@stylexjs/stylex';
+import { memo, type ReactNode } from 'react';
+
+const styles = stylex.create({
+ body: (gap: number) => ({
+ display: 'flex',
+ flexDirection: 'column',
+ gap,
+ minWidth: 0,
+ padding: 16,
+ }),
+});
+
+/** Every content block on an app's page: a Surface card. */
+export const MarketCard = memo<{ children: ReactNode; gap?: number }>(({ children, gap = 12 }) => (
+ <Surface>
+ <div {...stylex.props(styles.body(gap))}>{children}</div>
+ </Surface>
+));
+
+MarketCard.displayName = 'MarketplaceCard';
+
+/** A titled card: the label above, the content in the Surface. */
+export const CardSection = ({
+ children,
+ extra,
+ title,
+}: {
+ children: ReactNode;
+ extra?: ReactNode;
+ title: ReactNode;
+}) => (
+ <Flexbox gap={8}>
+ <Flexbox horizontal align={'center'} gap={12} justify={'space-between'}>
+ <Text weight={600}>{title}</Text>
+ {extra}
+ </Flexbox>
+ <MarketCard>{children}</MarketCard>
+ </Flexbox>
+);
diff --git a/src/features/Marketplace/Apps/OfficialMcpItem.tsx b/src/features/Marketplace/Apps/OfficialMcpItem.tsx
index 72c73f10001..1c7c379d90c 100644
--- a/src/features/Marketplace/Apps/OfficialMcpItem.tsx
+++ b/src/features/Marketplace/Apps/OfficialMcpItem.tsx
@@ -6,10 +6,7 @@ import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { RowAddAction, RowMoreMenu } from '@/features/Settings/skill/features/RowActions';
-import SkillListRow, {
- type CatalogConnectRow,
- ConnectedStatus,
-} from '@/features/Settings/skill/features/SkillListRow';
+import { ConnectedStatus } from '@/features/Settings/skill/features/SkillListRow';
import { usePermission } from '@/hooks/usePermission';
import { useToolStore } from '@/store/tool';
import { connectorSelectors } from '@/store/tool/slices/connector/selectors';
@@ -17,15 +14,18 @@ import { ConnectorOAuthError, openConnectorOAuthPopup } from '@/utils/connectorO
import { useCatalogDetailNavigate } from '../Catalog/useCatalogDetailNavigate';
import { buildInstalledDetailPath } from '../paths';
+import AppRow from './AppRow';
+import type { MarketplaceApp } from './catalog';
import { connectOfficialMcp } from './connectOfficialMcp';
interface OfficialMcpItemProps {
- catalogRow: CatalogConnectRow;
+ app: MarketplaceApp;
server: OfficialMcpServerType;
+ summary: string;
}
/** A catalog row for a vendor's official MCP server: connect in place, then manage it as a connector. */
-const OfficialMcpItem = memo<OfficialMcpItemProps>(({ catalogRow, server }) => {
+const OfficialMcpItem = memo<OfficialMcpItemProps>(({ app, server, summary }) => {
const { t } = useTranslation('discover');
const { t: ts } = useTranslation('setting');
const navigate = useCatalogDetailNavigate();
@@ -63,9 +63,10 @@ const OfficialMcpItem = memo<OfficialMcpItemProps>(({ catalogRow, server }) => {
};
return (
- <SkillListRow
- {...catalogRow}
- extra={
+ <AppRow
+ app={app}
+ summary={summary}
+ action={
connected ? (
<>
<ConnectedStatus label={ts('tools.composio.connected')} />
@@ -81,7 +82,7 @@ const OfficialMcpItem = memo<OfficialMcpItemProps>(({ catalogRow, server }) => {
/>
)
}
- onClick={connected ? openDetail : () => void handleConnect()}
+ onOpen={connected ? openDetail : () => void handleConnect()}
/>
);
});
diff --git a/src/features/Marketplace/Apps/catalog.test.ts b/src/features/Marketplace/Apps/catalog.test.ts
index 87261654972..b7a8640c395 100644
--- a/src/features/Marketplace/Apps/catalog.test.ts
+++ b/src/features/Marketplace/Apps/catalog.test.ts
@@ -3,7 +3,13 @@ import { describe, expect, it } from 'vitest';
import type { MessengerPlatformItem } from '@/store/messenger/projection';
-import { buildMarketplaceApps, getInlineConnectTool, hasAppConnection } from './catalog';
+import {
+ buildMarketplaceApps,
+ getAppFacts,
+ getInlineConnectTool,
+ hasAppConnection,
+ isAppCategory,
+} from './catalog';
const slack: MessengerPlatformItem = {
appId: 'slack-app',
@@ -121,3 +127,32 @@ describe('marketplace apps', () => {
for (const server of OFFICIAL_MCP_SERVERS) expect(new URL(server.url).protocol).toBe('https:');
});
});
+
+describe('getAppFacts', () => {
+ it('names the vendor as developer and the integrator apart', () => {
+ expect(
+ getAppFacts({ id: 'notion', name: 'Notion', tool: { type: 'composio' } as any }),
+ ).toEqual({ integrator: 'Composio', vendor: 'Notion', vendorUrl: 'https://www.notion.com' });
+ });
+
+ it('falls back to the integrator for an app without a known vendor', () => {
+ expect(getAppFacts({ id: 'acme', name: 'Acme', tool: { type: 'lobehub' } as any })).toEqual({
+ vendor: 'LobeHub',
+ });
+ });
+
+ it('names a channel-only app by its vendor', () => {
+ expect(getAppFacts({ id: 'telegram', name: 'Telegram' })).toEqual({
+ vendor: 'Telegram',
+ vendorUrl: 'https://telegram.org',
+ });
+ });
+});
+
+describe('isAppCategory', () => {
+ it('accepts catalog categories only', () => {
+ expect(isAppCategory('developer')).toBe(true);
+ expect(isAppCategory('social')).toBe(false);
+ expect(isAppCategory(null)).toBe(false);
+ });
+});
diff --git a/src/features/Marketplace/Apps/catalog.ts b/src/features/Marketplace/Apps/catalog.ts
index 8accf9cdbd3..fe19e417c12 100644
--- a/src/features/Marketplace/Apps/catalog.ts
+++ b/src/features/Marketplace/Apps/catalog.ts
@@ -1,4 +1,5 @@
import type { ConnectorCatalogItem, OfficialMcpServerType } from '@lobechat/const';
+import qs from 'query-string';
import type { MessengerPlatformItem } from '@/store/messenger/projection';
@@ -48,6 +49,82 @@ const categoryByTool: Record<string, AppCategory> = {
'whatsapp': 'chat',
};
+/** An Apps path with its query; empty values are left out. */
+export const appUrl = (path: string, query: Record<string, string | undefined>) =>
+ qs.stringifyUrl({ query, url: path }, { skipEmptyString: true, skipNull: true });
+
+/** A category shows this many apps (four two-column rows) until "View all" opens its page. */
+export const CATEGORY_PREVIEW_COUNT = 8;
+
+/** Whether `value` names one of the catalog's categories (a `?category=` link). */
+export const isAppCategory = (value: string | null | undefined): value is AppCategory =>
+ !!value && (appCategories as readonly string[]).includes(value);
+
+export type { AppCategory };
+
+/**
+ * Who makes the app itself, shown as its developer. The catalog's own author is
+ * whoever built the integration (LobeHub, Composio), which would read as the
+ * app's maker on a detail page, so it moves to the "Integrated by" row.
+ */
+const VENDOR_BY_ID: Record<string, { name: string; url: string }> = {
+ 'airtable': { name: 'Airtable', url: 'https://www.airtable.com' },
+ 'cal-com': { name: 'Cal.com', url: 'https://cal.com' },
+ 'clickup': { name: 'ClickUp', url: 'https://clickup.com' },
+ 'confluence': { name: 'Atlassian', url: 'https://www.atlassian.com/software/confluence' },
+ 'discord': { name: 'Discord', url: 'https://discord.com' },
+ 'dropbox': { name: 'Dropbox', url: 'https://www.dropbox.com' },
+ 'figma': { name: 'Figma', url: 'https://www.figma.com' },
+ 'github': { name: 'GitHub', url: 'https://github.com' },
+ 'gmail': { name: 'Google', url: 'https://mail.google.com' },
+ 'google-calendar': { name: 'Google', url: 'https://calendar.google.com' },
+ 'google-docs': { name: 'Google', url: 'https://docs.google.com' },
+ 'google-drive': { name: 'Google', url: 'https://drive.google.com' },
+ 'google-sheets': { name: 'Google', url: 'https://sheets.google.com' },
+ 'hubspot': { name: 'HubSpot', url: 'https://www.hubspot.com' },
+ 'jira': { name: 'Atlassian', url: 'https://www.atlassian.com/software/jira' },
+ 'linear': { name: 'Linear', url: 'https://linear.app' },
+ 'microsoft': { name: 'Microsoft', url: 'https://www.microsoft.com' },
+ 'notion': { name: 'Notion', url: 'https://www.notion.com' },
+ 'onedrive': { name: 'Microsoft', url: 'https://onedrive.live.com' },
+ 'outlook-mail': { name: 'Microsoft', url: 'https://outlook.live.com' },
+ 'posthog': { name: 'PostHog', url: 'https://posthog.com' },
+ 'salesforce': { name: 'Salesforce', url: 'https://www.salesforce.com' },
+ 'slack': { name: 'Slack', url: 'https://slack.com' },
+ 'supabase': { name: 'Supabase', url: 'https://supabase.com' },
+ 'telegram': { name: 'Telegram', url: 'https://telegram.org' },
+ 'twitter': { name: 'X', url: 'https://x.com' },
+ 'vercel': { name: 'Vercel', url: 'https://vercel.com' },
+ 'wechat': { name: 'Tencent', url: 'https://www.wechat.com' },
+ 'whatsapp': { name: 'Meta', url: 'https://www.whatsapp.com' },
+ 'youtube': { name: 'Google', url: 'https://www.youtube.com' },
+ 'zendesk': { name: 'Zendesk', url: 'https://www.zendesk.com' },
+};
+
+export interface AppFacts {
+ /** Who built the integration; absent when it is the vendor itself. */
+ integrator?: string;
+ vendor: string;
+ vendorUrl?: string;
+}
+
+/** The "Information" card's maker rows: the app's vendor, then who integrated it. */
+export const getAppFacts = (app: Pick<MarketplaceApp, 'id' | 'name' | 'tool'>): AppFacts => {
+ const integrator =
+ app.tool?.type === 'composio'
+ ? 'Composio'
+ : app.tool?.type === 'lobehub'
+ ? 'LobeHub'
+ : undefined;
+ const vendor = VENDOR_BY_ID[app.id];
+ if (!vendor) return { vendor: integrator ?? app.name };
+ return {
+ integrator: integrator && integrator !== vendor.name ? integrator : undefined,
+ vendor: vendor.name,
+ vendorUrl: vendor.url,
+ };
+};
+
export const hasAppConnection = (app: MarketplaceApp) =>
app.channelLinked || app.toolConnected || app.integrationConnected;
diff --git a/src/features/Marketplace/Apps/useAppSummary.ts b/src/features/Marketplace/Apps/useAppSummary.ts
new file mode 100644
index 00000000000..33c60d87e99
--- /dev/null
+++ b/src/features/Marketplace/Apps/useAppSummary.ts
@@ -0,0 +1,29 @@
+import { useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import type { MarketplaceApp } from './catalog';
+
+/** What an app does in one line: its channel or tool blurb, localized when there is one. */
+export const useAppSummary = () => {
+ const { t } = useTranslation('discover');
+ const { t: tm } = useTranslation('messenger');
+ return useCallback(
+ ({
+ channel,
+ id,
+ officialMcp,
+ tool,
+ }: Pick<MarketplaceApp, 'channel' | 'id' | 'officialMcp' | 'tool'>) =>
+ channel
+ ? t(`apps.summary.channel.${channel.id}`, {
+ defaultValue: tm(`messenger.list.${channel.id}.description`),
+ })
+ : t(`apps.summary.tool.${id}`, {
+ defaultValue:
+ (tool?.type === 'lobehub'
+ ? tool.provider.description
+ : (tool?.serverType.description ?? officialMcp?.description)) ?? '',
+ }),
+ [t, tm],
+ );
+};