feat(skill-market): 优化筛选界面并恢复真实接口

This commit is contained in:
zhanjunhao
2026-11-05 16:56:58 +08:00
parent 78fe73d0db
commit d4495eb703
27 changed files with 4291 additions and 1581 deletions
@@ -0,0 +1,115 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import { Button, Drawer, Tag } from 'antd';
import { useTranslation } from 'react-i18next';
/**
* 原型 .sm-detail-drawer:Ant Design Drawer(620px,窄屏 100vw),正文为描述 + 来源 / 标签 / 适用场景 /
* 触发词分节与更新时间,页脚「关闭」+ 页面已有操作。children 插在来源之后(如企业治理参考)。
* Portal 挂 .sm-theme 并复用页面的主题变量(themeStyle),不新增 ConfigProvider。
*/
const SkillDetailDrawer = ({
skill,
open,
onClose,
sourceText,
tagLabel,
themeStyle,
actions = null,
children = null,
}) => {
const { t, i18n } = useTranslation();
return (
<Drawer
title={skill?.name}
open={open}
onClose={onClose}
maskClosable
width={620}
rootClassName='sm-detail-drawer sm-theme'
rootStyle={themeStyle}
footer={
skill ? (
<div className='sm-detail-footer'>
<Button onClick={onClose}>{t('关闭')}</Button>
{actions}
</div>
) : null
}
>
{skill ? (
<>
<p className='sm-detail-description'>{skill.description}</p>
<section>
<h3>{t('来源')}</h3>
<p>
{sourceText} · {skill.canonical_id} · v{skill.version_no}
</p>
</section>
{children}
{skill.tags?.length ? (
<section>
<h3>{t('标签')}</h3>
<div className='sm-detail-tags'>
{skill.tags.map((tag) => (
<Tag key={tag} bordered={false}>
{tagLabel(tag)}
</Tag>
))}
</div>
</section>
) : null}
{skill.scenarios?.length ? (
<section>
<h3>{t('适用场景')}</h3>
<ul>
{skill.scenarios.map((item) => (
<li key={item}>{item}</li>
))}
</ul>
</section>
) : null}
{skill.triggers?.length ? (
<section>
<h3>{t('触发词')}</h3>
<p>{t('任务描述中出现这些词时,该技能会自动生效。')}</p>
<div className='sm-detail-tags'>
{skill.triggers.map((item) => (
<Tag key={item} bordered={false}>
{item}
</Tag>
))}
</div>
</section>
) : null}
<div className='sm-detail-updated'>
{t('更新时间')}:
{skill.updated_at
? new Date(skill.updated_at * 1000).toLocaleString(i18n.language)
: '-'}
</div>
</>
) : null}
</Drawer>
);
};
export default SkillDetailDrawer;