11import { useEffect , useState } from "react" ;
22import { scoreApi } from "@/api/scores" ;
3- import type { LanguageTestScore , VerifyStatus } from "@/types/scores" ;
3+ import type { LanguageScoreWithUser , VerifyStatus } from "@/types/scores" ;
44import { ScoreVerifyButton } from "../ScoreVerifyButton" ;
5+ import { format } from "date-fns" ;
56
67interface Props {
78 verifyFilter : VerifyStatus ;
89}
910
11+ const S3_BASE_URL = import . meta. env . VITE_S3_BASE_URL ;
12+
1013export function LanguageScoreTable ( { verifyFilter } : Props ) {
11- const [ scores , setScores ] = useState < LanguageTestScore [ ] > ( [ ] ) ;
14+ const [ scores , setScores ] = useState < LanguageScoreWithUser [ ] > ( [ ] ) ;
1215 const [ page ] = useState ( 1 ) ;
1316 const [ loading , setLoading ] = useState ( false ) ;
1417
@@ -21,7 +24,7 @@ export function LanguageScoreTable({ verifyFilter }: Props) {
2124 ) ;
2225 setScores ( response . content ) ;
2326 } catch ( error ) {
24- console . error ( "Failed to fetch Language Test scores:" , error ) ;
27+ console . error ( "Failed to fetch Language scores:" , error ) ;
2528 } finally {
2629 setLoading ( false ) ;
2730 }
@@ -41,9 +44,9 @@ export function LanguageScoreTable({ verifyFilter }: Props) {
4144 verifyStatus : status ,
4245 rejectedReason : reason ,
4346 } ) ;
44- fetchScores ( ) ; // 데이터 새로고침
47+ fetchScores ( ) ;
4548 } catch ( error ) {
46- console . error ( "Failed to update Language Test score:" , error ) ;
49+ console . error ( "Failed to update Language score:" , error ) ;
4750 }
4851 } ;
4952
@@ -58,43 +61,92 @@ export function LanguageScoreTable({ verifyFilter }: Props) {
5861 ID
5962 </ th >
6063 < th className = "px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500" >
61- 시험 종류
64+ 닉네임
65+ </ th >
66+ < th className = "px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500" >
67+ 시험종류
6268 </ th >
6369 < th className = "px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500" >
6470 점수
6571 </ th >
6672 < th className = "px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500" >
6773 상태
6874 </ th >
75+ < th className = "px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500" >
76+ 제출일
77+ </ th >
6978 < th className = "px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500" >
7079 거절사유
7180 </ th >
81+ < th className = "px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500" >
82+ 인증파일
83+ </ th >
7284 < th className = "px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500" >
7385 작업
7486 </ th >
7587 </ tr >
7688 </ thead >
7789 < tbody className = "divide-y divide-gray-200 bg-white" >
7890 { scores . map ( ( score ) => (
79- < tr key = { score . id } >
80- < td className = "whitespace-nowrap px-6 py-4" > { score . id } </ td >
91+ < tr key = { score . languageTestScoreStatusResponse . id } >
92+ < td className = "whitespace-nowrap px-6 py-4" >
93+ { score . languageTestScoreStatusResponse . id }
94+ </ td >
95+ < td className = "whitespace-nowrap px-6 py-4" >
96+ < div className = "flex items-center" >
97+ < img
98+ src = { score . siteUserResponse . profileImageUrl }
99+ alt = "프로필"
100+ className = "mr-2 h-8 w-8 rounded-full"
101+ />
102+ { score . siteUserResponse . nickname }
103+ </ div >
104+ </ td >
105+ < td className = "whitespace-nowrap px-6 py-4" >
106+ {
107+ score . languageTestScoreStatusResponse . languageTestResponse
108+ . languageTestType
109+ }
110+ </ td >
111+ < td className = "whitespace-nowrap px-6 py-4" >
112+ {
113+ score . languageTestScoreStatusResponse . languageTestResponse
114+ . languageTestScore
115+ }
116+ </ td >
81117 < td className = "whitespace-nowrap px-6 py-4" >
82- { score . languageTestType }
118+ { score . languageTestScoreStatusResponse . verifyStatus }
83119 </ td >
84120 < td className = "whitespace-nowrap px-6 py-4" >
85- { score . languageTestScore }
121+ { format (
122+ new Date ( score . languageTestScoreStatusResponse . createdAt ) ,
123+ "yyyy-MM-dd HH:mm" ,
124+ ) }
86125 </ td >
87126 < td className = "whitespace-nowrap px-6 py-4" >
88- { score . verifyStatus }
127+ { score . languageTestScoreStatusResponse . rejectedReason || "-" }
89128 </ td >
90129 < td className = "whitespace-nowrap px-6 py-4" >
91- { score . rejectedReason || "-" }
130+ < a
131+ href = { `${ S3_BASE_URL } ${ score . languageTestScoreStatusResponse . languageTestResponse . languageTestReportUrl } ` }
132+ target = "_blank"
133+ rel = "noopener noreferrer"
134+ className = "text-blue-600 hover:text-blue-800 hover:underline"
135+ >
136+ 파일 보기
137+ </ a >
92138 </ td >
93139 < td className = "whitespace-nowrap px-6 py-4" >
94140 < ScoreVerifyButton
95- currentStatus = { score . verifyStatus }
141+ currentStatus = {
142+ score . languageTestScoreStatusResponse . verifyStatus
143+ }
96144 onVerifyChange = { ( status , reason ) =>
97- handleVerifyStatus ( score . id , status , reason )
145+ handleVerifyStatus (
146+ score . languageTestScoreStatusResponse . id ,
147+ status ,
148+ reason ,
149+ )
98150 }
99151 />
100152 </ td >
0 commit comments