Skip to content

Commit a8f650d

Browse files
committed
Refactor: standardize quotes and improve rendering logic in PublishFeatureTable component
- Updated string quotes from single to double for consistency. - Enhanced rendering logic for release status tags to streamline code and improve readability. - Ensured uniformity in data structure and key definitions within the component.
1 parent 6edb817 commit a8f650d

File tree

1 file changed

+46
-45
lines changed

1 file changed

+46
-45
lines changed

src/pages/manage/components/publish-feature-table.tsx

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Table, Tag } from 'antd';
1+
import { Table, Tag } from "antd";
22

33
/**
44
* 发布功能支持情况表格组件
@@ -12,25 +12,25 @@ export default function PublishFeatureTable() {
1212
pagination={false}
1313
dataSource={[
1414
{
15-
key: '1',
16-
version: '< v10.15.0',
17-
fullRelease: '✓ 支持',
18-
grayRelease: '✗ 不支持',
19-
bothRelease: '⚠ 灰度被忽略',
15+
key: "1",
16+
version: "< v10.15.0",
17+
fullRelease: "✓ 支持",
18+
grayRelease: "✗ 不支持",
19+
bothRelease: "⚠ 灰度被忽略",
2020
},
2121
{
22-
key: '2',
23-
version: 'v10.15.0 - v10.31.3',
24-
fullRelease: '✓ 支持',
25-
grayRelease: '✓ 支持',
26-
bothRelease: '⚠ 灰度被忽略',
22+
key: "2",
23+
version: "v10.15.0 - v10.31.3",
24+
fullRelease: "✓ 支持",
25+
grayRelease: "✓ 支持",
26+
bothRelease: "⚠ 灰度被忽略",
2727
},
2828
{
29-
key: '3',
30-
version: '≥ v10.32.0',
31-
fullRelease: '✓ 支持',
32-
grayRelease: '✓ 支持',
33-
bothRelease: '✓ 支持',
29+
key: "3",
30+
version: "≥ v10.32.0",
31+
fullRelease: "✓ 支持",
32+
grayRelease: "✓ 支持",
33+
bothRelease: "✓ 支持(cli >= 2.4.0)",
3434
},
3535
]}
3636
columns={[
@@ -42,47 +42,48 @@ export default function PublishFeatureTable() {
4242
(用户端)
4343
</span>
4444
),
45-
dataIndex: 'version',
46-
key: 'version',
45+
dataIndex: "version",
46+
key: "version",
4747
width: 200,
4848
},
4949
{
50-
title: '仅全量发布',
51-
dataIndex: 'fullRelease',
52-
key: 'fullRelease',
53-
align: 'center',
50+
title: "仅全量发布",
51+
dataIndex: "fullRelease",
52+
key: "fullRelease",
53+
align: "center",
5454
render: (text: string) => {
55-
if (text.includes('✓')) {
56-
return <Tag color="success">✓ 支持</Tag>;
57-
}
58-
return <Tag color="error">✗ 不支持</Tag>;
55+
return (
56+
<Tag color={text.includes("✓") ? "success" : "error"}>
57+
{text}
58+
</Tag>
59+
);
5960
},
6061
},
6162
{
62-
title: '仅灰度发布',
63-
dataIndex: 'grayRelease',
64-
key: 'grayRelease',
65-
align: 'center',
63+
title: "仅灰度发布",
64+
dataIndex: "grayRelease",
65+
key: "grayRelease",
66+
align: "center",
6667
render: (text: string) => {
67-
if (text.includes('✓')) {
68-
return <Tag color="success">✓ 支持</Tag>;
69-
}
70-
return <Tag color="error">✗ 不支持</Tag>;
68+
return (
69+
<Tag color={text.includes("✓") ? "success" : "error"}>
70+
{text}
71+
</Tag>
72+
);
7173
},
7274
},
7375
{
74-
title: '同时发布',
75-
dataIndex: 'bothRelease',
76-
key: 'bothRelease',
77-
align: 'center',
76+
title: "同时发布",
77+
dataIndex: "bothRelease",
78+
key: "bothRelease",
79+
align: "center",
7880
render: (text: string) => {
79-
if (text.includes('✓')) {
80-
return <Tag color="success">✓ 支持</Tag>;
81-
}
82-
if (text.includes('⚠')) {
83-
return <Tag color="warning">⚠ 灰度被忽略</Tag>;
84-
}
85-
return <Tag color="error">✗ 不支持</Tag>;
81+
const color = text.includes("✓")
82+
? "success"
83+
: text.includes("⚠")
84+
? "warning"
85+
: "error";
86+
return <Tag color={color}>{text}</Tag>;
8687
},
8788
},
8889
]}

0 commit comments

Comments
 (0)