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

This commit is contained in:
zhanjunhao
2026-11-05 16:56:58 +08:00
parent e6c41e7587
commit bc6af74e9e
27 changed files with 4291 additions and 1581 deletions
@@ -0,0 +1,151 @@
/*
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, Input } from 'antd';
import { Search } from 'lucide-react';
import { useTranslation } from 'react-i18next';
// 原型 .sm-art 的线路路径(viewBox 1440×240),颜色由 skill-market.css 的 --sm-connector / --sm-flow-stroke 控制。
const CONNECTOR_PATHS =
'M60 40q120 0 120 75t180 60M65 210q50-125 160-125t120-70M1060 35q150 0 150 80t170 65M1080 200q80-100 160-100t150-75';
const FLOW_PATHS = 'M60 40q120 0 120 75t180 60M1060 35q150 0 150 80t170 65';
// 装饰图形使用原型路径,保留原型 flex 收缩比例;不替换页面的操作图标。
const SkillArtIcon = ({ size, path }) => (
<svg
width={size}
height={size}
viewBox='0 0 24 24'
fill='none'
stroke='currentColor'
strokeWidth='1.65'
strokeLinecap='round'
strokeLinejoin='round'
aria-hidden='true'
>
<path d={path} />
</svg>
);
const SkillHeroArt = () => (
<div className='sm-art' aria-hidden='true'>
<div className='sm-dot-field' />
<div className='sm-orbit sm-orbit-one' />
<div className='sm-orbit sm-orbit-two' />
<svg
className='sm-connectors'
viewBox='0 0 1440 240'
preserveAspectRatio='xMidYMid slice'
>
<defs>
<linearGradient id='sm-connect-gradient'>
<stop className='sm-connect-stop' stopOpacity='0' />
<stop className='sm-connect-stop' offset='.5' stopOpacity='.55' />
<stop className='sm-connect-stop' offset='1' stopOpacity='0' />
</linearGradient>
</defs>
<g fill='none' stroke='url(#sm-connect-gradient)' strokeWidth='1'>
<path d={CONNECTOR_PATHS} />
</g>
<g className='sm-flow' fill='none' strokeWidth='2'>
<path d={FLOW_PATHS} />
</g>
</svg>
<div className='sm-module sm-module-code'>
<span className='sm-module-key' />
<i />
<i />
</div>
<div className='sm-module sm-module-data'>
<SkillArtIcon size={24} path='M4 20V10 M10 20V4 M16 20v-8 M22 20H2' />
<div>
<i />
<i />
<i />
<i />
</div>
</div>
<div className='sm-module sm-module-file'>
<SkillArtIcon size={25} path='M6 3h12v18H6z M9 8h6 M9 12h6 M9 16h4' />
<i />
<i />
</div>
<div className='sm-module sm-module-tool'>
<SkillArtIcon
size={25}
path='m9.5 3-.7 2.5-2.3 1-2.3-.6-2 3.4 1.8 1.9v2.6l-1.8 1.9 2 3.4 2.3-.6 2.3 1 .7 2.5h4l.7-2.5 2.3-1 2.3.6 2-3.4-1.8-1.9v-2.6l1.8-1.9-2-3.4-2.3.6-2.3-1-.7-2.5z M14.5 12.5a3 3 0 1 1-6 0a3 3 0 0 1 6 0'
/>
<span />
<span />
</div>
</div>
);
/**
* 原型 .sm-hero:装饰线路、标题、副标题与搜索条。
* 搜索行为由页面传入:onChange 写入输入值;表单提交(「搜索」按钮 / 回车)调用 onSearch;
* 清空输入(包括键盘删除)调用 onClear;「重置」调用页面原有的重置组合。
*/
const SkillMarketHero = ({ value, onChange, onSearch, onReset, onClear }) => {
const { t } = useTranslation();
const handleChange = (event) => {
if (event.target.value === '' && onClear) {
onClear();
return;
}
onChange(event.target.value);
};
return (
<header className='sm-hero'>
<SkillHeroArt />
<div className='sm-intro'>
<h1>{t('让每一次输出都更专业')}</h1>
<p>{t('发现适合任务的技能,为模型加入专业约束与工作方法。')}</p>
</div>
<form
className='sm-search'
role='search'
onSubmit={(event) => {
event.preventDefault();
onSearch();
}}
>
<Input
allowClear
prefix={<Search size={18} strokeWidth={1.65} aria-hidden='true' />}
aria-label={t('搜索技能名称或描述')}
placeholder={t('搜索技能名称或描述')}
value={value}
onChange={handleChange}
/>
<Button onClick={onReset}>{t('重置')}</Button>
<Button
type='primary'
htmlType='submit'
icon={<Search size={16} strokeWidth={1.65} aria-hidden='true' />}
>
{t('搜索')}
</Button>
</form>
</header>
);
};
export default SkillMarketHero;