Skip to content

Commit f5804fe

Browse files
committed
feat: add new platform types (WeChat-MiniProgram, Electron, Windows-Native, Mac-Native, Linux-Native)
1 parent 3925791 commit f5804fe

File tree

7 files changed

+59
-7
lines changed

7 files changed

+59
-7
lines changed

docs/challenges/meta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ challenges:
1818
- jsvmp
1919

2020
# 挑战目标网站类型(枚举值,必填)
21-
# 允许值: Web / Android / iOS
21+
# 允许值: Web / Android / iOS / WeChat-MiniProgram / Electron / Windows-Native / Mac-Native / Linux-Native
2222
platform: Web
2323

2424
# 挑战名称(必填)

src/components/ChallengeContributePage/components/BasicInfo.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ const BasicInfo: React.FC<BasicInfoProps> = ({ form }) => {
3838
<Radio.Button value="Web">Web</Radio.Button>
3939
<Radio.Button value="Android">Android</Radio.Button>
4040
<Radio.Button value="iOS">iOS</Radio.Button>
41+
<Radio.Button value="WeChat-MiniProgram">微信小程序</Radio.Button>
42+
<Radio.Button value="Electron">Electron</Radio.Button>
43+
<Radio.Button value="Windows-Native">Windows</Radio.Button>
44+
<Radio.Button value="Mac-Native">Mac</Radio.Button>
45+
<Radio.Button value="Linux-Native">Linux</Radio.Button>
4146
</Radio.Group>
4247
</Form.Item>
4348

src/components/ChallengeContributePage/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface Solution {
2525
export interface ChallengeFormData {
2626
id?: number | null;
2727
idAlias?: string;
28-
platform?: 'Web' | 'Android' | 'iOS';
28+
platform?: 'Web' | 'Android' | 'iOS' | 'WeChat-MiniProgram' | 'Electron' | 'Windows-Native' | 'Mac-Native' | 'Linux-Native';
2929
name?: string;
3030
nameEn?: string;
3131
difficultyLevel?: number;
@@ -62,7 +62,7 @@ export interface ChallengeData {
6262
id: number | null;
6363
'id-alias'?: string;
6464
tags: string[];
65-
platform: 'Web' | 'Android' | 'iOS';
65+
platform: 'Web' | 'Android' | 'iOS' | 'WeChat-MiniProgram' | 'Electron' | 'Windows-Native' | 'Mac-Native' | 'Linux-Native';
6666
name: string;
6767
name_en?: string;
6868
'difficulty-level': number;

src/components/ChallengeListPage/ChallengeControls.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ import StarRating from '../StarRating';
66
import { useMediaQuery } from 'react-responsive';
77

88
// 定义平台枚举值
9-
const PLATFORM_TYPES = ['Web', 'Android', 'iOS'];
9+
const PLATFORM_TYPES = [
10+
'Web',
11+
'Android',
12+
'iOS',
13+
'WeChat-MiniProgram',
14+
'Electron',
15+
'Windows-Native',
16+
'Mac-Native',
17+
'Linux-Native'
18+
];
1019

1120
interface ChallengeControlsProps {
1221
/**

src/components/PlatformTag.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,28 @@ const PlatformTag: React.FC<PlatformTagProps> = ({
5454
const tooltipText = tooltip || t('tagTooltips.filterByPlatform');
5555

5656
const getColor = () => {
57-
if (platform === 'LeetCode') {
58-
return 'orange';
57+
switch (platform) {
58+
case 'Web':
59+
return 'blue';
60+
case 'Android':
61+
return 'green';
62+
case 'iOS':
63+
return 'volcano';
64+
case 'WeChat-MiniProgram':
65+
return 'green';
66+
case 'Electron':
67+
return 'cyan';
68+
case 'Windows-Native':
69+
return 'blue';
70+
case 'Mac-Native':
71+
return 'purple';
72+
case 'Linux-Native':
73+
return 'orange';
74+
case 'LeetCode':
75+
return 'orange';
76+
default:
77+
return 'purple';
5978
}
60-
return 'purple';
6179
};
6280

6381
const handleClick = (e: React.MouseEvent) => {

src/locales/en.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,16 @@ export default {
175175
actions: {
176176
backToList: 'Back to Challenge List'
177177
},
178+
platforms: {
179+
Web: 'Web Site',
180+
Android: 'Android App',
181+
iOS: 'iOS App',
182+
'WeChat-MiniProgram': 'WeChat Mini Program',
183+
'Electron': 'Electron App',
184+
'Windows-Native': 'Windows Native',
185+
'Mac-Native': 'Mac Native',
186+
'Linux-Native': 'Linux Native'
187+
},
178188
pagination: {
179189
previous: 'Previous',
180190
next: 'Next',

src/locales/zh.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,16 @@ const zhTranslations = {
175175
actions: {
176176
backToList: '返回挑战列表'
177177
},
178+
platforms: {
179+
Web: 'Web网站',
180+
Android: 'Android应用',
181+
iOS: 'iOS应用',
182+
'WeChat-MiniProgram': '微信小程序',
183+
'Electron': 'Electron应用',
184+
'Windows-Native': 'Windows原生',
185+
'Mac-Native': 'Mac原生',
186+
'Linux-Native': 'Linux原生'
187+
},
178188
pagination: {
179189
previous: '上一题',
180190
next: '下一题',

0 commit comments

Comments
 (0)