@@ -123,6 +123,20 @@ const ConfigureGroupCountsDialog = ({
123123 } ) ;
124124 } ;
125125
126+ const handleSpreadGroupsChange = ( e : React . ChangeEvent < HTMLInputElement > ) =>
127+ setGroupsData ( {
128+ ...groupsData ,
129+ spreadGroupsAcrossAllStages : e . target . checked ,
130+ groups : e . target . checked
131+ ? 1
132+ : {
133+ ...( rooms ?. reduce ( ( acc , room ) => {
134+ acc [ room . id ] = 1 ;
135+ return acc ;
136+ } , { } as Record < number , number > ) || { } ) ,
137+ } ,
138+ } ) ;
139+
126140 const roundSize = actualCompetitors . length ;
127141 const activityMinutes = roundActivities [ 0 ] ? activityDuration ( roundActivities [ 0 ] ) / 60000 : 0 ;
128142
@@ -147,20 +161,7 @@ const ConfigureGroupCountsDialog = ({
147161 control = {
148162 < Checkbox
149163 checked = { spreadGroupsAcrossAllStages }
150- onChange = { ( e ) =>
151- setGroupsData ( {
152- ...groupsData ,
153- spreadGroupsAcrossAllStages : e . target . checked ,
154- groups : e . target . checked
155- ? 1
156- : {
157- ...( rooms ?. reduce ( ( acc , room ) => {
158- acc [ room . id ] = 1 ;
159- return acc ;
160- } , { } as Record < number , number > ) || { } ) ,
161- } ,
162- } )
163- }
164+ onChange = { handleSpreadGroupsChange }
164165 />
165166 }
166167 label = "Spread Groups Across All Stages"
@@ -181,19 +182,32 @@ const ConfigureGroupCountsDialog = ({
181182 These groups will be spread across all stages.
182183 </ FormHelperText >
183184 </ FormControl >
184- < Typography >
185- There will be max group sizes of { Math . ceil ( roundSize / ( groupCountNumber || 1 ) ) }
186- { multipleStages && (
187- < >
188- ({ Math . ceil ( roundSize / roundActivities . length / ( groupCountNumber || 1 ) ) } per
189- stage)
190- </ >
191- ) }
192- </ Typography >
193- < Typography >
194- There will be an average group duration of{ ' ' }
195- { Math . round ( activityMinutes / ( groupCountNumber || 1 ) ) } Minutes
196- </ Typography >
185+ < Box sx = { { mt : 2 } } >
186+ < table style = { { width : '100%' , borderCollapse : 'collapse' } } >
187+ < tbody >
188+ < tr >
189+ < td style = { { fontWeight : 500 } } > Max group size:</ td >
190+ < td >
191+ { Math . ceil ( roundSize / ( groupCountNumber || 1 ) ) }
192+ { multipleStages && (
193+ < >
194+ { ' ' }
195+ (
196+ { Math . ceil (
197+ roundSize / roundActivities . length / ( groupCountNumber || 1 )
198+ ) } { ' ' }
199+ per stage)
200+ </ >
201+ ) }
202+ </ td >
203+ </ tr >
204+ < tr >
205+ < td style = { { fontWeight : 500 } } > Average group duration:</ td >
206+ < td > { Math . round ( activityMinutes / ( groupCountNumber || 1 ) ) } minutes</ td >
207+ </ tr >
208+ </ tbody >
209+ </ table >
210+ </ Box >
197211 </ >
198212 ) }
199213 { ! spreadGroupsAcrossAllStages && (
@@ -244,21 +258,37 @@ const ConfigureGroupCountsDialog = ({
244258 ) ;
245259 } ) }
246260 </ Stack >
247- < Typography > With a combined total of { cumulativeGroupCount } groups:</ Typography >
248- < Typography >
249- There will be max group sizes of{ ' ' }
250- { Math . ceil ( roundSize / ( cumulativeGroupCount || 1 ) ) } (
251- { multipleStages && (
252- < >
253- { Math . ceil ( roundSize / roundActivities . length / ( cumulativeGroupCount || 1 ) ) } { ' ' }
254- per stage)
255- </ >
256- ) }
257- </ Typography >
258- < Typography >
259- There will be an average group duration of{ ' ' }
260- { Math . round ( activityMinutes / ( cumulativeGroupCount || 1 ) ) } Minutes
261- </ Typography >
261+ < Box sx = { { mt : 2 } } >
262+ < Typography variant = "subtitle2" sx = { { mb : 1 } } >
263+ Combined total of { cumulativeGroupCount } groups:
264+ </ Typography >
265+ < table style = { { width : '100%' , borderCollapse : 'collapse' } } >
266+ < tbody >
267+ < tr >
268+ < td style = { { padding : '8px' , fontWeight : 500 } } > Max group size:</ td >
269+ < td style = { { padding : '8px' } } >
270+ { Math . ceil ( roundSize / ( cumulativeGroupCount || 1 ) ) }
271+ { multipleStages && (
272+ < >
273+ { ' ' }
274+ (
275+ { Math . ceil (
276+ roundSize / roundActivities . length / ( cumulativeGroupCount || 1 )
277+ ) } { ' ' }
278+ per stage)
279+ </ >
280+ ) }
281+ </ td >
282+ </ tr >
283+ < tr >
284+ < td style = { { padding : '8px' , fontWeight : 500 } } > Average group duration:</ td >
285+ < td style = { { padding : '8px' } } >
286+ { Math . round ( activityMinutes / ( cumulativeGroupCount || 1 ) ) } minutes
287+ </ td >
288+ </ tr >
289+ </ tbody >
290+ </ table >
291+ </ Box >
262292 </ >
263293 ) }
264294 </ FormGroup >
0 commit comments