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): align Skills with the other catalogs and port Lobot's Market fixes (#23770)

Arvin Xu6d0626aeb2dc
diff --git a/src/components/Skeleton/MarketplaceCatalog.tsx b/src/components/Skeleton/MarketplaceCatalog.tsx
index 020b4412295..e949efdf07d 100644
--- a/src/components/Skeleton/MarketplaceCatalog.tsx
+++ b/src/components/Skeleton/MarketplaceCatalog.tsx
@@ -1,6 +1,7 @@
'use client';
import { Flexbox } from '@lobehub/ui';
+import { Surface } from '@lobehub/ui/dashboard';
import * as stylex from '@stylexjs/stylex';
import { catalogStyles } from '@/features/Marketplace/Catalog/styles';
@@ -48,3 +49,65 @@ export const MarketplaceCatalogSkeleton = ({ chrome = 'page' }: RouteSkeletonPro
</div>
</CommunityPageChrome>
);
+
+const FACT_WIDTHS = ['36%', '24%', '30%', '42%'];
+
+/**
+ * A Marketplace page (Agent, skill, app) while it loads, in the shape it
+ * renders: the 56px picture with name, blurb and actions, the source line, then
+ * the content cards (rows, then the facts).
+ */
+export const MarketplaceDetailBodySkeleton = () => (
+ <Flexbox aria-busy gap={24}>
+ <Flexbox horizontal align={'center'} gap={16}>
+ <SkeletonBar height={56} radius={14} width={56} />
+ <Flexbox flex={1} gap={8} style={{ minWidth: 0 }}>
+ <SkeletonBar height={22} width={'min(100%, 220px)'} />
+ <SkeletonBar height={14} width={'min(100%, 420px)'} />
+ </Flexbox>
+ <Flexbox horizontal flex={'none'} gap={8}>
+ <SkeletonBar height={32} radius={8} width={88} />
+ <SkeletonBar height={32} radius={8} width={88} />
+ </Flexbox>
+ </Flexbox>
+ <SkeletonBar height={14} width={'min(100%, 320px)'} />
+ <Flexbox gap={8}>
+ <SkeletonBar height={16} width={64} />
+ <Surface>
+ <Flexbox gap={12} padding={16}>
+ {Array.from({ length: 3 }, (_, index) => (
+ <Flexbox horizontal align={'center'} gap={12} key={index}>
+ <SkeletonBar height={36} radius={8} width={36} />
+ <Flexbox flex={1} gap={6}>
+ <SkeletonBar height={14} width={'32%'} />
+ <SkeletonBar height={12} width={'58%'} />
+ </Flexbox>
+ </Flexbox>
+ ))}
+ </Flexbox>
+ </Surface>
+ </Flexbox>
+ <Flexbox gap={8}>
+ <SkeletonBar height={16} width={64} />
+ <Surface>
+ <Flexbox gap={10} padding={16}>
+ {FACT_WIDTHS.map((width, index) => (
+ <Flexbox horizontal gap={24} key={index}>
+ <SkeletonBar height={14} width={96} />
+ <SkeletonBar height={14} width={width} />
+ </Flexbox>
+ ))}
+ </Flexbox>
+ </Surface>
+ </Flexbox>
+ </Flexbox>
+);
+
+/** The detail routes' skeleton: the page chrome, then the detail body in the centered column. */
+export const MarketplaceDetailSkeleton = ({ chrome = 'page' }: RouteSkeletonProps) => (
+ <CommunityPageChrome chrome={chrome}>
+ <div {...stylex.props(catalogStyles.frame)}>
+ <MarketplaceDetailBodySkeleton />
+ </div>
+ </CommunityPageChrome>
+);
diff --git a/src/features/Marketplace/Agents/marketAgentCatalog.ts b/src/features/Marketplace/Agents/marketAgentCatalog.ts
index 91ad504126d..617a41a5e7f 100644
--- a/src/features/Marketplace/Agents/marketAgentCatalog.ts
+++ b/src/features/Marketplace/Agents/marketAgentCatalog.ts
@@ -45,8 +45,8 @@ export const AGENT_PREVIEW_COUNT = 4;
export const isMarketplaceCategory = (value?: string): value is MarketplaceCategory =>
!!value && (AGENT_CATEGORY_ORDER as string[]).includes(value);
+/** LobeHub's own picks carry no author line: they are all official. */
export const fromTemplate = (template: AgentTemplate): MarketAgentSummary => ({
- author: template.author,
avatar: template.avatar,
category: template.category,
description: template.description,
diff --git a/src/features/Marketplace/Apps/AppDetail.tsx b/src/features/Marketplace/Apps/AppDetail.tsx
index a125ed20453..5f3c92dfec2 100644
--- a/src/features/Marketplace/Apps/AppDetail.tsx
+++ b/src/features/Marketplace/Apps/AppDetail.tsx
@@ -11,7 +11,7 @@ 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 { MarketplaceDetailBodySkeleton } from '@/components/Skeleton/MarketplaceCatalog';
import { ConnectorDetailEmbeddedContext } from '@/features/Connectors/ConnectorDetail';
import { hasConnectorPage } from '@/features/Integrations/connectorPage';
import InstallResult from '@/features/Messenger/InstallResult';
@@ -228,7 +228,7 @@ export default function AppDetail() {
error={error}
isEmpty={!app}
isLoading={loading}
- loading={<CatalogRowsSkeleton />}
+ loading={<MarketplaceDetailBodySkeleton />}
onRetry={retry}
>
{app && (
diff --git a/src/features/Marketplace/Catalog/AgentCatalog.tsx b/src/features/Marketplace/Catalog/AgentCatalog.tsx
index 19bb157f51c..82aca1bd505 100644
--- a/src/features/Marketplace/Catalog/AgentCatalog.tsx
+++ b/src/features/Marketplace/Catalog/AgentCatalog.tsx
@@ -1,6 +1,6 @@
'use client';
-import { Center, Tabs, Text } from '@lobehub/ui';
+import { Center, Segmented, Text } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -393,15 +393,14 @@ export const AgentCatalog = () => {
<DiscoverCatalogHeader
kind={'agent'}
titleExtra={
- <Tabs
- activeKey={tab}
- size={'small'}
- variant={'square'}
- items={TABS.map((value) => ({
- key: value,
+ <Segmented
+ value={tab}
+ variant={'outlined'}
+ options={TABS.map((value) => ({
label: t(`marketplaceAgents.tabs.${value}`),
+ value,
}))}
- onChange={(key) => setTab(key as AgentsTab)}
+ onChange={(value) => setTab(value as AgentsTab)}
/>
}
/>
diff --git a/src/features/Marketplace/Skills/SkillsPage.tsx b/src/features/Marketplace/Skills/SkillsPage.tsx
index 65b33dbb76f..638466a87c8 100644
--- a/src/features/Marketplace/Skills/SkillsPage.tsx
+++ b/src/features/Marketplace/Skills/SkillsPage.tsx
@@ -2,17 +2,19 @@ import { ActionIcon, Button, Center, Flexbox, SearchBar, Text } from '@lobehub/u
import { GithubIcon } from '@lobehub/ui/icons';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
-import { useDebounce, useInViewport } from 'ahooks';
+import { useDebounce, useInViewport, useMemoizedFn } from 'ahooks';
import { ChevronRight } from 'lucide-react';
import { memo, type ReactNode, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { SCROLL_PARENT_ID } from '@/routes/(main)/community/features/const';
import { useDiscoverStore } from '@/store/discover';
import { skillSelectors } from '@/store/discover/selectors';
import { useToolStore } from '@/store/tool';
import { agentSkillsSelectors } from '@/store/tool/selectors';
import { SkillCategory, SkillSorts } from '@/types/discover';
+import { catalogStyles } from '../Catalog/styles';
import BackLink from './BackLink';
import { CustomSkills, useCustomSkills } from './CustomSkills';
import GithubImportPage from './github/GithubImportPage';
@@ -26,6 +28,7 @@ import { parseGithubSource } from './github/githubSource';
import { RowGridSkeleton, SectionSkeleton } from './MarketSkeleton';
import SkillRow, { type SkillSummary } from './SkillRow';
import { useSkillsNav } from './useSkillsNav';
+import VirtualGrid, { MarketScrollProvider } from './VirtualGrid';
/** Rows a group previews before its "all" arrow. */
const PREVIEW_COUNT = 6;
@@ -38,12 +41,6 @@ const styles = stylex.create({
height: 1,
backgroundColor: cssVar.colorBorderSecondary,
},
- grid: {
- display: 'grid',
- gridTemplateColumns: 'repeat(2, minmax(0, 1fr))',
- columnGap: 16,
- rowGap: 4,
- },
header: {
display: 'flex',
alignItems: 'center',
@@ -99,21 +96,25 @@ const useMarketSkills = (
return { isLoading, items: list?.items ?? [], total: list?.totalCount ?? 0 };
};
-/** Rows in two columns; `withAgents` (the installed skills) shows how many assistants have each on. */
+const skillKey = (skill: SkillSummary) => skill.identifier;
+
+/**
+ * Rows in two columns, only those near the viewport mounted; `withAgents` (the
+ * installed skills) shows how many assistants have each on.
+ */
const SkillGrid = memo<{ skills: SkillSummary[]; withAgents?: boolean }>(
({ skills, withAgents = false }) => {
const { openSkill } = useSkillsNav();
+ // Stable, so the rows the grid keeps mounted still open with the current navigation.
+ const open = useMemoizedFn((identifier: string) => openSkill(identifier));
return (
- <div {...stylex.props(styles.grid)}>
- {skills.map((skill) => (
- <SkillRow
- key={skill.identifier}
- showAgents={withAgents}
- skill={skill}
- onOpen={() => openSkill(skill.identifier)}
- />
- ))}
- </div>
+ <VirtualGrid
+ getKey={skillKey}
+ items={skills}
+ renderItem={(skill) => (
+ <SkillRow showAgents={withAgents} skill={skill} onOpen={() => open(skill.identifier)} />
+ )}
+ />
);
},
);
@@ -153,6 +154,15 @@ const useCategoryName = () => {
t(`skills.categories.${category}.name`, { defaultValue: category }) as string;
};
+/**
+ * The Market's own taxonomy. Its category list also carries the free-text tags
+ * skill authors typed (hundreds, most with a handful of skills); those stay
+ * reachable by search but do not get a group each.
+ */
+const CATALOG_CATEGORIES = new Set<string>(
+ Object.values(SkillCategory).filter((category) => category !== SkillCategory.All),
+);
+
/** Categories already scrolled to while the app is open. */
const seenCategories = new Set<string>();
@@ -204,7 +214,7 @@ const Catalog = memo(() => {
const groups = useMemo(
() =>
(categories ?? [])
- .filter((item) => item.category !== SkillCategory.All && item.count > 0)
+ .filter((item) => CATALOG_CATEGORIES.has(item.category) && item.count > 0)
.toSorted((a, b) => b.count - a.count),
[categories],
);
@@ -366,7 +376,7 @@ GroupPage.displayName = 'MarketSkillGroupPage';
* GitHub address offers that repository instead. "Add from GitHub" opens the
* GitHub import page with an empty address.
*/
-const SkillsPage = memo(() => {
+const SkillsPageContent = memo(() => {
const { t } = useTranslation('setting');
const [query, setQuery] = useState('');
const q = useDebounce(query.trim(), { wait: 300 });
@@ -403,6 +413,17 @@ const SkillsPage = memo(() => {
);
});
+SkillsPageContent.displayName = 'MarketSkillsPageContent';
+
+/** In the Marketplace's centered column, like the other catalogs and their pages. */
+const SkillsPage = memo(() => (
+ <MarketScrollProvider viewportId={SCROLL_PARENT_ID}>
+ <div {...stylex.props(catalogStyles.frame)}>
+ <SkillsPageContent />
+ </div>
+ </MarketScrollProvider>
+));
+
SkillsPage.displayName = 'MarketSkillsPage';
export default SkillsPage;
diff --git a/src/features/Marketplace/Skills/VirtualGrid.tsx b/src/features/Marketplace/Skills/VirtualGrid.tsx
new file mode 100644
index 00000000000..34fb5278b0b
--- /dev/null
+++ b/src/features/Marketplace/Skills/VirtualGrid.tsx
@@ -0,0 +1,248 @@
+import { useSize } from 'ahooks';
+import { useMasonry, usePositioner, useResizeObserver } from 'masonic';
+import {
+ type ComponentType,
+ createContext,
+ memo,
+ type ReactNode,
+ use,
+ useEffect,
+ useLayoutEffect,
+ useMemo,
+ useRef,
+ useState,
+} from 'react';
+
+/** Two columns, 16px apart, rows 4px apart: the grid every Market list uses. */
+const COLUMN_COUNT = 2;
+const COLUMN_GUTTER = 16;
+const ROW_GUTTER = 4;
+/** A row is a 40px tile plus 8px above and below, then the gutter. */
+const ROW_HEIGHT_ESTIMATE = 56 + ROW_GUTTER;
+/** Scroll updates are batched to at most this many renders a second. */
+const SCROLL_FPS = 30;
+/** How long after the last scroll event the list stops counting as scrolling. */
+const SCROLL_IDLE_MS = 150;
+
+interface MarketScroll {
+ height: number;
+ isScrolling: boolean;
+ scrollTop: number;
+ viewport: HTMLElement | null;
+}
+
+const MarketScrollContext = createContext<MarketScroll | null>(null);
+
+/**
+ * The page's scroll container (found by its element id), shared by every grid
+ * on the page, so a page of many groups listens to the scroll once rather than
+ * once per group.
+ */
+export const MarketScrollProvider = ({
+ children,
+ viewportId,
+}: {
+ children: ReactNode;
+ viewportId: string;
+}) => {
+ // `undefined` until looked up; `null` when the page has no such container.
+ const [viewport, setViewport] = useState<HTMLElement | null | undefined>(undefined);
+ const [state, setState] = useState({ height: 0, isScrolling: false, scrollTop: 0 });
+
+ useEffect(() => {
+ setViewport(document.getElementById(viewportId));
+ }, [viewportId]);
+
+ useEffect(() => {
+ if (!viewport) return;
+ let frame = 0;
+ let last = 0;
+ let idle: ReturnType<typeof setTimeout> | undefined;
+
+ const read = (isScrolling: boolean) =>
+ setState((prev) => {
+ const next = { height: viewport.clientHeight, isScrolling, scrollTop: viewport.scrollTop };
+ return prev.height === next.height &&
+ prev.isScrolling === next.isScrolling &&
+ prev.scrollTop === next.scrollTop
+ ? prev
+ : next;
+ });
+
+ const onScroll = () => {
+ clearTimeout(idle);
+ idle = setTimeout(() => read(false), SCROLL_IDLE_MS);
+ if (frame) return;
+ frame = requestAnimationFrame((now) => {
+ frame = 0;
+ if (now - last < 1000 / SCROLL_FPS) {
+ // Too soon: try again next frame so the last position still lands.
+ onScroll();
+ return;
+ }
+ last = now;
+ read(true);
+ });
+ };
+
+ const resize = new ResizeObserver(() => read(false));
+ resize.observe(viewport);
+ viewport.addEventListener('scroll', onScroll, { passive: true });
+ read(false);
+
+ return () => {
+ cancelAnimationFrame(frame);
+ clearTimeout(idle);
+ resize.disconnect();
+ viewport.removeEventListener('scroll', onScroll);
+ };
+ }, [viewport]);
+
+ const value = useMemo(
+ () => (viewport === null ? null : { ...state, viewport: viewport ?? null }),
+ [state, viewport],
+ );
+
+ return <MarketScrollContext value={value}>{children}</MarketScrollContext>;
+};
+
+/**
+ * Bumps when `items` stops extending the previous list. Masonic keeps every
+ * cell's measured position, so a list that shrank or reordered needs a fresh
+ * positioner; one that only grew ("Load more") keeps its measurements.
+ */
+const useResetVersion = <T,>(items: T[], getKey: (item: T) => string) => {
+ const keys = items.map(getKey);
+ const [seen, setSeen] = useState({ keys, version: 0 });
+ const same =
+ keys.length === seen.keys.length && seen.keys.every((key, index) => key === keys[index]);
+ if (!same) {
+ const grew =
+ keys.length > seen.keys.length && seen.keys.every((key, index) => key === keys[index]);
+ setSeen({ keys, version: grew ? seen.version : seen.version + 1 });
+ }
+ return same ? seen.version : seen.version + 1;
+};
+
+/** Where `container` starts inside the viewport's scrolled content. */
+const measureOffset = (container: HTMLElement, viewport: HTMLElement) =>
+ container.getBoundingClientRect().top - viewport.getBoundingClientRect().top + viewport.scrollTop;
+
+interface VirtualGridProps<T extends object> {
+ getKey: (item: T) => string;
+ items: T[];
+ renderItem: (item: T) => ReactNode;
+}
+
+/** The masonic grid itself; mounted once its container has a width. */
+const Grid = <T extends object>({
+ container,
+ getKey,
+ items,
+ renderItem,
+ scroll,
+ viewport,
+ width,
+}: VirtualGridProps<T> & {
+ container: HTMLDivElement;
+ scroll: MarketScroll;
+ viewport: HTMLElement;
+ width: number;
+}) => {
+ const version = useResetVersion(items, getKey);
+ const positioner = usePositioner(
+ {
+ columnCount: COLUMN_COUNT,
+ columnGutter: COLUMN_GUTTER,
+ rowGutter: ROW_GUTTER,
+ width,
+ },
+ [version],
+ );
+ const resizeObserver = useResizeObserver(positioner);
+
+ // Measured up front so a grid below the fold renders none of its rows on mount.
+ const [offset, setOffset] = useState(() => measureOffset(container, viewport));
+ // Groups above the grid can change size, so the offset is re-read after every render.
+ // oxlint-disable-next-line react-hooks/exhaustive-deps
+ useLayoutEffect(() => {
+ const next = measureOffset(container, viewport);
+ setOffset((prev) => (Math.abs(prev - next) < 1 ? prev : next));
+ });
+
+ // Masonic caches each cell element by its render component and data, so cells
+ // read the latest `renderItem` from a ref instead of taking it as a prop.
+ const renderRef = useRef(renderItem);
+ useLayoutEffect(() => {
+ renderRef.current = renderItem;
+ });
+ const Cell = useMemo<ComponentType<{ data: T; index: number; width: number }>>(
+ () =>
+ function MarketGridCell({ data }) {
+ return renderRef.current(data);
+ },
+ [],
+ );
+
+ return useMasonry({
+ height: scroll.height,
+ isScrolling: scroll.isScrolling,
+ itemHeightEstimate: ROW_HEIGHT_ESTIMATE,
+ itemKey: getKey,
+ items,
+ overscanBy: 2,
+ positioner,
+ render: Cell,
+ resizeObserver,
+ role: 'list',
+ // Negative while the grid is still below the viewport, so nothing of it renders yet.
+ scrollTop: scroll.scrollTop - offset,
+ tabIndex: -1,
+ });
+};
+
+/**
+ * A two-column Market list that only renders the rows near the viewport (masonic).
+ * Rows below the fold keep their estimated space, so the scrollbar stays put.
+ * Outside a scroll provider it renders every row.
+ */
+const VirtualGrid = <T extends object>(props: VirtualGridProps<T>) => {
+ const scroll = use(MarketScrollContext);
+ const [container, setContainer] = useState<HTMLDivElement | null>(null);
+ const size = useSize(container);
+ const width = size?.width ?? 0;
+
+ if (!scroll)
+ return (
+ <div
+ style={{
+ columnGap: COLUMN_GUTTER,
+ display: 'grid',
+ gridTemplateColumns: `repeat(${COLUMN_COUNT}, minmax(0, 1fr))`,
+ rowGap: ROW_GUTTER,
+ }}
+ >
+ {props.items.map((item) => (
+ <div key={props.getKey(item)}>{props.renderItem(item)}</div>
+ ))}
+ </div>
+ );
+
+ const { viewport } = scroll;
+ const ready = container && viewport && scroll.height > 0 && width > 0;
+
+ return (
+ <div ref={setContainer}>
+ {ready ? (
+ <Grid {...props} container={container} scroll={scroll} viewport={viewport} width={width} />
+ ) : (
+ // Until the grid can measure, hold the space its rows will take.
+ <div
+ style={{ height: Math.ceil(props.items.length / COLUMN_COUNT) * ROW_HEIGHT_ESTIMATE }}
+ />
+ )}
+ </div>
+ );
+};
+
+export default memo(VirtualGrid) as typeof VirtualGrid;
diff --git a/src/features/Marketplace/Skills/useSkillAgents.ts b/src/features/Marketplace/Skills/useSkillAgents.ts
index b1f7c5efe9f..65300fb95cf 100644
--- a/src/features/Marketplace/Skills/useSkillAgents.ts
+++ b/src/features/Marketplace/Skills/useSkillAgents.ts
@@ -50,6 +50,8 @@ const modesCache = new Map<string, Record<string, ExplicitMode>>();
const toModes = (rows: { agentId: string; mode: ExplicitMode }[]) =>
Object.fromEntries(rows.map(({ agentId, mode }) => [agentId, mode]));
+const EMPTY_AGENTS: SidebarAgentItem[] = [];
+
/** My own LobeHub assistants; external runtimes and other people's agents are left out. */
export const useMyAgentCandidates = (enabled: boolean) => {
const isLogin = useUserStore(authSelectors.isLogin);
@@ -57,16 +59,15 @@ export const useMyAgentCandidates = (enabled: boolean) => {
const useFetchAgentList = useHomeStore((s) => s.useFetchAgentList);
useFetchAgentList(enabled && isLogin);
+ // Every skill row calls this; only the installed ones need the list.
return useHomeStore(
useShallow((s) =>
- homeAgentListSelectors
- .allAgents(s)
- .filter(
- (item) =>
- item.type === 'agent' &&
- !item.heterogeneousType &&
- (!item.userId || item.userId === userId),
- ),
+ (enabled ? homeAgentListSelectors.allAgents(s) : EMPTY_AGENTS).filter(
+ (item) =>
+ item.type === 'agent' &&
+ !item.heterogeneousType &&
+ (!item.userId || item.userId === userId),
+ ),
),
);
};
diff --git a/src/features/RouteMeta/communityRouteMeta.ts b/src/features/RouteMeta/communityRouteMeta.ts
index aa3cbcaca37..68293ba85e9 100644
--- a/src/features/RouteMeta/communityRouteMeta.ts
+++ b/src/features/RouteMeta/communityRouteMeta.ts
@@ -1,6 +1,7 @@
import { ShapesIcon } from 'lucide-react';
import { lazy } from 'react';
+import { MarketplaceDetailSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
import { type RouteMeta, routeMeta } from '@/spa/router/routeMeta';
import type * as CommunityDynamicMetas from './CommunityDynamicMeta';
@@ -8,8 +9,12 @@ import type * as CommunityDynamicMetas from './CommunityDynamicMeta';
type CommunityDynamicMetaName = keyof typeof CommunityDynamicMetas;
// Route metas load with the router on first paint; keep the Discover store out of that graph.
-const createCommunityDetailRouteMeta = (name: CommunityDynamicMetaName): RouteMeta =>
+const createCommunityDetailRouteMeta = (
+ name: CommunityDynamicMetaName,
+ Skeleton?: RouteMeta['Skeleton'],
+): RouteMeta =>
routeMeta({
+ ...(Skeleton && { Skeleton }),
DynamicMeta: lazy(() =>
import('./CommunityDynamicMeta').then((module) => ({ default: module[name] })),
),
@@ -19,11 +24,12 @@ const createCommunityDetailRouteMeta = (name: CommunityDynamicMetaName): RouteMe
/** Community detail routes (`/marketplace/<type>/:slug`), titled after the item they show. */
export const communityDetailRouteMeta = {
- agent: createCommunityDetailRouteMeta('AssistantDynamicMeta'),
+ // Agent and skill pages are the Marketplace design; their skeleton draws that page.
+ agent: createCommunityDetailRouteMeta('AssistantDynamicMeta', MarketplaceDetailSkeleton),
groupAgent: createCommunityDetailRouteMeta('GroupAgentDynamicMeta'),
mcp: createCommunityDetailRouteMeta('McpDynamicMeta'),
model: createCommunityDetailRouteMeta('ModelDynamicMeta'),
provider: createCommunityDetailRouteMeta('ProviderDynamicMeta'),
- skill: createCommunityDetailRouteMeta('SkillDynamicMeta'),
+ skill: createCommunityDetailRouteMeta('SkillDynamicMeta', MarketplaceDetailSkeleton),
user: createCommunityDetailRouteMeta('UserDynamicMeta'),
} satisfies Record<string, RouteMeta>;
diff --git a/src/routes/(main)/community/(detail)/skill/index.tsx b/src/routes/(main)/community/(detail)/skill/index.tsx
index 11a257b791a..696c5e4ebde 100644
--- a/src/routes/(main)/community/(detail)/skill/index.tsx
+++ b/src/routes/(main)/community/(detail)/skill/index.tsx
@@ -1,12 +1,14 @@
'use client';
import { Flexbox } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { memo, useCallback } from 'react';
import { useLocation, useParams, useSearchParams } from 'react-router';
import AsyncError from '@/components/AsyncError';
import { RouteLoading } from '@/components/Skeleton/RouteSegment';
import { SkillDetailView, SkillNavKey } from '@/features/CommunitySkillDetail';
+import { catalogStyles } from '@/features/Marketplace/Catalog/styles';
import MarketplaceSkillDetail from '@/features/Marketplace/Skills/SkillDetail';
import { useQuery } from '@/hooks/useQuery';
import { useDiscoverStore } from '@/store/discover';
@@ -83,11 +85,12 @@ export const MobileSkillPage = (_props: { mobile?: boolean }) => {
*/
const DesktopSkillPage = memo(() => {
const { slug = '' } = useParams<{ slug: string }>();
- // The detail layout's header already carries the back arrow.
+ // The detail layout's header already carries the back arrow; the centered
+ // column matches the Agent and App pages.
return (
- <Flexbox data-testid="skill-detail-content" gap={16}>
+ <div data-testid="skill-detail-content" {...stylex.props(catalogStyles.frame)}>
<MarketplaceSkillDetail identifier={slug} key={slug} />
- </Flexbox>
+ </div>
);
});
diff --git a/src/spa/router/marketplaceRoutes.tsx b/src/spa/router/marketplaceRoutes.tsx
index 2b9a78943f1..9d1adcf682a 100644
--- a/src/spa/router/marketplaceRoutes.tsx
+++ b/src/spa/router/marketplaceRoutes.tsx
@@ -5,7 +5,10 @@ import { lazy } from 'react';
import { type RouteObject, useParams, useSearchParams } from 'react-router';
import CommunityListSkeleton from '@/components/Skeleton/CommunityList';
-import { MarketplaceCatalogSkeleton } from '@/components/Skeleton/MarketplaceCatalog';
+import {
+ MarketplaceCatalogSkeleton,
+ MarketplaceDetailSkeleton,
+} from '@/components/Skeleton/MarketplaceCatalog';
import { createSurfaceSkeleton } from '@/components/Skeleton/Surface';
import {
getLegacyConnectorCatalogPath,
@@ -129,7 +132,7 @@ export const marketplaceAppAndMcpRoutes: RouteObject[] = [
meta: routeMeta({
DynamicMeta: lazy(() => import('@/features/Marketplace/Apps/AppDynamicMeta')),
icon: Blocks,
- Skeleton: createSurfaceSkeleton('detail'),
+ Skeleton: MarketplaceDetailSkeleton,
titleKey: 'navigation.marketplaceApps',
}),
},