1- import React from "react" ;
1+ import React , { useEffect , useState } from "react" ;
22import { getSubCategoryLabel } from "../../../utils/categoryUtils" ;
33
44interface CorrectRateData {
@@ -16,6 +16,14 @@ const CorrectRateTab: React.FC<CorrectRateTabProps> = ({
1616 correctRateData,
1717 correctRateLoading,
1818} ) => {
19+ const [ isVisible , setIsVisible ] = useState ( false ) ;
20+
21+ useEffect ( ( ) => {
22+ if ( correctRateData ) {
23+ const timer = setTimeout ( ( ) => setIsVisible ( true ) , 400 ) ;
24+ return ( ) => clearTimeout ( timer ) ;
25+ }
26+ } , [ correctRateData ] ) ;
1927 if ( correctRateLoading ) {
2028 return (
2129 < div className = "py-8 text-center" >
@@ -45,8 +53,9 @@ const CorrectRateTab: React.FC<CorrectRateTabProps> = ({
4553 nonZeroRates . length
4654 : 0 ;
4755
56+ // 0.0인 값들을 제외하고 개선 필요 카테고리 계산 (40% 미만)
4857 const needImprovementCategories = rates . filter (
49- ( rate ) => Number ( rate ) < 60 ,
58+ ( rate ) => Number ( rate ) > 0 && Number ( rate ) < 40 ,
5059 ) . length ;
5160
5261 return (
@@ -208,12 +217,11 @@ const CorrectRateTab: React.FC<CorrectRateTabProps> = ({
208217
209218 { /* 메인 바 */ }
210219 < div
211- className = "relative h-full overflow-hidden rounded-full bg-gradient-to-r from-blue-400 to-blue-600 transition-all duration-1000 ease-out"
220+ className = "relative h-full overflow-hidden rounded-full bg-gradient-to-r from-blue-400 to-blue-600 transition-all duration-[2500ms] ease-out"
212221 style = { {
213- width : `${ Math . max ( rateNum , 3 ) } %` ,
222+ width : isVisible ? `${ Math . max ( rateNum , 3 ) } %` : "0%" ,
214223 opacity : opacity ,
215- animationDelay : `${ delay } ms` ,
216- animation : `slideInX 1.2s ease-out ${ delay } ms forwards` ,
224+ transitionDelay : `${ delay } ms` ,
217225 transformOrigin : "left center" ,
218226 } }
219227 >
@@ -303,7 +311,7 @@ const CorrectRateTab: React.FC<CorrectRateTabProps> = ({
303311 { needImprovementCategories }
304312 </ div >
305313 < div className = "text-sm font-medium text-red-800" > 개선 필요</ div >
306- < div className = "mt-1 text-xs text-red-600" > (60 % 미만)</ div >
314+ < div className = "mt-1 text-xs text-red-600" > (40 % 미만)</ div >
307315 </ div >
308316 </ div >
309317 </ div >
0 commit comments