Skip to content
This repository was archived by the owner on Dec 25, 2022. It is now read-only.

Commit 9c1830d

Browse files
committed
Update
1 parent 4bdc2ee commit 9c1830d

File tree

1 file changed

+42
-5
lines changed

1 file changed

+42
-5
lines changed

src/components/DetailCourse/DetailCourse.js

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
FcFullTrash,
2424
FcExport,
2525
} from 'react-icons/fc';
26+
import { FcApproval, FcCancel } from 'react-icons/fc';
2627

2728
function toLowerCaseNonAccentVietnamese(str) {
2829
str = str.toLowerCase();
@@ -48,6 +49,8 @@ const DetailCourse = () => {
4849
const [selectQuestion, setSelectQuestion] = useState(undefined);
4950
const [showModalExport, setShowModalExport] = useState(false);
5051
const [contentExport, setContentExport] = useState('');
52+
const [isConnecting, setIsConnecting] = useState(true);
53+
const [isFailedConnect, setIsFailedConnect] = useState(false);
5154

5255
const { id } = useParams();
5356
const navigate = useNavigate();
@@ -63,6 +66,17 @@ const DetailCourse = () => {
6366
setInfoCourse(JSON.parse(course1));
6467
setCourse(JSON.parse(course1).data);
6568
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+
});
6680
}, []);
6781

6882
useEffect(() => {
@@ -122,6 +136,25 @@ const DetailCourse = () => {
122136

123137
return (
124138
<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>
125158
<Modal
126159
closeButton
127160
blur
@@ -130,13 +163,17 @@ const DetailCourse = () => {
130163
onClose={() => {
131164
setShowModalExport(false);
132165
}}
133-
width={'40%'}
166+
width={'40%'}
134167
>
135168
<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>
140177
</Modal.Body>
141178
</Modal>
142179
<Modal

0 commit comments

Comments
 (0)