Skip to content

Commit 7379e73

Browse files
authored
feat: replace progress bar with loading spinner (#1192)
1 parent 3d82d37 commit 7379e73

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

src/files-and-videos/videos-page/data/thunks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function cancelAllUploads(courseId, uploadData) {
5454
control.abort();
5555
});
5656
Object.entries(uploadData).forEach(([key, value]) => {
57-
if (value.status === RequestStatus.PENDING) {
57+
if (value.status === RequestStatus.IN_PROGRESS) {
5858
updateVideoUploadStatus(
5959
courseId,
6060
key,
@@ -324,7 +324,7 @@ export function addVideoFile(
324324

325325
if (uploadUrl && edxVideoId) {
326326
uploadingIdsRef.current.uploadData = newUploadData({
327-
status: RequestStatus.PENDING,
327+
status: RequestStatus.IN_PROGRESS,
328328
currentData: uploadingIdsRef.current.uploadData,
329329
originalValue: { name, progress },
330330
key: `video_${idx}`,

src/files-and-videos/videos-page/messages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const messages = defineMessages({
6868
},
6969
videoUploadTrackerAlertEditMessage: {
7070
id: 'course-authoring.files-and-videos.video-upload-tracker-alert.edit.message',
71-
defaultMessage: 'Want to coninue editing in Studio during this upload?',
71+
defaultMessage: 'Want to continue editing in Studio during this upload?',
7272
description: 'Continue editing message for the Upload Tracker Alert',
7373
},
7474
videoUploadTrackerAlertEditHyperlinkLabel: {

src/files-and-videos/videos-page/upload-modal/UploadProgressList.jsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { ProgressBar, Stack, Truncate } from '@openedx/paragon';
3+
import { Stack, Truncate } from '@openedx/paragon';
44
import UploadStatusIcon from './UploadStatusIcon';
55
import { RequestStatus } from '../../../data/constants';
66

7+
const getVideoStatus = (status) => {
8+
switch (status) {
9+
case RequestStatus.IN_PROGRESS:
10+
return 'UPLOADING';
11+
case RequestStatus.PENDING:
12+
return 'QUEUED';
13+
case RequestStatus.SUCCESSFUL:
14+
return '';
15+
default:
16+
return status.toUpperCase();
17+
}
18+
};
19+
720
const UploadProgressList = ({ videosList }) => (
821
<div role="list" className="text-primary-500">
922
{videosList.map(([id, video], index) => {
@@ -17,13 +30,9 @@ const UploadProgressList = ({ videosList }) => (
1730
</Truncate>
1831
</div>
1932
<div className="col-6 p-0">
20-
{video.status === RequestStatus.FAILED ? (
21-
<span className="row m-0 justify-content-end font-weight-bold">
22-
{video.status.toUpperCase()}
23-
</span>
24-
) : (
25-
<ProgressBar now={video.progress} variant="info" />
26-
)}
33+
<span className="row m-0 justify-content-end font-weight-bold">
34+
{getVideoStatus(video.status)}
35+
</span>
2736
</div>
2837
<UploadStatusIcon status={video.status} />
2938
</Stack>

src/files-and-videos/videos-page/upload-modal/UploadStatusIcon.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { Icon } from '@openedx/paragon';
3+
import { Icon, Spinner } from '@openedx/paragon';
44
import { Check, ErrorOutline } from '@openedx/paragon/icons';
55
import { RequestStatus } from '../../../data/constants';
66

@@ -10,6 +10,14 @@ const UploadStatusIcon = ({ status }) => {
1010
return (<Icon src={Check} />);
1111
case RequestStatus.FAILED:
1212
return (<Icon src={ErrorOutline} />);
13+
case RequestStatus.IN_PROGRESS:
14+
return (
15+
<Spinner
16+
animation="border"
17+
size="sm"
18+
screenReaderText="Loading"
19+
/>
20+
);
1321
default:
1422
return (<div style={{ width: '24px' }} />);
1523
}

0 commit comments

Comments
 (0)