File tree Expand file tree Collapse file tree 1 file changed +11
-18
lines changed
frontend/components/Course/InstructorQueuePage Expand file tree Collapse file tree 1 file changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -172,12 +172,14 @@ const QueueFormFields = ({
172172 }
173173 setInput ( { ...input } ) ;
174174 } ;
175-
176- const handlePinInputChange = ( e , { checked } ) => {
177- input . pinEnabled = checked ;
178- setInput ( { ...input } ) ;
179- } ;
180175 /* PROPS UPDATE */
176+ // Helper function to handle toggle changes
177+ const handleToggleChange = ( name : string ) => {
178+ setInput ( {
179+ ...input ,
180+ [ name ] : ! input [ name ] ,
181+ } ) ;
182+ } ;
181183
182184 return (
183185 < >
@@ -246,7 +248,7 @@ const QueueFormFields = ({
246248 id = "pin-toggle"
247249 toggle
248250 disabled = { loading }
249- onChange = { handlePinInputChange }
251+ onClick = { ( ) => handleToggleChange ( "pinEnabled" ) }
250252 />
251253 </ Form . Field >
252254
@@ -261,14 +263,9 @@ const QueueFormFields = ({
261263 name = "rateLimitEnabled"
262264 id = "rate-limit-toggle"
263265 toggle
264- defaultChecked = { input . rateLimitEnabled }
266+ checked = { input . rateLimitEnabled }
265267 label = "Enable queue rate-limiting"
266- onChange = { ( ) =>
267- setInput ( {
268- ...input ,
269- rateLimitEnabled : ! input . rateLimitEnabled ,
270- } )
271- }
268+ onClick = { ( ) => handleToggleChange ( "rateLimitEnabled" ) }
272269 />
273270
274271 { input . rateLimitEnabled && (
@@ -382,11 +379,7 @@ const QueueFormFields = ({
382379 toggle
383380 label = "Enable a countdown for questions"
384381 onChange = { ( ) =>
385- setInput ( {
386- ...input ,
387- questionTimerEnabled :
388- ! input . questionTimerEnabled ,
389- } )
382+ handleToggleChange ( "questionTimerEnabled" )
390383 }
391384 />
392385 </ Form . Field >
You can’t perform that action at this time.
0 commit comments