@@ -23,6 +23,7 @@ import {
23
23
FcFullTrash ,
24
24
FcExport ,
25
25
} from 'react-icons/fc' ;
26
+ import { FcApproval , FcCancel } from 'react-icons/fc' ;
26
27
27
28
function toLowerCaseNonAccentVietnamese ( str ) {
28
29
str = str . toLowerCase ( ) ;
@@ -48,6 +49,8 @@ const DetailCourse = () => {
48
49
const [ selectQuestion , setSelectQuestion ] = useState ( undefined ) ;
49
50
const [ showModalExport , setShowModalExport ] = useState ( false ) ;
50
51
const [ contentExport , setContentExport ] = useState ( '' ) ;
52
+ const [ isConnecting , setIsConnecting ] = useState ( true ) ;
53
+ const [ isFailedConnect , setIsFailedConnect ] = useState ( false ) ;
51
54
52
55
const { id } = useParams ( ) ;
53
56
const navigate = useNavigate ( ) ;
@@ -63,6 +66,17 @@ const DetailCourse = () => {
63
66
setInfoCourse ( JSON . parse ( course1 ) ) ;
64
67
setCourse ( JSON . parse ( course1 ) . data ) ;
65
68
setCourseSearch ( JSON . parse ( course1 ) . data ) ;
69
+
70
+ fetch ( 'https://short-link-adonisgm.azurewebsites.net/api/quizlet/register' )
71
+ . then ( ( ) => {
72
+ setIsConnecting ( false ) ;
73
+ setIsFailedConnect ( false ) ;
74
+ } )
75
+ . catch ( ( err ) => {
76
+ console . log ( err ) ;
77
+ setIsConnecting ( false ) ;
78
+ setIsFailedConnect ( true ) ;
79
+ } ) ;
66
80
} , [ ] ) ;
67
81
68
82
useEffect ( ( ) => {
@@ -122,6 +136,25 @@ const DetailCourse = () => {
122
136
123
137
return (
124
138
< div >
139
+ < Card
140
+ css = { {
141
+ padding : '1rem' ,
142
+ display : 'flex' ,
143
+ flexDirection : 'column' ,
144
+ alignItems : 'center' ,
145
+ justifyContent : 'center' ,
146
+ width : '50px' ,
147
+ height : '50px' ,
148
+
149
+ position : 'fixed' ,
150
+ bottom : '1rem' ,
151
+ left : '1rem' ,
152
+ } }
153
+ >
154
+ { isConnecting && < Loading size = "xs" type = "gradient" /> }
155
+ { ! isConnecting && isFailedConnect && < FcCancel size = "2rem" /> }
156
+ { ! isConnecting && ! isFailedConnect && < FcApproval size = "2rem" /> }
157
+ </ Card >
125
158
< Modal
126
159
closeButton
127
160
blur
@@ -130,13 +163,17 @@ const DetailCourse = () => {
130
163
onClose = { ( ) => {
131
164
setShowModalExport ( false ) ;
132
165
} }
133
- width = { '40%' }
166
+ width = { '40%' }
134
167
>
135
168
< Modal . Body >
136
- < Textarea rows = { 30 } value = { contentExport } contentEditable = { false } />
137
- < Button onPress = { ( ) => {
138
- navigator . clipboard . writeText ( contentExport )
139
- } } > Copy to clipboard</ Button >
169
+ < Textarea rows = { 30 } value = { contentExport } contentEditable = { false } />
170
+ < Button
171
+ onPress = { ( ) => {
172
+ navigator . clipboard . writeText ( contentExport ) ;
173
+ } }
174
+ >
175
+ Copy to clipboard
176
+ </ Button >
140
177
</ Modal . Body >
141
178
</ Modal >
142
179
< Modal
0 commit comments