1
0

refactor: 迁移前端 antd 组件至 v6 规范 API,消除废弃用法

- 迁移静态 message 到 App.useApp() 模式,使 message 感知 ConfigProvider 上下文
- Button type/danger 迁移为 variant/color 新 API
- Space direction 迁移为 vertical 布尔属性
- Select.Option 子组件迁移为 options 属性
- AppLayout 硬编码颜色替换为 antd design token
- 优化 useThemeConfig:default/dark 改为静态导出,减少不必要的 hook 调用
- 同步更新 openspec 主规范文档
This commit is contained in:
2026-04-17 00:59:36 +08:00
parent 49818ed4d8
commit 6eeb38c15e
19 changed files with 121 additions and 96 deletions

View File

@@ -10,7 +10,7 @@ export function NotFound() {
title="404"
subTitle="抱歉,您访问的页面不存在。"
extra={
<Button type="primary" onClick={() => navigate('/providers')}>
<Button color="primary" variant="solid" onClick={() => navigate('/providers')}>
</Button>
}

View File

@@ -68,13 +68,9 @@ export function ModelForm({
name="providerId"
rules={[{ required: true, message: '请选择供应商' }]}
>
<Select>
{providers.map((p) => (
<Select.Option key={p.id} value={p.id}>
{p.name}
</Select.Option>
))}
</Select>
<Select
options={providers.map((p) => ({ label: p.name, value: p.id }))}
/>
</Form.Item>
<Form.Item

View File

@@ -35,7 +35,7 @@ export function ModelTable({ providerId, onAdd, onEdit }: ModelTableProps) {
render: (_, record) => (
<Space>
{onEdit && (
<Button type="link" size="small" onClick={() => onEdit(record)}>
<Button variant="link" size="small" onClick={() => onEdit(record)}>
</Button>
)}
@@ -45,7 +45,7 @@ export function ModelTable({ providerId, onAdd, onEdit }: ModelTableProps) {
okText="确定"
cancelText="取消"
>
<Button type="link" danger size="small">
<Button variant="link" color="danger" size="small">
</Button>
</Popconfirm>
@@ -59,7 +59,7 @@ export function ModelTable({ providerId, onAdd, onEdit }: ModelTableProps) {
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 8 }}>
<span style={{ fontWeight: 500 }}> ({models.length})</span>
{onAdd && (
<Button type="link" size="small" onClick={onAdd}>
<Button variant="link" size="small" onClick={onAdd}>
</Button>
)}

View File

@@ -68,7 +68,7 @@ export function ProviderTable({
width: 160,
render: (_, record) => (
<Space>
<Button type="link" size="small" onClick={() => onEdit(record)}>
<Button variant="link" size="small" onClick={() => onEdit(record)}>
</Button>
<Popconfirm
@@ -77,7 +77,7 @@ export function ProviderTable({
okText="确定"
cancelText="取消"
>
<Button type="link" danger size="small">
<Button variant="link" color="danger" size="small">
</Button>
</Popconfirm>
@@ -90,7 +90,7 @@ export function ProviderTable({
<Card
title="供应商列表"
extra={
<Button type="primary" onClick={onAdd}>
<Button color="primary" variant="solid" onClick={onAdd}>
</Button>
}

View File

@@ -8,9 +8,9 @@ export function SettingsPage() {
const { themeId, followSystem, setThemeId, setFollowSystem } = useTheme();
return (
<Space direction="vertical" size="large" style={{ width: '100%' }}>
<Space vertical size="large" style={{ width: '100%' }}>
<Card title="主题">
<Space direction="vertical" size="middle" style={{ width: '100%' }}>
<Space vertical size="middle" style={{ width: '100%' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<Text strong></Text>