File tree 1 file changed +11
-18
lines changed
frontend/components/Course/InstructorQueuePage
1 file changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -172,12 +172,14 @@ const QueueFormFields = ({
172
172
}
173
173
setInput ( { ...input } ) ;
174
174
} ;
175
-
176
- const handlePinInputChange = ( e , { checked } ) => {
177
- input . pinEnabled = checked ;
178
- setInput ( { ...input } ) ;
179
- } ;
180
175
/* PROPS UPDATE */
176
+ // Helper function to handle toggle changes
177
+ const handleToggleChange = ( name : string ) => {
178
+ setInput ( {
179
+ ...input ,
180
+ [ name ] : ! input [ name ] ,
181
+ } ) ;
182
+ } ;
181
183
182
184
return (
183
185
< >
@@ -246,7 +248,7 @@ const QueueFormFields = ({
246
248
id = "pin-toggle"
247
249
toggle
248
250
disabled = { loading }
249
- onChange = { handlePinInputChange }
251
+ onClick = { ( ) => handleToggleChange ( "pinEnabled" ) }
250
252
/>
251
253
</ Form . Field >
252
254
@@ -261,14 +263,9 @@ const QueueFormFields = ({
261
263
name = "rateLimitEnabled"
262
264
id = "rate-limit-toggle"
263
265
toggle
264
- defaultChecked = { input . rateLimitEnabled }
266
+ checked = { input . rateLimitEnabled }
265
267
label = "Enable queue rate-limiting"
266
- onChange = { ( ) =>
267
- setInput ( {
268
- ...input ,
269
- rateLimitEnabled : ! input . rateLimitEnabled ,
270
- } )
271
- }
268
+ onClick = { ( ) => handleToggleChange ( "rateLimitEnabled" ) }
272
269
/>
273
270
274
271
{ input . rateLimitEnabled && (
@@ -382,11 +379,7 @@ const QueueFormFields = ({
382
379
toggle
383
380
label = "Enable a countdown for questions"
384
381
onChange = { ( ) =>
385
- setInput ( {
386
- ...input ,
387
- questionTimerEnabled :
388
- ! input . questionTimerEnabled ,
389
- } )
382
+ handleToggleChange ( "questionTimerEnabled" )
390
383
}
391
384
/>
392
385
</ Form . Field >
You can’t perform that action at this time.
0 commit comments