@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
4
4
import { twMerge } from "tailwind-merge" ;
5
5
6
6
import api , { Application } from "../api" ;
7
- import { formatPhoneNumber } from "../helpers/application" ;
7
+ import { formatApplicantYear , formatPhoneNumber } from "../helpers/application" ;
8
8
import { formatFieldNameHumanReadable } from "../helpers/review" ;
9
9
import { useAlerts } from "../hooks/alerts" ;
10
10
import { formatQuarter } from "../util" ;
@@ -13,7 +13,7 @@ function PromptDropdown({ title, content }: { title: string; content: string | u
13
13
const [ isOpen , setIsOpen ] = useState ( true ) ;
14
14
15
15
return (
16
- < div className = "tw:rounded-lg tw:overflow-hidden" >
16
+ < div className = "tw:rounded-lg tw:overflow-hidden tw:border tw:border-teal-primary " >
17
17
< button
18
18
type = "button"
19
19
onClick = { ( ) => setIsOpen ( ! isOpen ) }
@@ -25,7 +25,7 @@ function PromptDropdown({ title, content }: { title: string; content: string | u
25
25
/>
26
26
</ button >
27
27
{ isOpen && (
28
- < div className = "tw:p-4 tw:border tw:border-teal-primary tw:border-t-0 tw:rounded-b-lg" >
28
+ < div className = "tw:p-4 tw:border-t tw:border-teal-primary tw:rounded-b-lg" >
29
29
< div className = "tw:whitespace-pre-line" > { content || "No response provided" } </ div >
30
30
</ div >
31
31
) }
@@ -38,6 +38,12 @@ interface ApplicationHeaderProps {
38
38
reassignReview ?: ( ) => void ;
39
39
}
40
40
41
+ const field = ( name : string , value : string ) => (
42
+ < p className = "tw:!m-0" >
43
+ < b > { name } </ b > : { value }
44
+ </ p >
45
+ ) ;
46
+
41
47
/* Displays information about the applicant, including a Reassign button if being used in the Review page */
42
48
export default function ApplicationHeader ( {
43
49
applicationId,
@@ -60,7 +66,11 @@ export default function ApplicationHeader({
60
66
"About Me" : application ?. aboutPrompt ,
61
67
"Why TSE" : application ?. interestPrompt ,
62
68
"TEST Barriers" : application ?. testBarriersPrompt ,
63
- ...application ?. rolePrompts ,
69
+ // Format role prompts as "Why [role]"
70
+ ...Object . entries ( application ?. rolePrompts || { } ) . reduce ( ( acc , [ key , value ] ) => {
71
+ acc [ `Why ${ formatFieldNameHumanReadable ( key ) } ` ] = value ;
72
+ return acc ;
73
+ } , { } as Record < string , string | undefined > ) ,
64
74
} ;
65
75
66
76
return (
@@ -77,19 +87,20 @@ export default function ApplicationHeader({
77
87
</ Button >
78
88
) }
79
89
</ div >
80
- < div className = "tw:grid tw:grid-rows-4 tw:grid-flow-col tw:w-fit tw:gap-x-30 tw:gap-y-2 tw:!text-lg" >
81
- < p className = "tw:!m-0" > ID: { application ?. _id } </ p >
82
- < p className = "tw:!m-0" >
83
- Major: { application ?. major } ({ application ?. majorDept } )
84
- </ p >
85
- < p className = "tw:!m-0" > Start Date: { formatQuarter ( application ?. startQuarter || 0 ) } </ p >
86
- < p className = "tw:!m-0" > Grad Date: { formatQuarter ( application ?. gradQuarter || 0 ) } </ p >
87
- < p className = "tw:!m-0" > Phone: { formatPhoneNumber ( application ?. phone || "" ) } </ p >
88
- < p className = "tw:!m-0" > Email: { application ?. email } </ p >
89
- < p className = "tw:!m-0" >
90
- Previously in TEST:{ " " }
91
- { application ?. prevTest ? formatFieldNameHumanReadable ( application ?. prevTest ) : "No" }
92
- </ p >
90
+ < div className = "tw:grid tw:grid-rows-5 tw:grid-flow-col tw:w-fit tw:gap-x-30 tw:gap-y-2 tw:!text-lg" >
91
+ { field ( "ID" , application ?. _id || "" ) }
92
+ { field ( "Major" , `${ application ?. major } (${ application ?. majorDept } )` ) }
93
+ { field ( "Year" , formatApplicantYear ( application ?. applicantYear || 0 ) ) }
94
+ { field ( "Start Date" , formatQuarter ( application ?. startQuarter || 0 ) ) }
95
+ { field ( "Grad Date" , formatQuarter ( application ?. gradQuarter || 0 ) ) }
96
+ { field ( "Phone" , formatPhoneNumber ( application ?. phone || "" ) ) }
97
+ { field ( "Email" , application ?. email || "" ) }
98
+ { field (
99
+ "Previously in TEST" ,
100
+ application ?. prevTest && application ?. prevTest !== "none"
101
+ ? formatFieldNameHumanReadable ( application ?. prevTest )
102
+ : "No"
103
+ ) }
93
104
< a href = { application ?. resumeUrl } target = "_blank" rel = "noreferrer noopener" >
94
105
Resume
95
106
</ a >
@@ -105,13 +116,7 @@ export default function ApplicationHeader({
105
116
return null ;
106
117
}
107
118
108
- return (
109
- < PromptDropdown
110
- key = { key }
111
- title = { formatFieldNameHumanReadable ( key ) }
112
- content = { response }
113
- />
114
- ) ;
119
+ return < PromptDropdown key = { key } title = { key } content = { response } /> ;
115
120
} ) }
116
121
</ div >
117
122
{ alerts }
0 commit comments