@@ -24,9 +24,9 @@ const { Title, Text, Paragraph } = Typography;
2424interface HeroSectionProps {
2525 challenges : number ;
2626 difficultyCounts : {
27- easy : number ;
28- medium : number ;
29- hard : number ;
27+ beginner : number ;
28+ intermediate : number ;
29+ advanced : number ;
3030 } ;
3131 animatedStats : boolean ;
3232}
@@ -40,10 +40,10 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
4040 const isMobile = useMediaQuery ( { maxWidth : 768 } ) ;
4141
4242 // 计算每个难度级别的百分比
43- const total = difficultyCounts . easy + difficultyCounts . medium + difficultyCounts . hard || 1 ;
44- const easyPercent = Math . round ( ( difficultyCounts . easy / total ) * 100 ) ;
45- const mediumPercent = Math . round ( ( difficultyCounts . medium / total ) * 100 ) ;
46- const hardPercent = Math . round ( ( difficultyCounts . hard / total ) * 100 ) ;
43+ const total = difficultyCounts . beginner + difficultyCounts . intermediate + difficultyCounts . advanced || 1 ;
44+ const beginnerPercent = Math . round ( ( difficultyCounts . beginner / total ) * 100 ) ;
45+ const intermediatePercent = Math . round ( ( difficultyCounts . intermediate / total ) * 100 ) ;
46+ const advancedPercent = Math . round ( ( difficultyCounts . advanced / total ) * 100 ) ;
4747
4848 // 难度级别卡片样式
4949 const difficultyCardStyle = {
@@ -174,7 +174,7 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
174174 < Row gutter = { [ isMobile ? 8 : 16 , isMobile ? 8 : 16 ] } >
175175 { /* 初级难度 */ }
176176 < Col span = { 24 } sm = { 8 } >
177- < Tooltip title = { `${ easyPercent } % ${ t ( 'home.hero.stats.ofTotal' ) } ` } >
177+ < Tooltip title = { `${ beginnerPercent } % ${ t ( 'home.hero.stats.ofTotal' ) } ` } >
178178 < div
179179 style = { {
180180 ...difficultyCardStyle ,
@@ -200,10 +200,10 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
200200 marginBottom : '8px' ,
201201 textShadow : '0 0 10px rgba(82, 196, 26, 0.4)'
202202 } } >
203- { difficultyCounts . easy }
203+ { difficultyCounts . beginner }
204204 </ div >
205205 < Progress
206- percent = { easyPercent }
206+ percent = { beginnerPercent }
207207 showInfo = { false }
208208 strokeColor = "#52c41a"
209209 trailColor = "rgba(255,255,255,0.1)"
@@ -215,7 +215,7 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
215215
216216 { /* 中级难度 */ }
217217 < Col span = { 24 } sm = { 8 } >
218- < Tooltip title = { `${ mediumPercent } % ${ t ( 'home.hero.stats.ofTotal' ) } ` } >
218+ < Tooltip title = { `${ intermediatePercent } % ${ t ( 'home.hero.stats.ofTotal' ) } ` } >
219219 < div
220220 style = { {
221221 ...difficultyCardStyle ,
@@ -241,10 +241,10 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
241241 marginBottom : '8px' ,
242242 textShadow : '0 0 10px rgba(250, 173, 20, 0.4)'
243243 } } >
244- { difficultyCounts . medium }
244+ { difficultyCounts . intermediate }
245245 </ div >
246246 < Progress
247- percent = { mediumPercent }
247+ percent = { intermediatePercent }
248248 showInfo = { false }
249249 strokeColor = "#faad14"
250250 trailColor = "rgba(255,255,255,0.1)"
@@ -256,7 +256,7 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
256256
257257 { /* 高级难度 */ }
258258 < Col span = { 24 } sm = { 8 } >
259- < Tooltip title = { `${ hardPercent } % ${ t ( 'home.hero.stats.ofTotal' ) } ` } >
259+ < Tooltip title = { `${ advancedPercent } % ${ t ( 'home.hero.stats.ofTotal' ) } ` } >
260260 < div
261261 style = { {
262262 ...difficultyCardStyle ,
@@ -282,10 +282,10 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
282282 marginBottom : '8px' ,
283283 textShadow : '0 0 10px rgba(245, 34, 45, 0.4)'
284284 } } >
285- { difficultyCounts . hard }
285+ { difficultyCounts . advanced }
286286 </ div >
287287 < Progress
288- percent = { hardPercent }
288+ percent = { advancedPercent }
289289 showInfo = { false }
290290 strokeColor = "#f5222d"
291291 trailColor = "rgba(255,255,255,0.1)"
0 commit comments