11import { useState } from 'react' ;
22import { Flex , Text } from '@entry/design-token' ;
33import { Button } from '@entry/ui' ;
4- import { ScoreThird , ScoreSecond , ScoreFirst , Activity } from './' ;
4+ import { ScoreThird , ScoreSecond , Activity } from './' ;
55import { useCalculationData } from '../../contexts/CalculationDataContext' ;
66import { calculateScore } from '../../apis/calculator' ;
77import { transformCalculationDataToAPI } from '../../utils/apiDataTransformer' ;
88import { CalculatorScoreResponse } from '../../apis/calculator/types' ;
9- import { ADMISSION_TYPE_LABEL , ADMISSION_TYPE_MAX_SCORE , AdmissionType } from '../../constants/admissionType' ;
9+ import {
10+ ADMISSION_TYPE_LABEL ,
11+ ADMISSION_TYPE_MAX_SCORE ,
12+ AdmissionType ,
13+ } from '../../constants/admissionType' ;
1014
1115const STEPS = [
1216 { key : 'third2' , label : '3학년 2학기' } ,
1317 { key : 'third1' , label : '3학년 1학기' } ,
1418 { key : 'second2' , label : '2학년 2학기' } ,
1519 { key : 'second1' , label : '2학년 1학기' } ,
16- { key : 'activity' , label : '출석 및 봉사' }
20+ { key : 'activity' , label : '출석 및 봉사' } ,
1721] ;
1822
1923export const GraduatedCalculationPage = ( ) => {
2024 const [ currentStep , setCurrentStep ] = useState ( 0 ) ;
2125 const [ showResultModal , setShowResultModal ] = useState ( false ) ;
22- const [ results , setResults ] = useState < { name : string ; type : AdmissionType ; data : CalculatorScoreResponse [ 'data' ] } [ ] > ( [ ] ) ;
26+ const [ results , setResults ] = useState <
27+ {
28+ name : string ;
29+ type : AdmissionType ;
30+ data : CalculatorScoreResponse [ 'data' ] ;
31+ } [ ]
32+ > ( [ ] ) ;
2333 const [ isLoading , setIsLoading ] = useState ( false ) ;
2434 const [ error , setError ] = useState < string | null > ( null ) ;
2535 const { state } = useCalculationData ( ) ;
@@ -45,16 +55,29 @@ export const GraduatedCalculationPage = () => {
4555 const socialRequest = transformCalculationDataToAPI ( state , 'SOCIAL' ) ;
4656 const meisterRequest = transformCalculationDataToAPI ( state , 'MEISTER' ) ;
4757
48- const [ commonResponse , socialResponse , meisterResponse ] = await Promise . all ( [
49- calculateScore ( commonRequest ) ,
50- calculateScore ( socialRequest ) ,
51- calculateScore ( meisterRequest ) ,
52- ] ) ;
58+ const [ commonResponse , socialResponse , meisterResponse ] =
59+ await Promise . all ( [
60+ calculateScore ( commonRequest ) ,
61+ calculateScore ( socialRequest ) ,
62+ calculateScore ( meisterRequest ) ,
63+ ] ) ;
5364
5465 setResults ( [
55- { name : ADMISSION_TYPE_LABEL . COMMON , type : 'COMMON' , data : commonResponse . data } ,
56- { name : ADMISSION_TYPE_LABEL . SOCIAL , type : 'SOCIAL' , data : socialResponse . data } ,
57- { name : ADMISSION_TYPE_LABEL . MEISTER , type : 'MEISTER' , data : meisterResponse . data } ,
66+ {
67+ name : ADMISSION_TYPE_LABEL . COMMON ,
68+ type : 'COMMON' ,
69+ data : commonResponse . data ,
70+ } ,
71+ {
72+ name : ADMISSION_TYPE_LABEL . SOCIAL ,
73+ type : 'SOCIAL' ,
74+ data : socialResponse . data ,
75+ } ,
76+ {
77+ name : ADMISSION_TYPE_LABEL . MEISTER ,
78+ type : 'MEISTER' ,
79+ data : meisterResponse . data ,
80+ } ,
5881 ] ) ;
5982 setShowResultModal ( true ) ;
6083 } catch ( err : any ) {
@@ -98,15 +121,28 @@ export const GraduatedCalculationPage = () => {
98121 width = "32px"
99122 height = "32px"
100123 borderRadius = "50%"
101- backgroundColor = { index === currentStep ? "#FF6B35" : index < currentStep ? "#FF6B35" : "#E5E5E5" }
124+ backgroundColor = {
125+ index === currentStep
126+ ? '#FF6B35'
127+ : index < currentStep
128+ ? '#FF6B35'
129+ : '#E5E5E5'
130+ }
102131 justifyContent = "center"
103132 alignItems = "center"
104133 >
105- < Text fontSize = { 14 } fontWeight = { 600 } color = { index <= currentStep ? "#FFFFFF" : "#999" } >
134+ < Text
135+ fontSize = { 14 }
136+ fontWeight = { 600 }
137+ color = { index <= currentStep ? '#FFFFFF' : '#999' }
138+ >
106139 { index + 1 }
107140 </ Text >
108141 </ Flex >
109- < Text fontSize = { 14 } fontWeight = { index === currentStep ? 600 : 400 } >
142+ < Text
143+ fontSize = { 14 }
144+ fontWeight = { index === currentStep ? 600 : 400 }
145+ >
110146 { step . label }
111147 </ Text >
112148 { index < STEPS . length - 1 && (
@@ -117,7 +153,7 @@ export const GraduatedCalculationPage = () => {
117153 </ Flex >
118154 </ Flex >
119155
120- < Flex flex = { 1 } paddingY = "40px" width = "100%" >
156+ < Flex flex = { '1' } paddingTop = "40px" width = "100%" >
121157 { renderStepContent ( ) }
122158 </ Flex >
123159
@@ -131,15 +167,13 @@ export const GraduatedCalculationPage = () => {
131167 >
132168 이전
133169 </ Button >
134-
170+
135171 { currentStep === STEPS . length - 1 ? (
136172 < Button onClick = { handleComplete } isBlocked = { isLoading } >
137173 { isLoading ? '계산 중...' : '완료' }
138174 </ Button >
139175 ) : (
140- < Button onClick = { handleNext } >
141- 다음
142- </ Button >
176+ < Button onClick = { handleNext } > 다음</ Button >
143177 ) }
144178 </ Flex >
145179
@@ -178,18 +212,17 @@ export const GraduatedCalculationPage = () => {
178212 < Flex key = { index } justifyContent = "space-between" >
179213 < Text > { result . name } </ Text >
180214 < Text color = "#FF6B35" fontWeight = { 600 } >
181- { result . data . totalScore . toFixed ( 3 ) } / { ADMISSION_TYPE_MAX_SCORE [ result . type ] }
215+ { result . data . totalScore . toFixed ( 3 ) } /{ ' ' }
216+ { ADMISSION_TYPE_MAX_SCORE [ result . type ] }
182217 </ Text >
183218 </ Flex >
184219 ) ) }
185220 </ Flex >
186221
187- < Button onClick = { ( ) => setShowResultModal ( false ) } >
188- 닫기
189- </ Button >
222+ < Button onClick = { ( ) => setShowResultModal ( false ) } > 닫기</ Button >
190223 </ Flex >
191224 </ Flex >
192225 ) }
193226 </ Flex >
194227 ) ;
195- } ;
228+ } ;
0 commit comments