@@ -7,40 +7,10 @@ import { useMyDailySolved } from '@/entities/mypage/model/query';
77import { CheckCircle , ChevronLeft , ChevronRight } from 'lucide-react' ;
88import { Button } from '@/components/ui/button' ;
99import Cookies from 'js-cookie' ;
10+ import { LevelUtil } from '@/shared/util/levelUtil' ;
1011
1112const PAGE_LIMIT = 15 ;
1213
13- const getLevelColorClass = ( levelStr : string ) : string => {
14- if ( ! levelStr ) return '' ;
15- const level = parseInt ( levelStr . replace ( / [ ^ 0 - 9 ] / g, '' ) , 10 ) ;
16- if ( level <= 2 ) return 'text-blue-400 font-medium' ;
17- if ( level <= 4 ) return 'text-yellow-400 font-medium' ;
18- if ( level <= 6 ) return 'text-orange-400 font-medium' ;
19- return 'text-red-400 font-medium' ;
20- } ;
21-
22- const getLevelBg = ( difficulty : string ) => {
23- const level = parseInt ( difficulty . replace ( / [ ^ 0 - 9 ] / g, '' ) , 10 ) ;
24- if ( level <= 2 ) return 'bg-blue-500/20 border-blue-500/30' ;
25- if ( level <= 4 ) return 'bg-yellow-500/20 border-yellow-500/30' ;
26- if ( level <= 6 ) return 'bg-orange-500/20 border-orange-500/30' ;
27- return 'bg-red-500/20 border-red-500/30' ;
28- } ;
29-
30- const getLevelText = ( difficulty : string ) => {
31- const level = parseInt ( difficulty . replace ( / [ ^ 0 - 9 ] / g, '' ) , 10 ) ;
32- const labels = {
33- 1 : '입문' ,
34- 2 : '초급' ,
35- 3 : '중급' ,
36- 4 : '중상급' ,
37- 5 : '고급' ,
38- 6 : '전문가' ,
39- 7 : '마스터' ,
40- } ;
41- return `${ labels [ level as keyof typeof labels ] || '알 수 없음' } (${ level } 단계)` ;
42- } ;
43-
4414export default function ProblemTable ( {
4515 data,
4616 isLoading,
@@ -179,11 +149,11 @@ export default function ProblemTable({
179149 </ td >
180150 < td className = { `px-6 py-4 text-center text-sm font-medium` } >
181151 < span
182- className = { `inline-flex items-center px-3 py-1.5 text-xs font-medium rounded-full border transition-all duration-200 hover:scale-105 ${ getLevelBg (
152+ className = { `inline-flex items-center px-3 py-1.5 text-xs font-medium rounded-full border transition-all duration-200 hover:scale-105 ${ LevelUtil . getLevelBg (
183153 item . difficulty
184- ) } ${ getLevelColorClass ( item . difficulty ) } `}
154+ ) } ${ LevelUtil . getLevelColorClass ( item . difficulty ) } `}
185155 >
186- { getLevelText ( item . difficulty ) }
156+ { LevelUtil . getLevelText ( item . difficulty ) }
187157 </ span >
188158 </ td >
189159 < td className = "px-6 py-4 text-center text-sm text-gray-300 " >
0 commit comments