@@ -14,7 +14,7 @@ const Expo = () => {
1414 const [ nameSort , setNameSort ] = useState ( false ) ;
1515 const [ track , setTrack ] = useState ( '' ) ;
1616 const [ challenges , setChallenges ] = useState < string [ ] > ( [ ] ) ;
17- const [ groupNames , setGroupNames ] = useState < string [ ] > ( [ ] ) ;
17+ const [ groupInfo , setGroupInfo ] = useState < GroupInfo > ( { enabled : false , names : [ ] } ) ;
1818 const [ searchParams , _ ] = useSearchParams ( ) ;
1919 const navigate = useNavigate ( ) ;
2020
@@ -36,12 +36,13 @@ const Expo = () => {
3636 return ;
3737 }
3838
39- const groupRes = await getRequest < string [ ] > ( '/group-names ' , '' ) ;
39+ const groupRes = await getRequest < GroupInfo > ( '/group-info ' , '' ) ;
4040 if ( groupRes . status !== 200 ) {
4141 errorAlert ( groupRes ) ;
4242 return ;
4343 }
44- setGroupNames ( groupRes . data as string [ ] ) ;
44+ const gi = groupRes . data as GroupInfo ;
45+ setGroupInfo ( { enabled : gi . enabled && gi . names . length > 0 , names : gi . names } ) ;
4546
4647 setChallenges ( [ '' , ...( res . data as string [ ] ) ] ) ;
4748 }
@@ -86,15 +87,17 @@ const Expo = () => {
8687 < table className = "table-fixed" >
8788 < thead className = "text-left" >
8889 < tr >
89- < th className = "pr-2" > Group</ th >
90+ { groupInfo . enabled && < th className = "pr-2" > Group</ th > }
9091 < th className = "pr-2" > Table</ th >
9192 < th className = "pr-2" > Name</ th >
9293 </ tr >
9394 </ thead >
9495 < tbody >
9596 { projects . map ( ( project , idx ) => (
9697 < tr key = { idx } >
97- < td className = "pr-2" > { groupNames [ project . group ] } </ td >
98+ { groupInfo . enabled && (
99+ < td className = "pr-2" > { groupInfo . names [ project . group ] } </ td >
100+ ) }
98101 < td className = "pr-2" > { project . location } </ td >
99102 < td className = "pr-2" > { project . name } </ td >
100103 </ tr >
@@ -128,7 +131,7 @@ const Expo = () => {
128131 navigate ( '/expo/' + t . replace ( / \s / g, '%20' ) ) ;
129132 } }
130133 options = { challenges ?? [ ] }
131- className = "my-2"
134+ className = "my-2 md:mx-0 mx-4 "
132135 />
133136 < h3 className = "text-center font-bold text-lighter text-2xl" >
134137 Count: { projects . length }
@@ -142,8 +145,8 @@ const Expo = () => {
142145 Print this page
143146 </ Button >
144147 </ div >
145- < table className = "mb-4" >
146- < thead >
148+ < table className = "mb-4 table-fixed w-full " >
149+ < thead className = "w-full" >
147150 < tr >
148151 < th
149152 onClick = { ( ) => setNameSort ( true ) }
@@ -157,12 +160,13 @@ const Expo = () => {
157160 < th
158161 onClick = { ( ) => setNameSort ( false ) }
159162 className = {
160- 'px-4 py-2 cursor-pointer text-left ' +
163+ 'px-4 py-2 cursor-pointer text-left w-12 ' +
161164 ( ! nameSort && 'underline' )
162165 }
163166 >
164167 Table
165168 </ th >
169+ { groupInfo . enabled && < th className = "px-4 py-2 text-left w-32" > Group</ th > }
166170 </ tr >
167171 </ thead >
168172 < tbody >
@@ -179,6 +183,9 @@ const Expo = () => {
179183 </ a >
180184 </ td >
181185 < td className = "px-4 py-2" > { project . location } </ td >
186+ { groupInfo . enabled && (
187+ < td className = "px-4 py-2" > { groupInfo . names [ project . group ] } </ td >
188+ ) }
182189 </ tr >
183190 ) ) }
184191 </ tbody >
0 commit comments