@@ -3,6 +3,7 @@ import { Controller } from 'react-hook-form';
33import { Button , Grid , RadioGroup , Typography } from '@mui/material' ;
44import { CourseInfo , TimeOffset , TimeZones } from 'types/course/admin/course' ;
55
6+ import CourseSuspendedAlert from 'course/courses/components/misc/CourseSuspendedAlert' ;
67import { getCourseLogoUrl } from 'course/helper' ;
78import AvatarSelector from 'lib/components/core/AvatarSelector' ;
89import RadioButton from 'lib/components/core/buttons/RadioButton' ;
@@ -332,65 +333,62 @@ const CourseSettingsForm = forwardRef<
332333 </ Section >
333334
334335 < Section sticksToNavbar title = { t ( translations . suspension ) } >
335- { props . data . canSuspendCourse && (
336- < >
337- < Typography variant = "body2" >
338- { t ( translations . suspendCourseDescription ) }
339- </ Typography >
340- { ! props . data . isSuspended && (
341- < Button
342- color = "warning"
343- disabled = { props . disabled }
344- onClick = { ( ) => setSuspendingCourse ( true ) }
345- variant = "outlined"
346- >
347- { t ( translations . suspendCourse ) }
348- </ Button >
349- ) }
350- < Prompt
351- onClickPrimary = { ( ) => {
352- props . onSuspendCourse ( ) ;
353- setSuspendingCourse ( false ) ;
354- } }
355- onClose = { closeSuspendingCoursePrompt }
356- open = { suspendingCourse }
357- primaryColor = "warning"
358- primaryLabel = { t ( translations . suspendCourse ) }
359- >
360- < PromptText >
361- { t ( translations . suspendCoursePromptText ) }
362- </ PromptText >
363- </ Prompt >
364- { props . data . isSuspended && (
365- < Button
366- color = "warning"
336+ < Typography variant = "body2" >
337+ { t ( translations . suspendCourseDescription ) }
338+ </ Typography >
339+ { props . data . isSuspended && (
340+ < CourseSuspendedAlert canSuspendCourse />
341+ ) }
342+ { ! props . data . isSuspended && (
343+ < Button
344+ color = "warning"
345+ disabled = { props . disabled }
346+ onClick = { ( ) => setSuspendingCourse ( true ) }
347+ variant = "outlined"
348+ >
349+ { t ( translations . suspendCourse ) }
350+ </ Button >
351+ ) }
352+ < Prompt
353+ onClickPrimary = { ( ) => {
354+ props . onSuspendCourse ( ) ;
355+ setSuspendingCourse ( false ) ;
356+ } }
357+ onClose = { closeSuspendingCoursePrompt }
358+ open = { suspendingCourse }
359+ primaryColor = "warning"
360+ primaryLabel = { t ( translations . suspendCourse ) }
361+ >
362+ < PromptText > { t ( translations . suspendCoursePromptText ) } </ PromptText >
363+ </ Prompt >
364+ { props . data . isSuspended && (
365+ < Button
366+ color = "warning"
367+ disabled = { props . disabled }
368+ onClick = { props . onUnsuspendCourse }
369+ variant = "outlined"
370+ >
371+ { t ( translations . unsuspendCourse ) }
372+ </ Button >
373+ ) }
374+ < Subsection
375+ subtitle = { t ( translations . courseSuspensionMessageDescription ) }
376+ title = { t ( translations . courseSuspensionMessage ) }
377+ >
378+ < Controller
379+ control = { control }
380+ name = "courseSuspensionMessage"
381+ render = { ( { field, fieldState } ) : JSX . Element => (
382+ < FormTextField
367383 disabled = { props . disabled }
368- onClick = { props . onUnsuspendCourse }
369- variant = "outlined"
370- >
371- { t ( translations . unsuspendCourse ) }
372- </ Button >
373- ) }
374- < Subsection
375- subtitle = { t ( translations . courseSuspensionMessageDescription ) }
376- title = { t ( translations . courseSuspensionMessage ) }
377- >
378- < Controller
379- control = { control }
380- name = "courseSuspensionMessage"
381- render = { ( { field, fieldState } ) : JSX . Element => (
382- < FormTextField
383- disabled = { props . disabled }
384- field = { field }
385- fieldState = { fieldState }
386- fullWidth
387- placeholder = { t ( courseTranslations . suspendedSubtitle ) }
388- />
389- ) }
384+ field = { field }
385+ fieldState = { fieldState }
386+ fullWidth
387+ placeholder = { t ( courseTranslations . suspendedSubtitle ) }
390388 />
391- </ Subsection >
392- < />
393- ) }
389+ ) }
390+ />
391+ </ Subsection >
394392 < Subsection
395393 subtitle = { t ( translations . userSuspensionMessageDescription ) }
396394 title = { t ( translations . userSuspensionMessage ) }
0 commit comments