🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(skill): open community skill detail in a redesigned modal (#17260)
AmAzing-2c99722b6b12
diff --git a/locales/en-US/discover.json b/locales/en-US/discover.jsonindex 6fd8d7ec0e9..bb1344db08c 100644--- a/locales/en-US/discover.json+++ b/locales/en-US/discover.json@@ -553,31 +553,45 @@"skills.categories.transportation.name": "Transportation","skills.categories.web-frontend-development.description": "Web development, frontend frameworks, and UI tooling skills","skills.categories.web-frontend-development.name": "Web & Frontend Development",- "skills.details.nav.needHelp": "Need Help?",- "skills.details.nav.reportIssue": "Report Issue",- "skills.details.nav.viewSourceCode": "View Source Code",+ "skills.details.comments.anonymous": "Anonymous",+ "skills.details.comments.loadMore": "Load More",+ "skills.details.comments.noComments": "No reviews yet",+ "skills.details.header.installed": "Installed",+ "skills.details.header.stats.github": "GitHub",+ "skills.details.header.stats.installs": "Installs",+ "skills.details.header.stats.rating": "Rating",+ "skills.details.header.stats.ratingCount": "{{count}} Ratings",+ "skills.details.header.stats.reviews": "Reviews",+ "skills.details.header.stats.starsCaption": "Stars",+ "skills.details.info.category": "Category",+ "skills.details.info.installs": "Installs",+ "skills.details.info.license": "License",+ "skills.details.info.publisher": "Publisher",+ "skills.details.info.source": "Source",+ "skills.details.info.stars": "Stars",+ "skills.details.info.updated": "Updated",+ "skills.details.info.version": "Version",+ "skills.details.info.viewOnGithub": "View on GitHub",+ "skills.details.info.viewSource": "View source",+ "skills.details.installation.filesIncluded": "Files Included",+ "skills.details.nav.info": "Info",+ "skills.details.nav.install": "Install",+ "skills.details.nav.reviews": "Reviews",+ "skills.details.overview.about": "About",+ "skills.details.overview.features": "Features",+ "skills.details.overview.instructions": "SKILL.md","skills.details.overview.title": "Overview",- "skills.details.rating.title": "Ratings",- "skills.details.related.empty": "No related Skills yet",+ "skills.details.overview.version": "Version {{version}}",+ "skills.details.overview.whatsNew": "What's New",+ "skills.details.rating.noRatings": "No ratings yet",+ "skills.details.rating.totalRatings": "{{count}} ratings","skills.details.related.listTitle": "Related Skills","skills.details.related.more": "View More",- "skills.details.related.title": "Related Skills",- "skills.details.resources.empty": "No resources available",- "skills.details.resources.table.name": "Name",- "skills.details.resources.table.size": "Size",- "skills.details.resources.title": "Resources",- "skills.details.review.title": "How to Submit a Review",- "skills.details.sidebar.agent.copied": "Prompt Copied",- "skills.details.sidebar.agent.copyPrompt": "Copy Prompt","skills.details.sidebar.agent.title": "Send this prompt to your Agent to install this Skill","skills.details.sidebar.agent.useOnLobeAI": "Use on LobeAI",- "skills.details.sidebar.description": "Description",- "skills.details.sidebar.details": "Details","skills.details.sidebar.directoryLayout": "Directory Layout","skills.details.sidebar.downloadSkill": "Download Skill",- "skills.details.sidebar.files": "File Tree","skills.details.sidebar.installCommand": "Install Command",- "skills.details.sidebar.installationConfig": "Installation","skills.details.sidebar.platform.layout.lobehub": "Skills are managed by LobeHub automatically","skills.details.sidebar.platform.layout.resourcesHint": "other resources","skills.details.sidebar.platform.steps.claude": "Run the install command in your terminal to download and configure this skill for Claude Code.",@@ -587,13 +601,6 @@"skills.details.sidebar.platform.steps.lobehub": "Install directly from the LobeHub marketplace with one click.","skills.details.sidebar.platform.steps.vscode": "Run the install command in your terminal to download and configure this skill for VS Code.","skills.details.sidebar.platform.title": "Install on {{platform}}",- "skills.details.sidebar.tags": "Tags",- "skills.details.summary.title": "Summary",- "skills.details.versions.empty": "No historical versions yet",- "skills.details.versions.table.isLatest": "Latest",- "skills.details.versions.table.publishAt": "Published",- "skills.details.versions.table.version": "Version",- "skills.details.versions.title": "Version History","skills.hero.guide.agent": "I am Agent","skills.hero.guide.human": "I am Human","skills.sorts.createdAt": "Recently Published",diff --git a/locales/zh-CN/discover.json b/locales/zh-CN/discover.jsonindex 31e56414587..81e3ea97402 100644--- a/locales/zh-CN/discover.json+++ b/locales/zh-CN/discover.json@@ -553,31 +553,45 @@"skills.categories.transportation.name": "交通运输","skills.categories.web-frontend-development.description": "Web开发、前端框架和UI工具技能","skills.categories.web-frontend-development.name": "Web与前端开发",- "skills.details.nav.needHelp": "需要帮助?",- "skills.details.nav.reportIssue": "报告问题",- "skills.details.nav.viewSourceCode": "查看源码",+ "skills.details.comments.anonymous": "匿名用户",+ "skills.details.comments.loadMore": "加载更多",+ "skills.details.comments.noComments": "暂无评价",+ "skills.details.header.installed": "已安装",+ "skills.details.header.stats.github": "GitHub",+ "skills.details.header.stats.installs": "安装量",+ "skills.details.header.stats.rating": "评分",+ "skills.details.header.stats.ratingCount": "{{count}} 个评分",+ "skills.details.header.stats.reviews": "评价",+ "skills.details.header.stats.starsCaption": "Stars",+ "skills.details.info.category": "分类",+ "skills.details.info.installs": "安装量",+ "skills.details.info.license": "许可证",+ "skills.details.info.publisher": "发布者",+ "skills.details.info.source": "源码",+ "skills.details.info.stars": "Stars",+ "skills.details.info.updated": "更新时间",+ "skills.details.info.version": "版本",+ "skills.details.info.viewOnGithub": "在 GitHub 查看",+ "skills.details.info.viewSource": "查看源码",+ "skills.details.installation.filesIncluded": "包含文件",+ "skills.details.nav.info": "信息",+ "skills.details.nav.install": "安装",+ "skills.details.nav.reviews": "评价",+ "skills.details.overview.about": "关于",+ "skills.details.overview.features": "特性",+ "skills.details.overview.instructions": "SKILL.md","skills.details.overview.title": "概览",- "skills.details.rating.title": "评分",- "skills.details.related.empty": "暂无相关技能",+ "skills.details.overview.version": "版本 {{version}}",+ "skills.details.overview.whatsNew": "更新内容",+ "skills.details.rating.noRatings": "暂无评分",+ "skills.details.rating.totalRatings": "{{count}} 个评分","skills.details.related.listTitle": "相关技能","skills.details.related.more": "查看更多",- "skills.details.related.title": "相关技能",- "skills.details.resources.empty": "暂无资源",- "skills.details.resources.table.name": "名称",- "skills.details.resources.table.size": "大小",- "skills.details.resources.title": "资源",- "skills.details.review.title": "如何提交评价",- "skills.details.sidebar.agent.copied": "已复制提示词",- "skills.details.sidebar.agent.copyPrompt": "复制提示词","skills.details.sidebar.agent.title": "发送此提示词给你的 Agent 以安装此技能","skills.details.sidebar.agent.useOnLobeAI": "在 LobeAI 上使用",- "skills.details.sidebar.description": "描述",- "skills.details.sidebar.details": "详情","skills.details.sidebar.directoryLayout": "目录布局","skills.details.sidebar.downloadSkill": "下载技能",- "skills.details.sidebar.files": "文件树","skills.details.sidebar.installCommand": "安装命令",- "skills.details.sidebar.installationConfig": "安装方式","skills.details.sidebar.platform.layout.lobehub": "技能由 LobeHub 自动管理","skills.details.sidebar.platform.layout.resourcesHint": "其他资源","skills.details.sidebar.platform.steps.claude": "在终端运行安装命令,为 Claude Code 下载并配置此技能。",@@ -587,13 +601,6 @@"skills.details.sidebar.platform.steps.lobehub": "直接从 LobeHub 市场一键安装。","skills.details.sidebar.platform.steps.vscode": "在终端运行安装命令,为 VS Code 下载并配置此技能。","skills.details.sidebar.platform.title": "在 {{platform}} 中安装",- "skills.details.sidebar.tags": "标签",- "skills.details.summary.title": "摘要",- "skills.details.versions.empty": "暂无历史版本",- "skills.details.versions.table.isLatest": "最新版本",- "skills.details.versions.table.publishAt": "发布于",- "skills.details.versions.table.version": "版本",- "skills.details.versions.title": "版本历史","skills.hero.guide.agent": "我是 Agent","skills.hero.guide.human": "我是人类","skills.sorts.createdAt": "最近发布",diff --git a/packages/locales/src/default/discover.ts b/packages/locales/src/default/discover.tsindex b9cffe1381e..d601dd1149a 100644--- a/packages/locales/src/default/discover.ts+++ b/packages/locales/src/default/discover.ts@@ -1007,53 +1007,81 @@ export default {'Web development, frontend frameworks, and UI tooling skills','skills.categories.web-frontend-development.name': 'Web & Frontend Development',- 'skills.details.nav.needHelp': 'Need Help?',+ 'skills.details.comments.anonymous': 'Anonymous',- 'skills.details.nav.reportIssue': 'Report Issue',+ 'skills.details.comments.loadMore': 'Load More',- 'skills.details.nav.viewSourceCode': 'View Source Code',+ 'skills.details.comments.noComments': 'No reviews yet',- 'skills.details.overview.title': 'Overview',+ 'skills.details.header.installed': 'Installed',- 'skills.details.rating.title': 'Ratings',+ 'skills.details.header.stats.github': 'GitHub',- 'skills.details.related.empty': 'No related Skills yet',+ 'skills.details.header.stats.installs': 'Installs',- 'skills.details.related.listTitle': 'Related Skills',+ 'skills.details.header.stats.rating': 'Rating',- 'skills.details.related.more': 'View More',+ 'skills.details.header.stats.ratingCount': '{{count}} Ratings',- 'skills.details.related.title': 'Related Skills',+ 'skills.details.header.stats.reviews': 'Reviews',- 'skills.details.resources.empty': 'No resources available',+ 'skills.details.header.stats.starsCaption': 'Stars',- 'skills.details.resources.table.name': 'Name',+ 'skills.details.info.category': 'Category',- 'skills.details.resources.table.size': 'Size',+ 'skills.details.info.installs': 'Installs',- 'skills.details.resources.title': 'Resources',+ 'skills.details.info.license': 'License',- 'skills.details.review.title': 'How to Submit a Review',+ 'skills.details.info.publisher': 'Publisher',- 'skills.details.sidebar.agent.copied': 'Prompt Copied',+ 'skills.details.info.source': 'Source',- 'skills.details.sidebar.agent.copyPrompt': 'Copy Prompt',+ 'skills.details.info.stars': 'Stars',- 'skills.details.sidebar.agent.title': 'Send this prompt to your Agent to install this Skill',+ 'skills.details.info.updated': 'Updated',- 'skills.details.sidebar.agent.useOnLobeAI': 'Use on LobeAI',+ 'skills.details.info.version': 'Version',- 'skills.details.sidebar.description': 'Description',+ 'skills.details.info.viewOnGithub': 'View on GitHub',- 'skills.details.sidebar.details': 'Details',+ 'skills.details.info.viewSource': 'View source',- 'skills.details.sidebar.directoryLayout': 'Directory Layout',+ 'skills.details.installation.filesIncluded': 'Files Included',- 'skills.details.sidebar.downloadSkill': 'Download Skill',+ 'skills.details.nav.info': 'Info',++ 'skills.details.nav.install': 'Install',++ 'skills.details.nav.reviews': 'Reviews',- 'skills.details.sidebar.files': 'File Tree',+ 'skills.details.overview.about': 'About',- 'skills.details.sidebar.installationConfig': 'Installation',+ 'skills.details.overview.features': 'Features',++ 'skills.details.overview.instructions': 'SKILL.md',++ 'skills.details.overview.title': 'Overview',++ 'skills.details.overview.version': 'Version {{version}}',++ 'skills.details.overview.whatsNew': "What's New",++ 'skills.details.rating.noRatings': 'No ratings yet',++ 'skills.details.rating.totalRatings': '{{count}} ratings',++ 'skills.details.related.listTitle': 'Related Skills',++ 'skills.details.related.more': 'View More',++ 'skills.details.sidebar.agent.title': 'Send this prompt to your Agent to install this Skill',++ 'skills.details.sidebar.agent.useOnLobeAI': 'Use on LobeAI',++ 'skills.details.sidebar.directoryLayout': 'Directory Layout',++ 'skills.details.sidebar.downloadSkill': 'Download Skill','skills.details.sidebar.installCommand': 'Install Command',@@ -1081,20 +1109,6 @@ export default {'skills.details.sidebar.platform.title': 'Install on {{platform}}',- 'skills.details.sidebar.tags': 'Tags',-- 'skills.details.summary.title': 'Summary',-- 'skills.details.versions.empty': 'No historical versions yet',-- 'skills.details.versions.table.isLatest': 'Latest',-- 'skills.details.versions.table.publishAt': 'Published',-- 'skills.details.versions.table.version': 'Version',-- 'skills.details.versions.title': 'Version History',-'skills.hero.guide.agent': 'I am Agent','skills.hero.guide.human': 'I am Human',diff --git a/src/components/CommentList/CommentItem.tsx b/src/components/CommentList/CommentItem.tsxnew file mode 100644index 00000000000..f72e006f5d4--- /dev/null+++ b/src/components/CommentList/CommentItem.tsx@@ -0,0 +1,141 @@+'use client';++import { AgentIcon } from '@lobehub/icons';+import { Avatar, Flexbox, Markdown, Text } from '@lobehub/ui';+import { createStaticStyles, responsive } from 'antd-style';+import { memo, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++import Rate from '@/components/RatingOverview/Rate';+import { type SkillCommentItem } from '@/types/discover';++const styles = createStaticStyles(({ css, cssVar }) => ({+ author: css`+ font-size: 16px;+ font-weight: 700;+ line-height: 1.2;+ color: ${cssVar.colorText};+ word-break: break-word;++ ${responsive.sm} {+ font-size: 15px;+ }+ `,+ avatar: css`+ flex: none;+ line-height: 0;+ `,+ card: css`+ padding-block: 22px;+ padding-inline: 24px;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: 22px;++ background: ${cssVar.colorBgContainer};++ ${responsive.sm} {+ padding-block: 18px;+ padding-inline: 16px;+ border-radius: 18px;+ }+ `,+ content: css`+ font-size: 16px;+ line-height: 1.56;+ color: ${cssVar.colorTextSecondary};++ p {+ margin-block: 0;+ }++ p + p {+ margin-block-start: 0.72em;+ }++ a {+ color: ${cssVar.colorLink};+ }++ strong {+ font-weight: 600;+ color: ${cssVar.colorText};+ }++ ${responsive.sm} {+ font-size: 15px;+ }+ `,+ date: css`+ flex: none;++ font-size: 13px;+ font-weight: 500;+ line-height: 1.3;+ color: ${cssVar.colorTextDescription};+ white-space: nowrap;+ `,+ rate: css`+ line-height: 1;+ `,+}));++const CommentItem = memo<{ item: SkillCommentItem }>(({ item }) => {+ const { i18n, t } = useTranslation('discover');+ const author = item.author;+ const createdAt = useMemo(() => {+ const date = new Date(item.createdAt);++ if (Number.isNaN(date.getTime())) return item.createdAt;++ return new Intl.DateTimeFormat(i18n.language, {+ day: 'numeric',+ month: 'short',+ year: 'numeric',+ }).format(date);+ }, [i18n.language, item.createdAt]);++ const authorName = useMemo(() => {+ const displayName = author?.displayName?.trim();+ const identifier = author?.identifier?.trim();++ if (displayName) {+ if (displayName.startsWith('@') || /\s/.test(displayName)) return displayName;+ return `@${displayName}`;+ }+ if (identifier) return identifier.startsWith('@') ? identifier : `@${identifier}`;++ return t('skills.details.comments.anonymous');+ }, [author?.displayName, author?.identifier, t]);++ const avatar = useMemo(() => {+ if (author?.type === 'agent' && author.sourceType) {+ return <AgentIcon agent={author.sourceType} shape={'circle'} size={32} type={'avatar'} />;+ }++ return (+ <Avatar avatar={author?.avatar || authorName} shape={'circle'} size={32} title={authorName} />+ );+ }, [author?.avatar, author?.sourceType, author?.type, authorName]);++ return (+ <Flexbox className={styles.card} gap={14}>+ <Flexbox horizontal align={'center'} gap={12} justify={'space-between'} wrap={'wrap'}>+ <Flexbox horizontal align={'center'} gap={12}>+ <div className={styles.avatar}>{avatar}</div>+ <Flexbox gap={6}>+ <Text className={styles.author}>{authorName}</Text>+ {typeof item.rating === 'number' && (+ <Rate className={styles.rate} gap={3} size={16} value={item.rating} />+ )}+ </Flexbox>+ </Flexbox>+ <Text className={styles.date}>{createdAt}</Text>+ </Flexbox>+ <Markdown className={styles.content} variant={'chat'}>+ {item.content}+ </Markdown>+ </Flexbox>+ );+});++export default CommentItem;diff --git a/src/components/CommentList/index.tsx b/src/components/CommentList/index.tsxnew file mode 100644index 00000000000..8b1d0338d9f--- /dev/null+++ b/src/components/CommentList/index.tsx@@ -0,0 +1,80 @@+'use client';++import { Empty, Flexbox, Skeleton } from '@lobehub/ui';+import { Button } from '@lobehub/ui/base-ui';+import { MessageSquare } from 'lucide-react';+import { memo, useCallback, useState, useTransition } from 'react';+import { useTranslation } from 'react-i18next';++import { type SkillCommentItem, type SkillCommentListResponse } from '@/types/discover';++import CommentItem from './CommentItem';++export interface CommentListProps {+ fetchMore: (params: {+ order?: 'asc' | 'desc';+ page?: number;+ pageSize?: number;+ sort?: 'createdAt' | 'upvotes';+ }) => Promise<SkillCommentListResponse>;+ initialData?: SkillCommentListResponse;+}++const CommentList = memo<CommentListProps>(({ initialData, fetchMore }) => {+ const { t } = useTranslation('discover');+ const { t: tc } = useTranslation('common');+ const [items, setItems] = useState<SkillCommentItem[]>(initialData?.items ?? []);+ const [currentPage, setCurrentPage] = useState(initialData?.currentPage ?? 1);+ const [totalPages, setTotalPages] = useState(initialData?.totalPages ?? 1);+ const [totalCount, setTotalCount] = useState(initialData?.totalCount ?? 0);+ const [loadMoreFailed, setLoadMoreFailed] = useState(false);+ const [isPending, startTransition] = useTransition();++ const handleLoadMore = useCallback(() => {+ const nextPage = currentPage + 1;+ startTransition(async () => {+ // Keep failures inside the transition: preserve loaded comments and+ // turn the button into a retry instead of surfacing to an error boundary+ try {+ const res = await fetchMore({ order: 'desc', page: nextPage, sort: 'createdAt' });+ setItems((prev) => [...prev, ...res.items]);+ setCurrentPage(res.currentPage);+ setTotalPages(res.totalPages);+ setTotalCount(res.totalCount);+ setLoadMoreFailed(false);+ } catch {+ setLoadMoreFailed(true);+ }+ });+ }, [currentPage, fetchMore]);++ let content;+ if (totalCount === 0 && !isPending) {+ content = <Empty description={t('skills.details.comments.noComments')} icon={MessageSquare} />;+ } else {+ content = (+ <>+ <Flexbox gap={24}>+ {isPending && items.length === 0 ? (+ <Flexbox gap={24}>+ {Array.from({ length: 3 }).map((_, i) => (+ <Skeleton active key={i} paragraph={{ rows: 2 }} title={{ width: 120 }} />+ ))}+ </Flexbox>+ ) : (+ items.map((item) => <CommentItem item={item} key={item.id} />)+ )}+ </Flexbox>+ {currentPage < totalPages && (+ <Button block loading={isPending} onClick={handleLoadMore}>+ {loadMoreFailed ? tc('retry') : t('skills.details.comments.loadMore')}+ </Button>+ )}+ </>+ );+ }++ return <Flexbox gap={24}>{content}</Flexbox>;+});++export default CommentList;diff --git a/src/components/RatingOverview/Rate.tsx b/src/components/RatingOverview/Rate.tsxnew file mode 100644index 00000000000..d5bc654f838--- /dev/null+++ b/src/components/RatingOverview/Rate.tsx@@ -0,0 +1,53 @@+import { ConfigProvider, Rate as AntdRate, type RateProps as AntdRateProps } from 'antd';+import { createStaticStyles, cssVar, cx } from 'antd-style';+import { memo } from 'react';++const styles = createStaticStyles(({ css }) => {+ return {+ rate: css`+ display: flex;+ align-items: center;++ .ant-rate-star {+ margin: 0 !important;+ }+ `,+ };+});++interface RateProps extends Omit<AntdRateProps, 'size'> {+ color?: string;+ gap?: number;+ size?: number;+}++const Rate = memo<RateProps>(+ ({ gap, style, className, size = 16, color = cssVar.colorWarning, ...props }) => {+ return (+ <ConfigProvider+ theme={{+ components: {+ Rate: {+ starBg: cssVar.colorFill,+ starColor: color,+ starSize: size,+ },+ },+ }}+ >+ <AntdRate+ allowHalf+ disabled+ className={cx(styles.rate, className)}+ style={{+ gap: gap || size / 2,+ ...style,+ }}+ {...props}+ />+ </ConfigProvider>+ );+ },+);++export default Rate;diff --git a/src/components/RatingOverview/index.tsx b/src/components/RatingOverview/index.tsxnew file mode 100644index 00000000000..91aa93f9a93--- /dev/null+++ b/src/components/RatingOverview/index.tsx@@ -0,0 +1,69 @@+'use client';++import { Flexbox, Text } from '@lobehub/ui';+import { Progress } from 'antd';+import { cssVar, useResponsive } from 'antd-style';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { type SkillRatingDistribution } from '@/types/discover';+import { formatShortenNumber } from '@/utils/format';++import Rate from './Rate';++interface RatingOverviewProps {+ average?: number;+ distribution?: SkillRatingDistribution;+ totalCount?: number;+}++const RatingOverview = memo<RatingOverviewProps>(+ ({ average = 0, totalCount = 0, distribution }) => {+ const { t } = useTranslation('discover');+ const { mobile } = useResponsive();++ const displayAverage = Number(average.toFixed(1));+ const stars = [5, 4, 3, 2, 1] as const;++ return (+ <Flexbox gap={32} horizontal={!mobile}>+ <Flexbox align={'center'} gap={6} style={{ minWidth: 120 }}>+ <Text style={{ fontSize: 48, fontWeight: 'bold', lineHeight: 1.2 }}>+ {displayAverage.toFixed(1)}+ </Text>+ <Rate value={displayAverage} />+ <Text type={'secondary'}>+ {totalCount > 0+ ? t('skills.details.rating.totalRatings', {+ count: formatShortenNumber(totalCount),+ } as any)+ : t('skills.details.rating.noRatings')}+ </Text>+ </Flexbox>+ <Flexbox flex={1} justify={'center'}>+ {stars.map((star) => {+ const count = distribution?.[star] ?? 0;+ const percent = totalCount > 0 ? (count / totalCount) * 100 : 0;+ return (+ <Flexbox horizontal align={'center'} gap={8} key={star}>+ <Text style={{ flexShrink: 0, width: 16 }} type={'secondary'}>+ {star}+ </Text>+ <Progress+ percent={percent}+ showInfo={false}+ size={'small'}+ strokeColor={cssVar.colorWarning}+ strokeWidth={8}+ style={{ flex: 1, marginBottom: 0 }}+ />+ </Flexbox>+ );+ })}+ </Flexbox>+ </Flexbox>+ );+ },+);++export default RatingOverview;diff --git a/src/features/CommunitySkillDetail/DetailProvider.tsx b/src/features/CommunitySkillDetail/DetailProvider.tsxnew file mode 100644index 00000000000..24663c4d2bc--- /dev/null+++ b/src/features/CommunitySkillDetail/DetailProvider.tsx@@ -0,0 +1,36 @@+'use client';++import { createContext, memo, type ReactNode, use } from 'react';++import { type DiscoverSkillDetail } from '@/types/discover';++export type DetailContextConfig = Partial<DiscoverSkillDetail>;++export const DetailContext = createContext<DetailContextConfig>({});++export const DetailProvider = memo<{ children: ReactNode; config?: DetailContextConfig }>(+ ({ children, config = {} }) => {+ return <DetailContext value={config}>{children}</DetailContext>;+ },+);++export const useDetailContext = () => {+ return use(DetailContext);+};++/**+ * How navigation behaves where the detail is rendered: the modal swaps its own+ * content in place (and closes itself before leaving for another route), the+ * standalone page just navigates.+ */+export interface DetailActionContextValue {+ /** Present only in the modal — call before navigating away from the detail */+ close?: () => void;+ selectSkill?: (identifier: string) => void;+}++export const DetailActionContext = createContext<DetailActionContextValue>({});++export const useDetailActionContext = () => {+ return use(DetailActionContext);+};diff --git a/src/features/CommunitySkillDetail/Details/Info/index.tsx b/src/features/CommunitySkillDetail/Details/Info/index.tsxnew file mode 100644index 00000000000..b980cd4612d--- /dev/null+++ b/src/features/CommunitySkillDetail/Details/Info/index.tsx@@ -0,0 +1,210 @@+'use client';++import { Block } from '@lobehub/ui';+import { createStaticStyles, responsive } from 'antd-style';+import { memo, type ReactNode } from 'react';+import { useTranslation } from 'react-i18next';++import PublishedTime from '@/components/PublishedTime';+import { useSkillCategoryItem } from '@/hooks/useSkillCategory';+import { formatNumber } from '@/utils/format';++import { useDetailContext } from '../../DetailProvider';+import { isGitHubUrl } from './isGitHubUrl';++const EMPTY_VALUE = '--';++const styles = createStaticStyles(({ css, cssVar }) => ({+ card: css`+ overflow: hidden;+ border-color: ${cssVar.colorBorderSecondary} !important;+ border-radius: 16px !important;+ background: ${cssVar.colorBgContainer} !important;+ `,+ label: css`+ font-size: 14px;+ font-weight: 500;+ line-height: 1.35;+ color: ${cssVar.colorTextDescription};++ ${responsive.sm} {+ font-size: 13px;+ }+ `,+ row: css`+ display: grid;+ grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr);+ align-items: center;++ min-height: 58px;+ padding-block: 0;+ padding-inline: 24px;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};++ &:last-child {+ border-block-end: 0;+ }++ ${responsive.sm} {+ grid-template-columns: 1fr;+ gap: 6px;+ align-items: flex-start;++ min-height: 56px;+ padding-block: 14px;+ padding-inline: 18px;+ }+ `,+ sourceLink: css`+ display: inline-flex;+ gap: 4px;+ align-items: center;+ justify-content: flex-end;++ color: ${cssVar.colorLink};++ &:hover {+ color: ${cssVar.colorLinkHover};+ }+ `,+ value: css`+ min-width: 0;++ font-size: 14px;+ font-weight: 600;+ font-variant-numeric: tabular-nums;+ line-height: 1.35;+ color: ${cssVar.colorText};+ text-align: end;+ word-break: break-word;++ ${responsive.sm} {+ text-align: start;+ }+ `,+ valueMuted: css`+ color: ${cssVar.colorTextDescription};+ `,+}));++const isEmptyValue = (value: ReactNode) => value === undefined || value === null || value === '';++const InfoRow = memo<{ label: ReactNode; value: ReactNode }>(({ label, value }) => {+ const empty = isEmptyValue(value);++ return (+ <div className={styles.row}>+ <span className={styles.label}>{label}</span>+ <div className={[styles.value, empty ? styles.valueMuted : ''].filter(Boolean).join(' ')}>+ {empty ? EMPTY_VALUE : value}+ </div>+ </div>+ );+});++const Info = memo(() => {+ const { t } = useTranslation('discover');+ const {+ author,+ category,+ createdAt,+ github,+ homepage,+ installCount,+ license,+ repository,+ updatedAt,+ version,+ versions = [],+ } = useDetailContext();++ const categoryItem = useSkillCategoryItem(category);+ // Honor the fetched (possibly deep-linked ?version=) version before falling+ // back to the latest entry+ const selectedVersion =+ versions.find((item) => item.version === version) ||+ versions.find((item) => item.isLatest) ||+ versions[0];+ const sourceUrl = github?.url || repository || homepage;+ const isGitHubSource = isGitHubUrl(sourceUrl);+ const updatedDate = selectedVersion?.createdAt || updatedAt || createdAt;++ const sourceValue = sourceUrl ? (+ <a className={styles.sourceLink} href={sourceUrl} rel={'noopener noreferrer'} target={'_blank'}>+ {isGitHubSource ? t('skills.details.info.viewOnGithub') : t('skills.details.info.viewSource')}{' '}+ ↗+ </a>+ ) : undefined;++ const rows: { key: string; label: ReactNode; value: ReactNode }[] = [+ {+ key: 'publisher',+ label: t('skills.details.info.publisher'),+ value: author?.name,+ },+ {+ key: 'category',+ label: t('skills.details.info.category'),+ value: categoryItem?.label || category,+ },+ {+ key: 'version',+ label: t('skills.details.info.version'),+ value: version || selectedVersion?.version,+ },+ {+ key: 'updated',+ label: t('skills.details.info.updated'),+ value: updatedDate ? (+ <PublishedTime+ date={updatedDate as string}+ style={{ color: 'inherit', fontSize: 'inherit', fontWeight: 'inherit', marginBlock: 0 }}+ template={'MMM DD, YYYY'}+ />+ ) : undefined,+ },+ {+ key: 'license',+ label: t('skills.details.info.license'),+ value: license?.name ? (+ license.url ? (+ <a+ href={license.url}+ rel={'noopener noreferrer'}+ style={{ color: 'inherit', textDecoration: 'none' }}+ target={'_blank'}+ >+ {license.name}+ </a>+ ) : (+ license.name+ )+ ) : undefined,+ },+ {+ key: 'installs',+ label: t('skills.details.info.installs'),+ value: typeof installCount === 'number' ? formatNumber(installCount) : undefined,+ },+ {+ key: 'stars',+ label: t('skills.details.info.stars'),+ value: typeof github?.stars === 'number' ? formatNumber(github.stars) : undefined,+ },+ {+ key: 'source',+ label: t('skills.details.info.source'),+ value: sourceValue,+ },+ ];++ return (+ <Block className={styles.card} paddingBlock={0} paddingInline={0} variant={'outlined'}>+ {rows.map((row) => (+ <InfoRow key={row.key} label={row.label} value={row.value} />+ ))}+ </Block>+ );+});++export default Info;diff --git a/src/features/CommunitySkillDetail/Details/Info/isGitHubUrl.test.ts b/src/features/CommunitySkillDetail/Details/Info/isGitHubUrl.test.tsnew file mode 100644index 00000000000..44b097d999e--- /dev/null+++ b/src/features/CommunitySkillDetail/Details/Info/isGitHubUrl.test.ts@@ -0,0 +1,25 @@+import { describe, expect, it } from 'vitest';++import { isGitHubUrl } from './isGitHubUrl';++describe('isGitHubUrl', () => {+ it.each([+ 'https://github.com/lobehub/lobehub',+ 'https://www.github.com/lobehub/lobehub',+ 'https://gist.github.com/example',+ ])('accepts GitHub hosts: %s', (url) => {+ expect(isGitHubUrl(url)).toBe(true);+ });++ it.each([+ 'https://evilgithub.com/lobehub/lobehub',+ 'https://github.com.evil.example/lobehub/lobehub',+ 'https://[email protected]/lobehub/lobehub',+ ])('rejects hosts that only contain github.com: %s', (url) => {+ expect(isGitHubUrl(url)).toBe(false);+ });++ it.each([undefined, '', 'not-a-url'])('rejects invalid URLs: %s', (url) => {+ expect(isGitHubUrl(url)).toBe(false);+ });+});diff --git a/src/features/CommunitySkillDetail/Details/Info/isGitHubUrl.ts b/src/features/CommunitySkillDetail/Details/Info/isGitHubUrl.tsnew file mode 100644index 00000000000..33f821e6100--- /dev/null+++ b/src/features/CommunitySkillDetail/Details/Info/isGitHubUrl.ts@@ -0,0 +1,11 @@+export const isGitHubUrl = (value?: string) => {+ if (!value) return false;++ try {+ const hostname = new URL(value).hostname.toLowerCase();++ return hostname === 'github.com' || hostname.endsWith('.github.com');+ } catch {+ return false;+ }+};diff --git a/src/routes/(main)/community/(detail)/skill/features/Sidebar/Platform.tsx b/src/features/CommunitySkillDetail/Details/Install/Platform.tsxsimilarity index 95%rename from src/routes/(main)/community/(detail)/skill/features/Sidebar/Platform.tsxrename to src/features/CommunitySkillDetail/Details/Install/Platform.tsxindex bd1a32a57b8..364cbf5ae15 100644--- a/src/routes/(main)/community/(detail)/skill/features/Sidebar/Platform.tsx+++ b/src/features/CommunitySkillDetail/Details/Install/Platform.tsx@@ -15,9 +15,15 @@ import { useAgentStore } from '@/store/agent';import { builtinAgentSelectors } from '@/store/agent/selectors';import { useChatStore } from '@/store/chat';-import Title from '../../../../components/Title';+import { useDetailActionContext } from '../../DetailProvider';import VsCodeIcon from './VsCodeIcon';+const Title = ({ children }: { children?: React.ReactNode }) => (+ <Text as={'h3'} fontSize={16} style={{ margin: 0, paddingInline: 8 }} weight={600}>+ {children}+ </Text>+);+type GuideMode = 'agent' | 'human';enum PlatformType {@@ -107,6 +113,7 @@ const Platform = memo<PlatformProps>(({ lite, identifier, mobile, expandCodeByDefault, downloadUrl }) => {const { t } = useTranslation('discover');const navigate = useWorkspaceAwareNavigate();+ const { close } = useDetailActionContext();const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);const sendMessage = useChatStore((s) => s.sendMessage);const [active, setActive] = useState<PlatformType>(PlatformType.Claude);@@ -194,9 +201,11 @@ const Platform = memo<PlatformProps>(message: agentPrompt,});- // Navigate to LobeAI chat session+ // Navigate to LobeAI chat session; in the modal the host outlives the+ // router, so dismiss the detail alongside the navigationnavigate(AGENT_CHAT_URL(inboxAgentId, mobile));- }, [agentPrompt, inboxAgentId, mobile, navigate, sendMessage]);+ close?.();+ }, [agentPrompt, close, inboxAgentId, mobile, navigate, sendMessage]);return (<Block gap={lite ? 0 : 16} padding={4} variant={lite ? 'outlined' : 'borderless'}>diff --git a/src/routes/(main)/community/(detail)/skill/features/Sidebar/VsCodeIcon.tsx b/src/features/CommunitySkillDetail/Details/Install/VsCodeIcon.tsxsimilarity index 100%rename from src/routes/(main)/community/(detail)/skill/features/Sidebar/VsCodeIcon.tsxrename to src/features/CommunitySkillDetail/Details/Install/VsCodeIcon.tsxdiff --git a/src/features/CommunitySkillDetail/Details/Install/index.tsx b/src/features/CommunitySkillDetail/Details/Install/index.tsxnew file mode 100644index 00000000000..751d1448750--- /dev/null+++ b/src/features/CommunitySkillDetail/Details/Install/index.tsx@@ -0,0 +1,89 @@+'use client';++import { Flexbox, MaterialFileTypeIcon, Text } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { formatSize } from '@/utils/format';++import { useDetailContext } from '../../DetailProvider';+import Platform from './Platform';++const styles = createStaticStyles(({ css, cssVar }) => ({+ filesCard: css`+ overflow: hidden;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: 16px;+ background: ${cssVar.colorBgContainer};+ `,+ sectionLabel: css`+ margin: 0;++ font-size: 20px;+ font-weight: 700;+ line-height: 1.25;+ color: ${cssVar.colorText};+ `,+}));++const Install = memo<{ mobile?: boolean }>(({ mobile }) => {+ const { identifier, downloadUrl, resources, content } = useDetailContext();+ const { t } = useTranslation('discover');+ const entries = Object.entries((resources || {}) as Record<string, { size: number }>);++ // Ensure SKILL.md is always shown, use content length as fallback size+ if (!entries.some(([path]) => path.toLowerCase() === 'skill.md')) {+ const skillMdSize = content ? new TextEncoder().encode(content).length : 0;+ entries.unshift(['SKILL.md', { size: skillMdSize }]);+ }++ return (+ <Flexbox gap={32}>+ <Platform+ expandCodeByDefault+ downloadUrl={downloadUrl}+ identifier={identifier}+ mobile={mobile}+ />+ {entries.length > 0 && (+ <Flexbox gap={12}>+ <Text as={'h2'} className={styles.sectionLabel}>+ {t('skills.details.installation.filesIncluded')}+ </Text>+ <div className={styles.filesCard}>+ {entries.map(([name, meta], index) => (+ <Flexbox+ horizontal+ align={'center'}+ justify={'space-between'}+ key={name}+ paddingBlock={12}+ paddingInline={16}+ style={+ index < entries.length - 1+ ? { borderBottom: `1px solid ${cssVar.colorBorderSecondary}` }+ : undefined+ }+ >+ <Flexbox horizontal align={'center'} gap={10} style={{ minWidth: 0 }}>+ <MaterialFileTypeIcon filename={name} size={20} />+ <Text ellipsis style={{ fontSize: 14 }}>+ {name}+ </Text>+ </Flexbox>+ {meta.size > 0 && (+ <Text style={{ color: cssVar.colorTextDescription, flex: 'none', fontSize: 13 }}>+ {formatSize(meta.size)}+ </Text>+ )}+ </Flexbox>+ ))}+ </div>+ </Flexbox>+ )}+ </Flexbox>+ );+});++export default Install;diff --git a/src/features/CommunitySkillDetail/Details/Nav.tsx b/src/features/CommunitySkillDetail/Details/Nav.tsxnew file mode 100644index 00000000000..e677198238b--- /dev/null+++ b/src/features/CommunitySkillDetail/Details/Nav.tsx@@ -0,0 +1,120 @@+'use client';++import { createStaticStyles } from 'antd-style';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { SkillNavKey } from '../types';++const styles = createStaticStyles(({ css, cssVar }) => ({+ item: css`+ cursor: pointer;++ position: relative;++ height: 42px;+ padding-block: 0;+ padding-inline: 12px;+ border: 0;+ border-radius: 8px;++ font: inherit;+ font-size: 15px;+ font-weight: 500;+ color: ${cssVar.colorTextSecondary};++ background: transparent;++ transition:+ background 0.2s ease,+ color 0.2s ease;++ &::after {+ content: '';++ position: absolute;+ z-index: 1;+ inset-block-end: 0;+ inset-inline: 12px;+ transform: scaleX(0.4);++ height: 2px;+ border-radius: 999px;++ opacity: 0;+ background: ${cssVar.colorPrimary};++ transition:+ opacity 0.2s ease,+ transform 0.2s ease;+ }++ &:hover {+ color: ${cssVar.colorText};+ background: color-mix(in srgb, ${cssVar.colorFillQuaternary} 70%, transparent);+ }++ &:focus-visible {+ outline: 2px solid ${cssVar.colorInfo};+ outline-offset: 2px;+ }+ `,+ itemActive: css`+ font-weight: 700;+ color: ${cssVar.colorText};+ background: color-mix(in srgb, ${cssVar.colorFillQuaternary} 76%, transparent);++ &::after {+ transform: scaleX(1);+ opacity: 1;+ }+ `,+ nav: css`+ scrollbar-width: none;++ overflow-x: auto;+ display: flex;+ gap: 8px;++ width: 100%;+ padding-block-end: 8px;+ border-block-end: 1px solid color-mix(in srgb, ${cssVar.colorBorderSecondary} 88%, transparent);++ &::-webkit-scrollbar {+ display: none;+ }+ `,+}));++const Nav = memo<{+ activeTab?: SkillNavKey;+ setActiveTab?: (tab: SkillNavKey) => void;+}>(({ setActiveTab, activeTab = SkillNavKey.Overview }) => {+ const { t } = useTranslation('discover');++ const items = [+ { key: SkillNavKey.Overview, label: t('skills.details.overview.title') },+ { key: SkillNavKey.Install, label: t('skills.details.nav.install') },+ { key: SkillNavKey.Reviews, label: t('skills.details.nav.reviews') },+ { key: SkillNavKey.Info, label: t('skills.details.nav.info') },+ ];++ return (+ <div className={styles.nav}>+ {items.map((item) => (+ <button+ key={item.key}+ type={'button'}+ className={[styles.item, activeTab === item.key ? styles.itemActive : '']+ .filter(Boolean)+ .join(' ')}+ onClick={() => setActiveTab?.(item.key)}+ >+ {item.label}+ </button>+ ))}+ </div>+ );+});++export default Nav;diff --git a/src/features/CommunitySkillDetail/Details/Overview/RelatedSkillCard.tsx b/src/features/CommunitySkillDetail/Details/Overview/RelatedSkillCard.tsxnew file mode 100644index 00000000000..ee34b0e21cf--- /dev/null+++ b/src/features/CommunitySkillDetail/Details/Overview/RelatedSkillCard.tsx@@ -0,0 +1,112 @@+'use client';++import { Avatar, Block, Flexbox, Text } from '@lobehub/ui';+import { createStaticStyles } from 'antd-style';+import { memo, useCallback } from 'react';+import urlJoin from 'url-join';++import Rate from '@/components/RatingOverview/Rate';+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { type DiscoverSkillItem } from '@/types/discover';++import { useDetailActionContext } from '../../DetailProvider';++const styles = createStaticStyles(({ css, cssVar }) => ({+ card: css`+ border-color: ${cssVar.colorBorderSecondary} !important;+ border-radius: 16px !important;+ background: ${cssVar.colorBgContainer} !important;+ transition:+ transform 0.2s ease,+ border-color 0.2s ease,+ box-shadow 0.2s ease;++ &:hover {+ transform: translateY(-1px);+ border-color: ${cssVar.colorBorder} !important;+ box-shadow: 0 10px 28px color-mix(in srgb, ${cssVar.colorText} 8%, transparent);+ }++ &:active {+ transform: translateY(0);+ }+ `,+ meta: css`+ overflow: hidden;++ min-width: 0;++ font-size: 13px;+ color: ${cssVar.colorTextDescription};+ white-space: nowrap;+ `,+ metaAuthor: css`+ overflow: hidden;+ flex: 1 1 auto;++ min-width: 0;++ text-overflow: ellipsis;+ white-space: nowrap;+ `,+ metaRating: css`+ flex: none;+ font-variant-numeric: tabular-nums;+ white-space: nowrap;+ `,+ name: css`+ font-size: 14px;+ font-weight: 600;+ line-height: 1.3;+ `,+}));++const RelatedSkillCard = memo<DiscoverSkillItem>(+ ({ name, identifier, author, icon, ratingAvg }) => {+ const { selectSkill } = useDetailActionContext();+ const navigate = useWorkspaceAwareNavigate();++ const displayRating =+ typeof ratingAvg === 'number' && ratingAvg > 0 ? Number(ratingAvg.toFixed(1)) : undefined;++ const handleClick = useCallback(() => {+ if (selectSkill) {+ selectSkill(identifier);+ return;+ }+ navigate(urlJoin('/community/skill', identifier));+ }, [identifier, navigate, selectSkill]);++ return (+ <Block+ clickable+ className={styles.card}+ paddingBlock={12}+ paddingInline={14}+ variant={'outlined'}+ onClick={handleClick}+ >+ <Flexbox horizontal align={'center'} gap={12}>+ <Avatar avatar={icon || name || identifier} size={40} style={{ flex: 'none' }} />+ <Flexbox flex={1} gap={2} style={{ minWidth: 0, overflow: 'hidden' }}>+ <Text ellipsis className={styles.name}>+ {name || identifier}+ </Text>+ <Flexbox horizontal align={'center'} className={styles.meta} gap={4}>+ {author && <span className={styles.metaAuthor}>{author}</span>}+ {displayRating && (+ <Flexbox horizontal align={'center'} className={styles.metaRating} gap={3}>+ {author && <span>·</span>}+ <Rate gap={1} size={10} value={displayRating} />+ <span>{displayRating.toFixed(1)}</span>+ </Flexbox>+ )}+ </Flexbox>+ </Flexbox>+ </Flexbox>+ </Block>+ );+ },+);++export default RelatedSkillCard;diff --git a/src/features/CommunitySkillDetail/Details/Overview/index.tsx b/src/features/CommunitySkillDetail/Details/Overview/index.tsxnew file mode 100644index 00000000000..948941eb6c7--- /dev/null+++ b/src/features/CommunitySkillDetail/Details/Overview/index.tsx@@ -0,0 +1,196 @@+'use client';++import { Block, Collapse, Flexbox, Icon, Markdown, ScrollShadow, Tag, Text } from '@lobehub/ui';+import { Button } from '@lobehub/ui/base-ui';+import { createStaticStyles, cssVar, responsive } from 'antd-style';+import { ChevronRight } from 'lucide-react';+import qs from 'query-string';+import { memo, useCallback } from 'react';+import { useTranslation } from 'react-i18next';++import PublishedTime from '@/components/PublishedTime';+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { useDiscoverStore } from '@/store/discover';++import { useDetailActionContext, useDetailContext } from '../../DetailProvider';+import RelatedSkillCard from './RelatedSkillCard';++const styles = createStaticStyles(({ css, cssVar }) => ({+ relatedGrid: css`+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: 12px;++ ${responsive.sm} {+ grid-template-columns: 1fr;+ }+ `,+ sectionLabel: css`+ margin: 0;++ font-size: 20px;+ font-weight: 700;+ line-height: 1.25;+ color: ${cssVar.colorText};++ ${responsive.sm} {+ font-size: 18px;+ }+ `,+ more: css`+ display: flex;+ align-items: center;+ color: ${cssVar.colorTextSecondary};+ `,+ summary: css`+ font-size: 15px;+ line-height: 1.7;+ color: ${cssVar.colorTextSecondary};++ p {+ margin-block: 0 0.8em;+ }+ `,+ tag: css`+ border-color: color-mix(in srgb, ${cssVar.colorBorderSecondary} 84%, transparent) !important;+ border-radius: 8px !important;+ `,+ versionCard: css`+ border-color: color-mix(in srgb, ${cssVar.colorBorderSecondary} 88%, transparent) !important;+ border-radius: 8px !important;+ `,+}));++const SectionLabel = memo<{ children: string }>(({ children }) => (+ <Text as={'h2'} className={styles.sectionLabel}>+ {children}+ </Text>+));++const Overview = memo(() => {+ const { t } = useTranslation('discover');+ const {+ tags = [],+ description,+ overview,+ category,+ identifier,+ version,+ versions = [],+ content,+ } = useDetailContext();+ const { close } = useDetailActionContext();+ const navigate = useWorkspaceAwareNavigate();++ const useFetchRelatedSkills = useDiscoverStore((s) => s.useFetchRelatedSkills);+ const { data: related } = useFetchRelatedSkills({ category, identifier });++ // Honor the fetched (possibly deep-linked ?version=) version before falling+ // back to the latest entry+ const selectedVersion =+ versions.find((v) => v.version === version) || versions.find((v) => v.isLatest) || versions[0];++ const handleMoreRelated = useCallback(() => {+ navigate(qs.stringifyUrl({ query: { category }, url: '/community/skill' }));+ // In the modal, leave the detail open no longer than the navigation+ close?.();+ }, [category, close, navigate]);++ return (+ <Flexbox gap={32}>+ {/* ABOUT */}+ <Flexbox gap={12}>+ <SectionLabel>{t('skills.details.overview.about')}</SectionLabel>+ <div className={styles.summary}>+ <Markdown variant={'chat'}>{overview?.summary || description || ''}</Markdown>+ </div>+ </Flexbox>++ {/* SKILL.md */}+ {content && (+ <Collapse+ defaultActiveKey={['skill']}+ expandIconPlacement={'end'}+ padding={{ body: 0 }}+ variant={'outlined'}+ items={[+ {+ children: (+ <ScrollShadow height={480} offset={16} padding={16} size={16}>+ <Markdown variant={'chat'}>{content}</Markdown>+ </ScrollShadow>+ ),+ key: 'skill',+ label: t('skills.details.overview.instructions'),+ },+ ]}+ />+ )}++ {/* FEATURES */}+ {tags.length > 0 && (+ <Flexbox gap={12}>+ <SectionLabel>{t('skills.details.overview.features')}</SectionLabel>+ <Flexbox horizontal gap={8} wrap={'wrap'}>+ {tags.map((tag) => (+ <Tag className={styles.tag} key={tag}>+ {tag}+ </Tag>+ ))}+ </Flexbox>+ </Flexbox>+ )}++ {/* WHAT'S NEW */}+ {selectedVersion?.changelog && (+ <Flexbox gap={12}>+ <SectionLabel>{t('skills.details.overview.whatsNew')}</SectionLabel>+ <Block+ className={styles.versionCard}+ gap={12}+ paddingBlock={16}+ paddingInline={16}+ variant={'outlined'}+ >+ <Flexbox horizontal align={'center'} gap={8}>+ <Text style={{ fontFamily: cssVar.fontFamilyCode, fontSize: 14 }} weight={600}>+ {t('skills.details.overview.version', { version: selectedVersion.version })}+ </Text>+ <PublishedTime+ date={selectedVersion.createdAt}+ style={{ color: cssVar.colorTextDescription, fontSize: 12 }}+ template={'MMM DD, YYYY'}+ />+ </Flexbox>+ <Markdown variant={'chat'}>{selectedVersion.changelog}</Markdown>+ </Block>+ </Flexbox>+ )}++ {/* RELATED SKILLS */}+ {related && related.length > 0 && (+ <Flexbox gap={12}>+ <Flexbox horizontal align={'center'} justify={'space-between'}>+ <SectionLabel>{t('skills.details.related.listTitle')}</SectionLabel>+ <Button+ className={styles.more}+ style={{ paddingInline: 6 }}+ type={'text'}+ onClick={handleMoreRelated}+ >+ <span>{t('skills.details.related.more')}</span>+ <Icon icon={ChevronRight} />+ </Button>+ </Flexbox>+ <div className={styles.relatedGrid}>+ {related.map((item) => (+ <RelatedSkillCard key={item.identifier} {...item} />+ ))}+ </div>+ </Flexbox>+ )}+ </Flexbox>+ );+});++export default Overview;diff --git a/src/features/CommunitySkillDetail/Details/Reviews/index.tsx b/src/features/CommunitySkillDetail/Details/Reviews/index.tsxnew file mode 100644index 00000000000..e72b9ad9a60--- /dev/null+++ b/src/features/CommunitySkillDetail/Details/Reviews/index.tsx@@ -0,0 +1,70 @@+'use client';++import { Flexbox, Skeleton } from '@lobehub/ui';+import { memo, useCallback } from 'react';++import AsyncError from '@/components/AsyncError';+import CommentList, { type CommentListProps } from '@/components/CommentList';+import RatingOverview from '@/components/RatingOverview';+import { discoverService } from '@/services/discover';+import { useDiscoverStore } from '@/store/discover';++import { FIRST_COMMENTS_PAGE_QUERY } from '../../const';+import { useDetailContext } from '../../DetailProvider';++const Reviews = memo(() => {+ const { identifier, ratingAverage, ratingCount } = useDetailContext();++ const useFetchSkillRatingDistribution = useDiscoverStore(+ (s) => s.useFetchSkillRatingDistribution,+ );+ const useFetchSkillComments = useDiscoverStore((s) => s.useFetchSkillComments);++ const { data: distribution } = useFetchSkillRatingDistribution(identifier);+ const {+ data: firstPage,+ error,+ isLoading,+ isValidating,+ mutate,+ } = useFetchSkillComments({+ identifier,+ ...FIRST_COMMENTS_PAGE_QUERY,+ });++ const fetchMore: CommentListProps['fetchMore'] = useCallback(+ (params) => discoverService.getSkillComments({ identifier: identifier!, ...params }),+ [identifier],+ );++ return (+ <Flexbox gap={24}>+ <RatingOverview+ average={ratingAverage}+ distribution={distribution}+ totalCount={distribution?.totalCount ?? ratingCount}+ />+ {isLoading ? (+ <Flexbox gap={24}>+ {Array.from({ length: 3 }).map((_, i) => (+ <Skeleton active key={i} paragraph={{ rows: 2 }} title={{ width: 120 }} />+ ))}+ </Flexbox>+ ) : error ? (+ // A failed fetch is not "no reviews yet" — offer a retry. CommentList+ // only mounts on success, so retried data seeds it fresh (it snapshots+ // initialData at mount time).+ <AsyncError+ error={error}+ retrying={isValidating}+ variant={'block'}+ onRetry={() => mutate()}+ />+ ) : (+ <CommentList fetchMore={fetchMore} initialData={firstPage} key={identifier} />+ )}+ </Flexbox>+ );+});++export default Reviews;diff --git a/src/features/CommunitySkillDetail/Details/index.tsx b/src/features/CommunitySkillDetail/Details/index.tsxnew file mode 100644index 00000000000..06d13186bf5--- /dev/null+++ b/src/features/CommunitySkillDetail/Details/index.tsx@@ -0,0 +1,42 @@+'use client';++import { Flexbox } from '@lobehub/ui';+import { memo, useState } from 'react';++import { SkillNavKey } from '../types';+import Info from './Info';+import Install from './Install';+import Nav from './Nav';+import Overview from './Overview';+import Reviews from './Reviews';++interface DetailsProps {+ /** Controlled active tab; leave undefined for internal state (modal usage) */+ activeTab?: SkillNavKey;+ mobile?: boolean;+ onTabChange?: (tab: SkillNavKey) => void;+}++const Details = memo<DetailsProps>(({ activeTab: controlledTab, mobile, onTabChange }) => {+ const [internalTab, setInternalTab] = useState<SkillNavKey>(SkillNavKey.Overview);+ const activeTab = controlledTab ?? internalTab;++ const handleTabChange = (tab: SkillNavKey) => {+ setInternalTab(tab);+ onTabChange?.(tab);+ };++ return (+ <Flexbox align={'stretch'} gap={24} width={'100%'}>+ <Nav activeTab={activeTab} setActiveTab={handleTabChange} />+ <Flexbox flex={1} style={{ overflow: 'hidden' }} width={'100%'}>+ {activeTab === SkillNavKey.Overview && <Overview />}+ {activeTab === SkillNavKey.Install && <Install mobile={mobile} />}+ {activeTab === SkillNavKey.Reviews && <Reviews />}+ {activeTab === SkillNavKey.Info && <Info />}+ </Flexbox>+ </Flexbox>+ );+});++export default Details;diff --git a/src/features/CommunitySkillDetail/Header.tsx b/src/features/CommunitySkillDetail/Header.tsxnew file mode 100644index 00000000000..872dbd59487--- /dev/null+++ b/src/features/CommunitySkillDetail/Header.tsx@@ -0,0 +1,389 @@+'use client';++import { Avatar, DropdownMenu, Flexbox, Icon, Text } from '@lobehub/ui';+import { Button, confirmModal, toast } from '@lobehub/ui/base-ui';+import { createStaticStyles, cssVar, responsive, useResponsive } from 'antd-style';+import { CheckCircle2, CheckIcon, ChevronDown, Trash2 } from 'lucide-react';+import { memo, type ReactNode, useCallback, useState } from 'react';+import { useTranslation } from 'react-i18next';++import PublishedTime from '@/components/PublishedTime';+import Rate from '@/components/RatingOverview/Rate';+import { usePermission } from '@/hooks/usePermission';+import { useSkillCategoryItem } from '@/hooks/useSkillCategory';+import { agentSkillService } from '@/services/skill';+import { useDiscoverStore } from '@/store/discover';+import { useToolStore } from '@/store/tool';+import { agentSkillsSelectors } from '@/store/tool/selectors';+import { formatShortenNumber } from '@/utils/format';++import { FIRST_COMMENTS_PAGE_QUERY } from './const';+import { useDetailContext } from './DetailProvider';++const styles = createStaticStyles(({ css, cssVar }) => ({+ author: css`+ font-weight: 500;+ color: ${cssVar.colorInfo};+ `,+ metaDivider: css`+ flex: none;++ width: 1px;+ height: 12px;+ margin-inline: 3px;++ background: ${cssVar.colorBorderSecondary};+ `,+ ratingCount: css`+ font-size: 11px;+ font-weight: 600;+ line-height: 1.1;+ color: ${cssVar.colorTextDescription};+ `,+ ratingValue: css`+ font-size: 26px;+ font-weight: 700;+ font-variant-numeric: tabular-nums;+ line-height: 1;+ color: ${cssVar.colorText};+ `,+ statBlock: css`+ transition: background 0.2s ease;++ &:hover {+ background: color-mix(in srgb, ${cssVar.colorFillQuaternary} 74%, transparent);+ }+ `,+ statCaption: css`+ display: flex;+ align-items: center;+ justify-content: center;++ min-height: 14px;++ font-size: 11px;+ font-weight: 500;+ line-height: 1.1;+ color: ${cssVar.colorTextDescription};+ `,+ statLabel: css`+ font-size: 11px;+ font-weight: 600;+ color: ${cssVar.colorTextDescription};+ `,+ statValue: css`+ font-size: 24px;+ font-weight: 700;+ font-variant-numeric: tabular-nums;+ line-height: 1;+ color: ${cssVar.colorText};+ `,+ statsBar: css`+ overflow: hidden;+ border: 1px solid color-mix(in srgb, ${cssVar.colorBorderSecondary} 88%, transparent);+ border-radius: 16px;+ background: ${cssVar.colorBgContainer};+ `,+ statsGrid: css`+ display: grid;+ grid-template-columns: repeat(3, minmax(0, 1fr));++ ${responsive.sm} {+ grid-template-columns: repeat(2, minmax(0, 1fr));+ }+ `,+ time: css`+ font-size: 12px;+ color: ${cssVar.colorTextDescription};+ `,+}));++const MetaDivider = memo(() => <span aria-hidden className={styles.metaDivider} />);++const StatBlock = memo<{+ bordered?: boolean;+ caption?: ReactNode;+ label: ReactNode;+ value: ReactNode;+}>(({ value, label, caption, bordered }) => {+ return (+ <Flexbox+ align={'center'}+ className={styles.statBlock}+ flex={1}+ gap={5}+ justify={'center'}+ style={{+ borderInlineStart: bordered ? `1px solid ${cssVar.colorBorderSecondary}` : undefined,+ minHeight: 78,+ paddingBlock: 10,+ textAlign: 'center',+ }}+ >+ <div className={styles.statLabel}>{label}</div>+ <div className={styles.statValue}>{value}</div>+ <div aria-hidden={!caption} className={styles.statCaption}>+ {caption}+ </div>+ </Flexbox>+ );+});++const InstallButton = memo<{ identifier?: string; name?: string }>(({ identifier, name }) => {+ const { t } = useTranslation('plugin');+ const { t: tc } = useTranslation('common');+ const { t: td } = useTranslation('discover');+ const [installing, setInstalling] = useState(false);+ const { allowed: canCreate } = usePermission('create_content');+ const { allowed: canEdit } = usePermission('edit_own_content');++ // Ensure agent skills are fetched so the install state is real on a direct+ // visit — otherwise installed skills render as installable+ const useFetchAgentSkills = useToolStore((s) => s.useFetchAgentSkills);+ useFetchAgentSkills(true);++ const installed = useToolStore(agentSkillsSelectors.isAgentSkill(identifier || ''));+ const installedSkill = useToolStore(+ agentSkillsSelectors.getAgentSkillByIdentifier(identifier || ''),+ );+ const [refreshAgentSkills, deleteAgentSkill] = useToolStore((s) => [+ s.refreshAgentSkills,+ s.deleteAgentSkill,+ ]);++ const handleInstall = useCallback(async () => {+ if (!identifier || !canCreate || installing || installed) return;+ setInstalling(true);+ try {+ await agentSkillService.importFromMarket(identifier);+ await refreshAgentSkills();+ } catch {+ // The button falls back to Install (clicking again retries) — say why+ toast.error(t('error.installError', { name: name || identifier }));+ } finally {+ setInstalling(false);+ }+ }, [canCreate, identifier, installing, installed, name, refreshAgentSkills, t]);++ const handleUninstall = useCallback(() => {+ if (!canEdit || !installedSkill) return;+ confirmModal({+ cancelText: tc('cancel'),+ content: t('store.actions.confirmUninstall'),+ okButtonProps: { danger: true },+ okText: t('store.actions.uninstall'),+ onOk: async () => {+ await deleteAgentSkill(installedSkill.id);+ },+ title: t('store.actions.uninstall'),+ });+ }, [canEdit, installedSkill, deleteAgentSkill, t, tc]);++ if (installed)+ return (+ <DropdownMenu+ nativeButton={false}+ placement="bottomRight"+ items={[+ {+ danger: true,+ disabled: !canEdit,+ icon: <Icon icon={Trash2} />,+ key: 'uninstall',+ label: t('store.actions.uninstall'),+ onClick: handleUninstall,+ },+ ]}+ >+ <Button icon={CheckIcon} size={'middle'} style={{ borderRadius: 999 }}>+ {td('skills.details.header.installed')}+ <Icon icon={ChevronDown} size={14} />+ </Button>+ </DropdownMenu>+ );++ return (+ <Button+ disabled={!canCreate}+ loading={installing}+ size={'middle'}+ style={{ borderRadius: 999, fontWeight: 600, paddingInline: 18 }}+ type={'primary'}+ onClick={handleInstall}+ >+ {t('store.actions.install')}+ </Button>+ );+});++const Header = memo<{ mobile?: boolean }>(({ mobile: isMobile }) => {+ const {+ name,+ author,+ identifier,+ updatedAt,+ createdAt,+ ratingAverage,+ ratingCount,+ category,+ installCount,+ github,+ icon,+ isValidated,+ } = useDetailContext();+ const { t } = useTranslation('discover');+ const { mobile = isMobile } = useResponsive();+ const categoryItem = useSkillCategoryItem(category);++ // Same query as the Reviews tab — SWR dedupes them into one request, so the+ // stat costs nothing extra and warms the tab+ const useFetchSkillComments = useDiscoverStore((s) => s.useFetchSkillComments);+ const { data: comments } = useFetchSkillComments({ identifier, ...FIRST_COMMENTS_PAGE_QUERY });++ const displayRatingAverage =+ typeof ratingAverage === 'number' ? Number(ratingAverage.toFixed(1)) : undefined;++ const stats = [+ displayRatingAverage+ ? {+ caption: <Rate gap={2} size={11} value={displayRatingAverage} />,+ label: ratingCount+ ? t('skills.details.header.stats.ratingCount', {+ count: formatShortenNumber(ratingCount),+ })+ : t('skills.details.header.stats.rating'),+ statKey: 'rating',+ value: <div className={styles.ratingValue}>{displayRatingAverage.toFixed(1)}</div>,+ }+ : undefined,+ github?.stars+ ? {+ caption: t('skills.details.header.stats.starsCaption'),+ label: t('skills.details.header.stats.github'),+ statKey: 'stars',+ value: formatShortenNumber(github.stars),+ }+ : undefined,+ installCount+ ? {+ caption: '',+ label: t('skills.details.header.stats.installs'),+ statKey: 'installs',+ value: formatShortenNumber(installCount),+ }+ : undefined,+ comments?.totalCount+ ? {+ caption: '',+ label: t('skills.details.header.stats.reviews'),+ statKey: 'reviews',+ value: formatShortenNumber(comments.totalCount),+ }+ : undefined,+ ].filter(Boolean) as {+ caption?: ReactNode;+ label: ReactNode;+ statKey: string;+ value: ReactNode;+ }[];++ return (+ <Flexbox align={'stretch'} gap={20} width={'100%'}>+ <Flexbox align={'center'} gap={20} horizontal={!mobile} width={'100%'}>+ <Avatar+ avatar={icon || name}+ size={mobile ? 72 : 88}+ style={{+ background: cssVar.colorBgContainer,+ border: `1px solid color-mix(in srgb, ${cssVar.colorBorderSecondary} 86%, transparent)`,+ borderRadius: mobile ? 18 : 22,+ flex: 'none',+ }}+ />+ <Flexbox+ align={mobile ? 'center' : 'flex-start'}+ flex={1}+ gap={6}+ style={{ minWidth: 0, overflow: 'hidden', textAlign: mobile ? 'center' : undefined }}+ >+ <Text+ ellipsis+ as={'h1'}+ title={identifier}+ style={{+ fontSize: mobile ? 22 : 28,+ fontWeight: 650,+ lineHeight: 1.12,+ margin: 0,+ }}+ >+ {name}+ </Text>+ <Flexbox+ horizontal+ align={'center'}+ gap={4}+ justify={mobile ? 'center' : undefined}+ wrap={'wrap'}+ >+ {author?.url ? (+ <a+ className={styles.author}+ href={author.url}+ rel={'noopener noreferrer'}+ target={'_blank'}+ >+ {author.name}+ </a>+ ) : (+ <span className={styles.author}>{author?.name}</span>+ )}+ {isValidated && (+ <Icon+ color={cssVar.colorInfo}+ fill={cssVar.colorInfo}+ icon={CheckCircle2}+ size={14}+ />+ )}+ {categoryItem && (+ <>+ <MetaDivider />+ <Text style={{ color: cssVar.colorTextSecondary, fontSize: 13 }}>+ {categoryItem.label}+ </Text>+ </>+ )}+ {(updatedAt || createdAt) && (+ <>+ <MetaDivider />+ <PublishedTime+ className={styles.time}+ date={(updatedAt || createdAt) as string}+ template={'MMM DD, YYYY'}+ />+ </>+ )}+ </Flexbox>+ </Flexbox>+ <InstallButton identifier={identifier} name={name} />+ </Flexbox>+ {stats.length > 0 && (+ <div className={styles.statsBar} style={{ width: '100%' }}>+ <div+ className={styles.statsGrid}+ style={{+ gridTemplateColumns: mobile ? undefined : `repeat(${stats.length}, minmax(0, 1fr))`,+ }}+ >+ {stats.map((stat, index) => (+ <StatBlock bordered={!mobile && index > 0} key={stat.statKey} {...stat} />+ ))}+ </div>+ </div>+ )}+ </Flexbox>+ );+});++export default Header;diff --git a/src/features/CommunitySkillDetail/Loading.tsx b/src/features/CommunitySkillDetail/Loading.tsxnew file mode 100644index 00000000000..62eb752cf77--- /dev/null+++ b/src/features/CommunitySkillDetail/Loading.tsx@@ -0,0 +1,32 @@+'use client';++import { Flexbox, Skeleton } from '@lobehub/ui';+import { memo } from 'react';++const navSkeletonWidths = [88, 72, 82, 58];++const Loading = memo(() => (+ <Flexbox gap={24} width={'100%'}>+ <Flexbox horizontal align={'center'} gap={20} width={'100%'}>+ <Skeleton.Avatar active shape={'square'} size={88} style={{ borderRadius: 22 }} />+ <Flexbox flex={1} gap={10}>+ <Skeleton.Button active style={{ height: 28, width: 240 }} />+ <Skeleton.Button active style={{ height: 16, width: 320 }} />+ </Flexbox>+ </Flexbox>+ <Skeleton.Button active block style={{ borderRadius: 16, height: 78 }} />+ <Flexbox horizontal gap={24} style={{ borderBottom: '1px solid transparent' }}>+ {navSkeletonWidths.map((width, i) => (+ <Skeleton.Button active key={i} style={{ height: 40, width }} />+ ))}+ </Flexbox>+ <Flexbox gap={8}>+ <Skeleton.Button active block style={{ height: 18 }} />+ <Skeleton.Button active block style={{ height: 18 }} />+ <Skeleton.Button active style={{ height: 18, width: '78%' }} />+ </Flexbox>+ <Skeleton.Button active block style={{ borderRadius: 8, height: 320 }} />+ </Flexbox>+));++export default Loading;diff --git a/src/features/CommunitySkillDetail/SkillDetailContent.tsx b/src/features/CommunitySkillDetail/SkillDetailContent.tsxnew file mode 100644index 00000000000..37341e218e1--- /dev/null+++ b/src/features/CommunitySkillDetail/SkillDetailContent.tsx@@ -0,0 +1,84 @@+'use client';++import { Empty, Flexbox } from '@lobehub/ui';+import { useModalContext } from '@lobehub/ui/base-ui';+import { SearchX } from 'lucide-react';+import { memo, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import AsyncError from '@/components/AsyncError';+import { useDiscoverStore } from '@/store/discover';+import { type DiscoverSkillDetail } from '@/types/discover';++import { DetailActionContext, DetailProvider } from './DetailProvider';+import Details from './Details';+import Header from './Header';+import Loading from './Loading';+import { type SkillNavKey } from './types';++interface SkillDetailViewProps {+ activeTab?: SkillNavKey;+ data: DiscoverSkillDetail;+ mobile?: boolean;+ onTabChange?: (tab: SkillNavKey) => void;+}++/** Pure view over an already-fetched detail — shared by the modal and the standalone page. */+export const SkillDetailView = memo<SkillDetailViewProps>(+ ({ data, mobile, activeTab, onTabChange }) => {+ return (+ <DetailProvider config={data}>+ <Flexbox gap={24} width={'100%'}>+ <Header mobile={mobile} />+ <Details activeTab={activeTab} mobile={mobile} onTabChange={onTabChange} />+ </Flexbox>+ </DetailProvider>+ );+ },+);++interface SkillDetailContentProps {+ identifier: string;+ mobile?: boolean;+}++/**+ * Self-fetching detail used as the modal body. Clicking a related skill swaps+ * the content in place instead of stacking another modal.+ */+export const SkillDetailContent = memo<SkillDetailContentProps>(+ ({ identifier: initialIdentifier, mobile }) => {+ const { t } = useTranslation('error');+ const [identifier, setIdentifier] = useState(initialIdentifier);+ const { close } = useModalContext();++ const useSkillDetail = useDiscoverStore((s) => s.useFetchSkillDetail);+ const { data, error, isLoading, isValidating, mutate } = useSkillDetail({ identifier });++ const actions = useMemo(() => ({ close, selectSkill: setIdentifier }), [close]);++ if (isLoading) return <Loading />;+ // A failed fetch is not "skill doesn't exist" — offer a retry instead+ if (error)+ return (+ <AsyncError+ error={error}+ retrying={isValidating}+ variant={'page'}+ onRetry={() => mutate()}+ />+ );+ if (!data)+ return (+ <Flexbox align={'center'} justify={'center'} paddingBlock={80}>+ <Empty description={t('notFound.title')} icon={SearchX} />+ </Flexbox>+ );++ return (+ <DetailActionContext value={actions}>+ <SkillDetailView data={data} key={identifier} mobile={mobile} />+ </DetailActionContext>+ );+ },+);diff --git a/src/features/CommunitySkillDetail/const.ts b/src/features/CommunitySkillDetail/const.tsnew file mode 100644index 00000000000..59239231f10--- /dev/null+++ b/src/features/CommunitySkillDetail/const.ts@@ -0,0 +1,10 @@+/**+ * First page of the comment list. Header (Reviews stat) and the Reviews tab+ * must query with the SAME params so SWR dedupes them into one request — the+ * header count doubles as a prefetch for the tab.+ */+export const FIRST_COMMENTS_PAGE_QUERY = {+ order: 'desc',+ page: 1,+ sort: 'createdAt',+} as const;diff --git a/src/features/CommunitySkillDetail/index.tsx b/src/features/CommunitySkillDetail/index.tsxnew file mode 100644index 00000000000..3281f4af5cd--- /dev/null+++ b/src/features/CommunitySkillDetail/index.tsx@@ -0,0 +1,31 @@+'use client';++import { createModal } from '@lobehub/ui/base-ui';+import { t } from 'i18next';++import { SkillDetailContent } from './SkillDetailContent';++export { SkillDetailContent, SkillDetailView } from './SkillDetailContent';+export { SkillNavKey } from './types';++export interface CreateSkillDetailModalOptions {+ identifier: string;+}++export const createSkillDetailModal = ({ identifier }: CreateSkillDetailModalOptions) =>+ createModal({+ content: <SkillDetailContent identifier={identifier} />,+ footer: null,+ styles: {+ content: {+ maxHeight: 'calc(100dvh - 160px)',+ overflowY: 'auto',+ paddingBlock: 24,+ paddingInline: 'clamp(16px, 4vw, 40px)',+ },+ },+ // The imperative modal renders its header (and the close button) only when+ // a title is present — `null` would leave backdrop/Escape as the only way out+ title: t('dev.title.skillDetails', { ns: 'plugin' }),+ width: 'min(92vw, 960px)',+ });diff --git a/src/features/CommunitySkillDetail/types.ts b/src/features/CommunitySkillDetail/types.tsnew file mode 100644index 00000000000..92335a36ea3--- /dev/null+++ b/src/features/CommunitySkillDetail/types.ts@@ -0,0 +1,6 @@+export enum SkillNavKey {+ Info = 'info',+ Install = 'install',+ Overview = 'overview',+ Reviews = 'reviews',+}diff --git a/src/routes/(main)/community/(detail)/skill/features/DetailProvider.tsx b/src/routes/(main)/community/(detail)/skill/features/DetailProvider.tsxdeleted file mode 100644index 3a39ef5bd8c..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/DetailProvider.tsx+++ /dev/null@@ -1,19 +0,0 @@-'use client';--import { createContext, memo, type ReactNode, use } from 'react';--import { type DiscoverSkillDetail } from '@/types/discover';--export type DetailContextConfig = Partial<DiscoverSkillDetail>;--export const DetailContext = createContext<DetailContextConfig>({});--export const DetailProvider = memo<{ children: ReactNode; config?: DetailContextConfig }>(- ({ children, config = {} }) => {- return <DetailContext value={config}>{children}</DetailContext>;- },-);--export const useDetailContext = () => {- return use(DetailContext);-};diff --git a/src/routes/(main)/community/(detail)/skill/features/Details/Installation/index.tsx b/src/routes/(main)/community/(detail)/skill/features/Details/Installation/index.tsxdeleted file mode 100644index 36b1ceaf0af..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Details/Installation/index.tsx+++ /dev/null@@ -1,21 +0,0 @@-'use client';--import { memo } from 'react';--import { useDetailContext } from '../../DetailProvider';-import Platform from '../../Sidebar/Platform';--const Installation = memo<{ mobile?: boolean }>(({ mobile }) => {- const { identifier, downloadUrl } = useDetailContext();-- return (- <Platform- expandCodeByDefault- downloadUrl={downloadUrl}- identifier={identifier}- mobile={mobile}- />- );-});--export default Installation;diff --git a/src/routes/(main)/community/(detail)/skill/features/Details/Nav.tsx b/src/routes/(main)/community/(detail)/skill/features/Details/Nav.tsxdeleted file mode 100644index 2160baa6cd8..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Details/Nav.tsx+++ /dev/null@@ -1,150 +0,0 @@-'use client';--import { Flexbox, Icon, Tag } from '@lobehub/ui';-import { Tabs } from '@lobehub/ui/base-ui';-import { SkillsIcon } from '@lobehub/ui/icons';-import { createStaticStyles } from 'antd-style';-import { BookOpenIcon, DownloadIcon, FileTextIcon, HistoryIcon, ListIcon } from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';-import urlJoin from 'url-join';--import { useDetailContext } from '../DetailProvider';-import { SkillNavKey } from '../types';--export const styles = createStaticStyles(({ css, cssVar }) => ({- link: css`- color: ${cssVar.colorTextDescription};-- &:hover {- color: ${cssVar.colorInfo};- }- `,- nav: css`- border-block-end: 1px solid ${cssVar.colorBorder};- `,-}));--const Nav = memo<{- activeTab?: SkillNavKey;- mobile?: boolean;- setActiveTab?: (_tab: SkillNavKey) => void;-}>(({ mobile, setActiveTab, activeTab = SkillNavKey.Overview }) => {- const { t } = useTranslation('discover');- const { versions, repository, homepage, github, resources } = useDetailContext();-- const versionCount = versions?.length || 0;- const resourcesCount = Object.keys(resources || {}).length;- const source = homepage || repository;- const issueTarget = github?.url || repository;-- const nav = (- <Tabs- activeKey={activeTab}- variant="square"- items={[- {- icon: <Icon icon={BookOpenIcon} size={16} />,- key: SkillNavKey.Overview,- label: t('skills.details.overview.title'),- },- {- icon: <Icon icon={DownloadIcon} size={16} />,- key: SkillNavKey.Installation,- label: t('skills.details.sidebar.installationConfig'),- },- {- icon: <Icon icon={SkillsIcon} size={16} />,- key: SkillNavKey.Skill,- label: 'SKILL.md',- },- {- icon: <Icon icon={FileTextIcon} size={16} />,- key: SkillNavKey.Resources,- label:- resourcesCount > 1 ? (- <Flexbox- horizontal- align={'center'}- gap={6}- style={{- display: 'inline-flex',- }}- >- {t('skills.details.resources.title')}- <Tag>{resourcesCount}</Tag>- </Flexbox>- ) : (- t('skills.details.resources.title')- ),- },- {- icon: <Icon icon={ListIcon} size={16} />,- key: SkillNavKey.Related,- label: t('skills.details.related.title'),- },- {- icon: <Icon icon={HistoryIcon} size={16} />,- key: SkillNavKey.Version,- label:- versionCount > 1 ? (- <Flexbox- horizontal- align={'center'}- gap={6}- style={{- display: 'inline-flex',- }}- >- {t('skills.details.versions.title')}- <Tag>{versionCount}</Tag>- </Flexbox>- ) : (- t('skills.details.versions.title')- ),- },- ]}- onChange={(key) => setActiveTab?.(key as SkillNavKey)}- />- );-- return mobile ? (- nav- ) : (- <Flexbox horizontal align={'center'} className={styles.nav} justify={'space-between'}>- {nav}- <Flexbox- horizontal- flex="none"- gap={12}- style={{ marginInlineStart: 12, whiteSpace: 'nowrap' }}- >- <a- className={styles.link}- href="https://discord.gg/AYFPHvv2jT"- rel="noopener noreferrer"- target={'_blank'}- >- {t('skills.details.nav.needHelp')}- </a>- {source && (- <a className={styles.link} href={source} rel="noopener noreferrer" target={'_blank'}>- {t('skills.details.nav.viewSourceCode')}- </a>- )}- {issueTarget && (- <a- className={styles.link}- href={urlJoin(issueTarget, 'issues')}- rel="noopener noreferrer"- target={'_blank'}- >- {t('skills.details.nav.reportIssue')}- </a>- )}- </Flexbox>- </Flexbox>- );-});--export default Nav;diff --git a/src/routes/(main)/community/(detail)/skill/features/Details/Overview/index.tsx b/src/routes/(main)/community/(detail)/skill/features/Details/Overview/index.tsxdeleted file mode 100644index 71c8f24e8b8..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Details/Overview/index.tsx+++ /dev/null@@ -1,68 +0,0 @@-'use client';--import { Collapse, Flexbox, Markdown, ScrollShadow, Tag } from '@lobehub/ui';-import qs from 'query-string';-import { memo, type PropsWithChildren } from 'react';-import { useTranslation } from 'react-i18next';--import List from '../../../../../(list)/skill/features/List';-import Title from '../../../../../components/Title';-import { useDetailContext } from '../../DetailProvider';--const Overview = memo<PropsWithChildren>(({ children }) => {- const { t } = useTranslation('discover');- const { tags = [], description, overview, category, related } = useDetailContext();-- return (- <Flexbox gap={24}>- <Flexbox gap={16}>- <Title>{t('skills.details.summary.title')}</Title>- <Markdown variant={'chat'}>{overview?.summary || description || ''}</Markdown>- </Flexbox>- <Collapse- defaultActiveKey={['summary']}- expandIconPlacement={'end'}- variant={'outlined'}- items={[- {- children: (- <ScrollShadow height={240} offset={16} padding={16} size={16}>- <Flexbox horizontal gap={12}>- {children}- </Flexbox>- </ScrollShadow>- ),- key: 'summary',- label: 'SKILL.md',- },- ]}- padding={{- body: 0,- }}- />- {tags.length > 0 && (- <Flexbox horizontal gap={8} wrap={'wrap'}>- {tags.map((tag) => (- <Tag key={tag}>{tag}</Tag>- ))}- </Flexbox>- )}- {related && related.length > 0 && (- <Flexbox gap={16}>- <Title- more={t('skills.details.related.more')}- moreLink={qs.stringifyUrl({- query: { category },- url: '/community/skill',- })}- >- {t('skills.details.related.listTitle')}- </Title>- <List data={related} />- </Flexbox>- )}- </Flexbox>- );-});--export default Overview;diff --git a/src/routes/(main)/community/(detail)/skill/features/Details/Related/index.tsx b/src/routes/(main)/community/(detail)/skill/features/Details/Related/index.tsxdeleted file mode 100644index 034009bb992..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Details/Related/index.tsx+++ /dev/null@@ -1,32 +0,0 @@-'use client';--import { Flexbox } from '@lobehub/ui';-import qs from 'query-string';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import List from '../../../../../(list)/skill/features/List';-import Title from '../../../../../components/Title';-import { useDetailContext } from '../../DetailProvider';--const Related = memo(() => {- const { t } = useTranslation('discover');- const { related, category } = useDetailContext();-- return (- <Flexbox gap={16}>- <Title- more={t('skills.details.related.more')}- moreLink={qs.stringifyUrl({- query: { category },- url: '/community/skill',- })}- >- {t('skills.details.related.listTitle')}- </Title>- <List data={related} />- </Flexbox>- );-});--export default Related;diff --git a/src/routes/(main)/community/(detail)/skill/features/Details/Resources/index.tsx b/src/routes/(main)/community/(detail)/skill/features/Details/Resources/index.tsxdeleted file mode 100644index 789a58f3904..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Details/Resources/index.tsx+++ /dev/null@@ -1,123 +0,0 @@-'use client';--import { Block, Empty, Flexbox, MaterialFileTypeIcon, Text } from '@lobehub/ui';-import { memo, useMemo } from 'react';-import { useTranslation } from 'react-i18next';-import urlJoin from 'url-join';--import InlineTable from '@/components/InlineTable';--import { useDetailContext } from '../../DetailProvider';--type ResourceMeta = {- fileHash?: string;- size?: number;-};--type ResourceItem = ResourceMeta & {- name: string;-};--const Resources = memo(() => {- const { t } = useTranslation('discover');- const { resources, github, homepage, repository } = useDetailContext();- const repoUrl = homepage || github?.url || repository;-- const dataSource = useMemo<ResourceItem[]>(() => {- return Object.entries((resources || {}) as Record<string, ResourceMeta>)- .map(([name, meta]) => ({- fileHash: meta?.fileHash,- name,- size: meta?.size,- }))- .sort((a, b) => a.name.localeCompare(b.name));- }, [resources]);-- const getResourceLink = (filePath: string) => {- if (!repoUrl) return;- const encodedPath = filePath- .split('/')- .filter(Boolean)- .map((segment) => encodeURIComponent(segment))- .join('/');- return urlJoin(repoUrl, encodedPath);- };-- if (dataSource.length === 0) {- return (- <Block variant={'outlined'}>- <Empty description={t('skills.details.resources.empty')} />- </Block>- );- }-- return (- <Block style={{ overflow: 'hidden' }} variant={'outlined'}>- <InlineTable- dataSource={dataSource}- pagination={false}- rowKey={'name'}- size={'middle'}- columns={[- {- dataIndex: 'name',- key: 'name',- render: (text) => {- const link = getResourceLink(text);- const node = (- <Flexbox horizontal align={'center'} gap={16}>- <MaterialFileTypeIcon- fallbackUnknownType={false}- filename={text}- size={24}- type={'file'}- />- <Text code style={{ wordBreak: 'break-all' }} type={'info'}>- {text}- </Text>- </Flexbox>- );- if (!link) {- return node;- }-- return (- <a href={link} rel={'noreferrer'} target={'_blank'}>- {node}- </a>- );- },- title: t('skills.details.resources.table.name'),- },- {- align: 'end',- dataIndex: 'size',- key: 'size',- render: (value) => {- let size;-- if (typeof value !== 'number') {- size = '--';- } else if (value < 1024) {- size = value + 'B';- } else if (value < 1024 * 1024) {- size = (value / 1024).toFixed(2) + 'KB';- } else {- size = (value / (1024 * 1024)).toFixed(2) + 'MB';- }-- return (- <Text code fontSize={13} type={'secondary'}>- {size}- </Text>- );- },- title: t('skills.details.resources.table.size'),- },- ]}- />- </Block>- );-});--export default Resources;diff --git a/src/routes/(main)/community/(detail)/skill/features/Details/Versions/index.tsx b/src/routes/(main)/community/(detail)/skill/features/Details/Versions/index.tsxdeleted file mode 100644index 15351aa4605..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Details/Versions/index.tsx+++ /dev/null@@ -1,65 +0,0 @@-'use client';--import { Block, Flexbox, Tag } from '@lobehub/ui';-import qs from 'query-string';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';-import { useLocation } from 'react-router';--import InlineTable from '@/components/InlineTable';-import PublishedTime from '@/components/PublishedTime';-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';--import Title from '../../../../../components/Title';-import { useDetailContext } from '../../DetailProvider';--const Versions = memo(() => {- const { t } = useTranslation('discover');- const { versions = [] } = useDetailContext();- const { pathname } = useLocation();-- return (- <Flexbox gap={16}>- <Title>{t('skills.details.versions.title')}</Title>- <Block variant={'outlined'}>- <InlineTable- dataSource={versions}- rowKey={'version'}- size={'middle'}- columns={[- {- dataIndex: 'version',- render: (_, record) => (- <WorkspaceLink- style={{ color: 'inherit' }}- to={qs.stringifyUrl({- query: {- version: record.version,- },- url: pathname,- })}- >- <Flexbox horizontal align={'center'} gap={8}>- <code style={{ fontSize: 14 }}>{record.version}</code>- {record.isLatest && (- <Tag color={'info'}>{t('skills.details.versions.table.isLatest')}</Tag>- )}- </Flexbox>- </WorkspaceLink>- ),- title: t('skills.details.versions.table.version'),- },- {- align: 'end',- dataIndex: 'createdAt',- render: (_, record) => <PublishedTime date={record.createdAt} />,- title: t('skills.details.versions.table.publishAt'),- },- ]}- />- </Block>- </Flexbox>- );-});--export default Versions;diff --git a/src/routes/(main)/community/(detail)/skill/features/Details/index.tsx b/src/routes/(main)/community/(detail)/skill/features/Details/index.tsxdeleted file mode 100644index 4723bc564d3..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Details/index.tsx+++ /dev/null@@ -1,67 +0,0 @@-'use client';--import { Flexbox, Markdown } from '@lobehub/ui';-import { memo, useEffect, useState } from 'react';-import { useSearchParams } from 'react-router';--import { useDetailContext } from '../DetailProvider';-import Sidebar from '../Sidebar';-import { SkillNavKey } from '../types';-import Installation from './Installation';-import Nav from './Nav';-import Overview from './Overview';-import Related from './Related';-import Resources from './Resources';-import Versions from './Versions';--const Details = memo<{ mobile?: boolean }>(({ mobile: isMobile }) => {- const [searchParams, setSearchParams] = useSearchParams();- const activeTabParam = searchParams.get('activeTab');- const urlActiveTab = Object.values(SkillNavKey).includes(activeTabParam as SkillNavKey)- ? (activeTabParam as SkillNavKey)- : SkillNavKey.Overview;- const [activeTab, setActiveTab] = useState<SkillNavKey>(urlActiveTab);- const { content } = useDetailContext();-- useEffect(() => {- setActiveTab(urlActiveTab);- }, [urlActiveTab]);-- const handleSetActiveTab = (tab: SkillNavKey) => {- setActiveTab(tab);- const nextSearchParams = new URLSearchParams(searchParams);-- if (tab === SkillNavKey.Overview) {- nextSearchParams.delete('activeTab');- } else {- nextSearchParams.set('activeTab', tab);- }-- setSearchParams(nextSearchParams, { replace: true });- };-- const skillContent = <Markdown variant={'chat'}>{content ?? ''}</Markdown>;-- return (- <Flexbox gap={24}>- <Nav activeTab={activeTab} mobile={isMobile} setActiveTab={handleSetActiveTab} />- <Flexbox- gap={48}- horizontal={!isMobile}- style={isMobile ? { flexDirection: 'column-reverse' } : undefined}- >- <Flexbox flex={1} style={{ minWidth: 0 }} width={'100%'}>- {activeTab === SkillNavKey.Overview && <Overview>{skillContent}</Overview>}- {activeTab === SkillNavKey.Installation && <Installation mobile={isMobile} />}- {activeTab === SkillNavKey.Skill && skillContent}- {activeTab === SkillNavKey.Resources && <Resources />}- {activeTab === SkillNavKey.Related && <Related />}- {activeTab === SkillNavKey.Version && <Versions />}- </Flexbox>- <Sidebar activeTab={activeTab} mobile={isMobile} />- </Flexbox>- </Flexbox>- );-});--export default Details;diff --git a/src/routes/(main)/community/(detail)/skill/features/Header.tsx b/src/routes/(main)/community/(detail)/skill/features/Header.tsxdeleted file mode 100644index 23a12edb175..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Header.tsx+++ /dev/null@@ -1,227 +0,0 @@-'use client';--import { Github } from '@lobehub/icons';-import { ActionIcon, Avatar, Flexbox, Icon, stopPropagation, Text } from '@lobehub/ui';-import { Button } from '@lobehub/ui/base-ui';-import { createStaticStyles, cssVar } from 'antd-style';-import {- DotIcon,- DownloadIcon,- FileTextIcon,- MessageSquare,- ScaleIcon,- StarIcon,-} from 'lucide-react';-import qs from 'query-string';-import { memo } from 'react';--import PublishedTime from '@/components/PublishedTime';-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';-import { useSkillCategoryItem } from '@/hooks/useSkillCategory';--import { useDetailContext } from './DetailProvider';--export const styles = createStaticStyles(({ css, cssVar }) => {- return {- desc: css`- color: ${cssVar.colorTextSecondary};- `,- extraTag: css`- padding-block: 4px;- padding-inline: 10px 12px;- border-radius: 16px;-- color: ${cssVar.colorTextSecondary};-- background: ${cssVar.colorFillTertiary};- `,- extraTagActive: css`- &:hover {- color: ${cssVar.colorText};- }- `,- time: css`- font-size: 12px;- color: ${cssVar.colorTextDescription};- `,- version: css`- font-family: ${cssVar.fontFamilyCode};- font-size: 13px;- `,- };-});--const formatCompactNumber = (num?: number): string => {- if (!num) return '0';- if (num < 1000) return num.toString();- if (num < 1000000) return `${(num / 1000).toFixed(1)}k`;- return `${(num / 1000000).toFixed(1)}M`;-};--const Header = memo<{ mobile?: boolean }>(({ mobile }) => {- const {- name,- author,- version,- identifier,- updatedAt,- createdAt,- ratingAverage,- category,- installCount,- github,- homepage,- resources,- comments,- license,- icon,- } = useDetailContext();-- const cate = useSkillCategoryItem(category);- const resourcesCount = (Object.values(resources || {})?.length || 0) + 1;-- const scores = (- <Flexbox horizontal align={'center'} className={styles.extraTag} gap={16}>- <Flexbox horizontal align={'center'} className={styles.extraTagActive} gap={8}>- <Icon icon={FileTextIcon} size={14} />- {resourcesCount}- </Flexbox>- </Flexbox>- );-- const cateButton = cate ? (- <WorkspaceLink- to={qs.stringifyUrl({- query: { category: cate.key },- url: '/community/skill',- })}- >- <Button icon={<Icon icon={cate.icon} />} size={'middle'}>- {cate.label}- </Button>- </WorkspaceLink>- ) : null;-- return (- <Flexbox gap={12}>- <Flexbox horizontal align={'flex-start'} gap={16} width={'100%'}>- <Avatar avatar={icon || name} size={mobile ? 48 : 64} />- <Flexbox- flex={1}- gap={4}- style={{- overflow: 'hidden',- }}- >- <Flexbox- horizontal- align={'center'}- gap={8}- justify={'space-between'}- style={{- overflow: 'hidden',- position: 'relative',- }}- >- <Flexbox- horizontal- align={'center'}- flex={1}- gap={12}- style={{- overflow: 'hidden',- position: 'relative',- }}- >- <Text- ellipsis- as={'h1'}- style={{ fontSize: mobile ? 18 : 24, margin: 0 }}- title={identifier}- >- {name}- </Text>- {!mobile && scores}- </Flexbox>- <Flexbox horizontal align={'center'} gap={6}>- {homepage && (- <a- href={homepage}- rel="noopener noreferrer"- target={'_blank'}- onClick={stopPropagation}- >- <ActionIcon fill={cssVar.colorTextDescription} icon={Github} />- </a>- )}- </Flexbox>- </Flexbox>- <Flexbox horizontal align={'center'} gap={4}>- {Boolean(ratingAverage) ? (- <Flexbox horizontal align={'center'} gap={8}>- <Icon fill={cssVar.colorWarning} icon={StarIcon} size={14} />- <Text weight={500}>{ratingAverage?.toFixed(1)}</Text>- </Flexbox>- ) : (- <div className={styles.version}>{version}</div>- )}- <Icon icon={DotIcon} />- {author?.url ? (- <a href={author.url} rel="noopener noreferrer" target={'_blank'}>- {author.name}- </a>- ) : (- <span>{author?.name}</span>- )}- <Icon icon={DotIcon} />- <PublishedTime- className={styles.time}- date={(updatedAt || createdAt) as string}- template={'MMM DD, YYYY'}- />- </Flexbox>- </Flexbox>- </Flexbox>- <Flexbox- horizontal- align={'center'}- gap={mobile ? 12 : 24}- wrap={'wrap'}- style={{- color: cssVar.colorTextSecondary,- }}- >- {mobile && scores}- {!mobile && cateButton}- <Flexbox horizontal align={'center'} gap={mobile ? 12 : 24} wrap={'wrap'}>- {Boolean(license?.name) && (- <Flexbox horizontal align={'center'} gap={6}>- <Icon icon={ScaleIcon} size={14} />- {license?.name}- </Flexbox>- )}- {Boolean(installCount) && (- <Flexbox horizontal align={'center'} gap={6}>- <Icon icon={DownloadIcon} size={14} />- {formatCompactNumber(installCount)}- </Flexbox>- )}- {Boolean(github?.stars) && (- <Flexbox horizontal align={'center'} gap={6}>- <Icon icon={StarIcon} size={14} />- {formatCompactNumber(github?.stars)}- </Flexbox>- )}- {Boolean(comments?.totalCount) && (- <Flexbox horizontal align={'center'} gap={6}>- <Icon icon={MessageSquare} size={14} />- {formatCompactNumber(comments?.totalCount)}- </Flexbox>- )}- </Flexbox>- </Flexbox>- </Flexbox>- );-});--export default Header;diff --git a/src/routes/(main)/community/(detail)/skill/features/Sidebar/FileTree.tsx b/src/routes/(main)/community/(detail)/skill/features/Sidebar/FileTree.tsxdeleted file mode 100644index 3770da5c262..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Sidebar/FileTree.tsx+++ /dev/null@@ -1,162 +0,0 @@-'use client';--import { Flexbox, Icon, MaterialFileTypeIcon, Text } from '@lobehub/ui';-import { type GetProps, Tree } from 'antd';-import type { DataNode } from 'antd/es/tree';-import { createStaticStyles } from 'antd-style';-import { ChevronDown } from 'lucide-react';-import qs from 'query-string';-import { type Key, memo, useMemo, useState } from 'react';-import { useTranslation } from 'react-i18next';-import { useLocation } from 'react-router';--import Title from '../../../../components/Title';-import { useDetailContext } from '../DetailProvider';--type DirectoryTreeProps = GetProps<typeof Tree.DirectoryTree>;--interface TreeNode {- children: Map<string, TreeNode>;- key: string;- name: string;-}--const createNode = (name: string, key: string): TreeNode => ({- children: new Map(),- key: key || '/',- name,-});--export const styles = createStaticStyles(({ css, cssVar }) => ({- tree: css`- .ant-tree-node-content-wrapper {- overflow: hidden;- display: flex;- gap: 4px;- align-items: center;-- color: ${cssVar.colorTextSecondary};- }-- .ant-tree-title {- overflow: hidden;- display: block;- line-height: 1.2;- }-- .ant-tree-switcher {- display: flex;- align-items: center;- justify-content: center;-- margin-inline-end: 0;-- color: ${cssVar.colorTextDescription};- }- `,-}));--const sortNodes = (nodes: TreeNode[]) =>- [...nodes].sort((a, b) => {- const aIsFolder = a.children.size > 0;- const bIsFolder = b.children.size > 0;- if (aIsFolder !== bIsFolder) return aIsFolder ? -1 : 1;- return a.name.localeCompare(b.name);- });--const toTreeData = (node: TreeNode): DataNode => {- const children = sortNodes([...node.children.values()]).map(toTreeData);- const isFolder = children.length > 0;- return {- children: isFolder ? children : undefined,- icon: (- <MaterialFileTypeIcon- fallbackUnknownType={false}- filename={node.name}- size={20}- type={isFolder ? 'folder' : 'file'}- />- ),- key: node.key,- title: <Text ellipsis>{node.name}</Text>,- };-};--const FileTree = memo(() => {- const { t } = useTranslation('discover');- const { resources = {} } = useDetailContext();- const { pathname, search } = useLocation();- const [expand, setExpand] = useState<Key[]>([]);- const detailLink = useMemo(- () =>- qs.stringifyUrl({- query: {- ...Object.fromEntries(new URLSearchParams(search).entries()),- activeTab: 'resources',- },- url: pathname,- }),- [pathname, search],- );-- const treeData = useMemo(() => {- const root = createNode('root', '/');- const entries = Object.entries((resources || {}) as Record<string, unknown>);-- // Include at least the main file to avoid an empty tree- if (!entries.some(([path]) => path.toLowerCase() === 'skill.md')) {- entries.push(['SKILL.md', {}]);- }-- for (const [filePath] of entries) {- const parts = filePath.split('/').filter(Boolean);- let current = root;- let currentPath = '';-- for (const part of parts) {- currentPath = currentPath ? `${currentPath}/${part}` : part;- if (!current.children.has(part)) {- current.children.set(part, createNode(part, currentPath));- }- current = current.children.get(part)!;- }- }-- return sortNodes([...root.children.values()]).map(toTreeData);- }, [resources]);-- const onSelect: DirectoryTreeProps['onSelect'] = (keys) => {- setExpand((prevState) => {- if (prevState.includes(keys[0])) {- return prevState.filter((key) => key !== keys[0]);- } else {- return [...prevState, keys[0]];- }- });- };-- const onExpand: DirectoryTreeProps['onExpand'] = (keys) => {- setExpand(keys);- };-- return (- <Flexbox gap={12}>- <Title more={t('skills.details.sidebar.details')} moreLink={detailLink}>- {t('skills.details.sidebar.files')}- </Title>- <Tree- showIcon- showLine- className={styles.tree}- defaultExpandAll={Object.entries(resources || {})?.length <= 10}- expandedKeys={expand}- switcherIcon={<Icon icon={ChevronDown} size={14} />}- treeData={treeData}- onExpand={onExpand}- onSelect={onSelect}- />- </Flexbox>- );-});--export default FileTree;diff --git a/src/routes/(main)/community/(detail)/skill/features/Sidebar/InstallationConfig.tsx b/src/routes/(main)/community/(detail)/skill/features/Sidebar/InstallationConfig.tsxdeleted file mode 100644index 6cb2272b319..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Sidebar/InstallationConfig.tsx+++ /dev/null@@ -1,35 +0,0 @@-'use client';--import { Flexbox } from '@lobehub/ui';-import qs from 'query-string';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';-import { useLocation } from 'react-router';--import Title from '../../../../components/Title';-import { useDetailContext } from '../DetailProvider';-import { SkillNavKey } from '../types';-import Platform from './Platform';--const InstallationConfig = memo(() => {- const { t } = useTranslation('discover');- const { pathname } = useLocation();- const installLink = qs.stringifyUrl({- query: {- activeTab: SkillNavKey.Installation,- },- url: pathname,- });- const { identifier, downloadUrl } = useDetailContext();-- return (- <Flexbox gap={12}>- <Title more={t('mcp.details.sidebar.moreServerConfig')} moreLink={installLink}>- {t('skills.details.sidebar.installationConfig')}- </Title>- <Platform expandCodeByDefault lite downloadUrl={downloadUrl} identifier={identifier} />- </Flexbox>- );-});--export default InstallationConfig;diff --git a/src/routes/(main)/community/(detail)/skill/features/Sidebar/index.tsx b/src/routes/(main)/community/(detail)/skill/features/Sidebar/index.tsxdeleted file mode 100644index 5b89c678979..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/Sidebar/index.tsx+++ /dev/null@@ -1,73 +0,0 @@-'use client';--import { Flexbox, ScrollShadow } from '@lobehub/ui';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';-import urlJoin from 'url-join';--import { OFFICIAL_SITE } from '@/const/url';--import ShareButton from '../../../features/ShareButton';-import { useDetailContext } from '../DetailProvider';-import { SkillNavKey } from '../types';-import FileTree from './FileTree';-import InstallationConfig from './InstallationConfig';--const Sidebar = memo<{ activeTab?: SkillNavKey; mobile?: boolean }>(- ({ mobile, activeTab = SkillNavKey.Overview }) => {- const { description, tags, name, identifier, icon } = useDetailContext();- const { t } = useTranslation('common');- const showInstallationConfig = activeTab !== SkillNavKey.Installation;- const showFileTree = activeTab !== SkillNavKey.Resources;-- const shareButton = (- <ShareButton- block- size={'large'}- meta={{- avatar: icon,- desc: description,- hashtags: tags,- title: name,- url: urlJoin(OFFICIAL_SITE, 'skills', identifier || ''),- }}- >- {t('share')}- </ShareButton>- );-- if (mobile) {- if (activeTab !== SkillNavKey.Overview && activeTab !== SkillNavKey.Resources) return null;-- return (- <Flexbox gap={24} width={'100%'}>- {showInstallationConfig && <InstallationConfig />}- {shareButton}- {showFileTree && <FileTree />}- </Flexbox>- );- }-- return (- <ScrollShadow- hideScrollBar- flex={'none'}- gap={24}- size={4}- width={360}- style={{- maxHeight: 'calc(100vh - 114px)',- paddingBottom: 24,- position: 'sticky',- top: 114,- }}- >- {showInstallationConfig && <InstallationConfig />}- {shareButton}- {showFileTree && <FileTree />}- </ScrollShadow>- );- },-);--export default Sidebar;diff --git a/src/routes/(main)/community/(detail)/skill/features/types.ts b/src/routes/(main)/community/(detail)/skill/features/types.tsdeleted file mode 100644index 26f720cd7e5..00000000000--- a/src/routes/(main)/community/(detail)/skill/features/types.ts+++ /dev/null@@ -1,8 +0,0 @@-export enum SkillNavKey {- Installation = 'installation',- Overview = 'overview',- Related = 'related',- Resources = 'resources',- Skill = 'skill',- Version = 'version',-}diff --git a/src/routes/(main)/community/(detail)/skill/index.tsx b/src/routes/(main)/community/(detail)/skill/index.tsxindex a798d728915..19daae0709c 100644--- a/src/routes/(main)/community/(detail)/skill/index.tsx+++ b/src/routes/(main)/community/(detail)/skill/index.tsx@@ -1,28 +1,53 @@'use client';import { Flexbox } from '@lobehub/ui';-import { memo } from 'react';-import { useParams } from 'react-router';+import { memo, useCallback } from 'react';+import { useParams, useSearchParams } from 'react-router';+import { SkillDetailView, SkillNavKey } from '@/features/CommunitySkillDetail';+import Loading from '@/features/CommunitySkillDetail/Loading';import { useQuery } from '@/hooks/useQuery';import { useDiscoverStore } from '@/store/discover';import NotFound from '../components/NotFound';-import { TocProvider } from '../features/Toc/useToc';-import { DetailProvider } from './features/DetailProvider';-import Details from './features/Details';-import Header from './features/Header';-import Loading from './loading';interface SkillDetailPageProps {mobile?: boolean;}+/** Tab keys this route emitted before the redesign — keep old shared links working */+const LEGACY_TAB_ALIASES: Record<string, SkillNavKey> = {+ installation: SkillNavKey.Install,+ related: SkillNavKey.Overview,+ resources: SkillNavKey.Install,+ skill: SkillNavKey.Overview,+ version: SkillNavKey.Overview,+};+const SkillDetailPage = memo<SkillDetailPageProps>(({ mobile }) => {const params = useParams<{ slug: string }>();const identifier = params.slug ?? '';const { version } = useQuery() as { version?: string };+ const [searchParams, setSearchParams] = useSearchParams();+ const activeTabParam = searchParams.get('activeTab');+ const activeTab = Object.values(SkillNavKey).includes(activeTabParam as SkillNavKey)+ ? (activeTabParam as SkillNavKey)+ : (LEGACY_TAB_ALIASES[activeTabParam ?? ''] ?? SkillNavKey.Overview);++ const handleTabChange = useCallback(+ (tab: SkillNavKey) => {+ const next = new URLSearchParams(searchParams);+ if (tab === SkillNavKey.Overview) {+ next.delete('activeTab');+ } else {+ next.set('activeTab', tab);+ }+ setSearchParams(next, { replace: true });+ },+ [searchParams, setSearchParams],+ );+const useSkillDetail = useDiscoverStore((s) => s.useFetchSkillDetail);const { data, isLoading } = useSkillDetail({ identifier, version });@@ -30,14 +55,14 @@ const SkillDetailPage = memo<SkillDetailPageProps>(({ mobile }) => {if (!data) return <NotFound />;return (- <TocProvider>- <DetailProvider config={data}>- <Flexbox data-testid="skill-detail-content" gap={16}>- <Header mobile={mobile} />- <Details mobile={mobile} />- </Flexbox>- </DetailProvider>- </TocProvider>+ <Flexbox data-testid="skill-detail-content" gap={16}>+ <SkillDetailView+ activeTab={activeTab}+ data={data}+ mobile={mobile}+ onTabChange={handleTabChange}+ />+ </Flexbox>);});diff --git a/src/routes/(main)/community/(detail)/skill/loading.tsx b/src/routes/(main)/community/(detail)/skill/loading.tsxdeleted file mode 100644index 3da3304eca6..00000000000--- a/src/routes/(main)/community/(detail)/skill/loading.tsx+++ /dev/null@@ -1 +0,0 @@-export { DetailsLoading as default } from '../../components/ListLoading';diff --git a/src/routes/(main)/community/(list)/skill/features/List/Item.tsx b/src/routes/(main)/community/(list)/skill/features/List/Item.tsxindex 1d88195b2ca..b2752379240 100644--- a/src/routes/(main)/community/(list)/skill/features/List/Item.tsx+++ b/src/routes/(main)/community/(list)/skill/features/List/Item.tsx@@ -10,7 +10,7 @@ import { useTranslation } from 'react-i18next';import urlJoin from 'url-join';import PublishedTime from '@/components/PublishedTime';-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { createSkillDetailModal } from '@/features/CommunitySkillDetail';import WorkspaceLink from '@/features/Workspace/WorkspaceLink';import { discoverService } from '@/services/discover';import { type DiscoverSkillItem } from '@/types/discover';@@ -60,13 +60,11 @@ const SkillItem = memo<DiscoverSkillItem>(updatedAt,installCount,github,- homepage,ratingAvg,commentCount,resourcesCount = 0,}) => {const { t } = useTranslation('discover');- const navigate = useWorkspaceAwareNavigate();const link = urlJoin('/community/skill', identifier);const handleClick = useCallback(() => {@@ -78,8 +76,8 @@ const SkillItem = memo<DiscoverSkillItem>(}).catch(() => {});- navigate(link);- }, [identifier, link, navigate]);+ createSkillDetailModal({ identifier });+ }, [identifier]);return (<Block@@ -128,7 +126,19 @@ const SkillItem = memo<DiscoverSkillItem>(overflow: 'hidden',}}>- <WorkspaceLink style={{ color: 'inherit', overflow: 'hidden' }} to={link}>+ {/* Keep the deep link for cmd/ctrl-click; plain clicks open the modal */}+ <WorkspaceLink+ style={{ color: 'inherit', overflow: 'hidden' }}+ to={link}+ onClick={(e) => {+ // Never let the click bubble to the card (it would open the+ // modal on top of the browser's new-tab navigation)+ e.stopPropagation();+ if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;+ e.preventDefault();+ handleClick();+ }}+ ><Text ellipsis as={'h2'} className={styles.title}>{name}</Text>