File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
frontends/main/src/app-pages/DashboardPage/CoursewareDisplay Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change 7
7
Stack ,
8
8
Alert ,
9
9
Checkbox ,
10
+ CircularProgress ,
10
11
} from "ol-components"
11
12
import { Button } from "@mitodl/smoot-design"
12
13
@@ -18,6 +19,10 @@ const BoldText = styled.span(({ theme }) => ({
18
19
...theme . typography . subtitle1 ,
19
20
} ) )
20
21
22
+ const ButtonCircularProgress = styled ( CircularProgress ) ( {
23
+ marginLeft : "8px" ,
24
+ } )
25
+
21
26
type DashboardDialogProps = {
22
27
title : string
23
28
enrollmentId : number
@@ -94,7 +99,9 @@ const UnenrollDialogInner: React.FC<DashboardDialogProps> = ({
94
99
initialValues : { } ,
95
100
onSubmit : async ( ) => {
96
101
await destroyEnrollment . mutateAsync ( )
97
- modal . hide ( )
102
+ if ( ! destroyEnrollment . isError ) {
103
+ modal . hide ( )
104
+ }
98
105
} ,
99
106
} )
100
107
return (
@@ -114,15 +121,28 @@ const UnenrollDialogInner: React.FC<DashboardDialogProps> = ({
114
121
>
115
122
Cancel
116
123
</ Button >
117
- < Button variant = "primary" type = "submit" >
124
+ < Button
125
+ variant = "primary"
126
+ type = "submit"
127
+ disabled = { destroyEnrollment . isPending }
128
+ >
118
129
Unenroll
130
+ { destroyEnrollment . isPending ? (
131
+ < ButtonCircularProgress size = { 16 } />
132
+ ) : null }
119
133
</ Button >
120
134
</ DialogActions >
121
135
}
122
136
>
123
137
< Typography variant = "body1" >
124
138
Are you sure you want to unenroll from { title } ?
125
139
</ Typography >
140
+ { destroyEnrollment . isError && (
141
+ < Alert severity = "error" >
142
+ There was a problem unenrolling you from this course. Please try again
143
+ later.
144
+ </ Alert >
145
+ ) }
126
146
</ FormDialog >
127
147
)
128
148
}
You can’t perform that action at this time.
0 commit comments