From 1465b939269a2f6d8d420d912ca6065a1be6e45f Mon Sep 17 00:00:00 2001 From: KristinAoki Date: Tue, 30 Jul 2024 13:13:35 -0400 Subject: [PATCH] feat: replace progress bar with loading spinner --- .../videos-page/data/thunks.js | 4 +-- src/files-and-videos/videos-page/messages.js | 2 +- .../upload-modal/UploadProgressList.jsx | 25 +++++++++++++------ .../upload-modal/UploadStatusIcon.jsx | 10 +++++++- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/files-and-videos/videos-page/data/thunks.js b/src/files-and-videos/videos-page/data/thunks.js index 2fa064ce6a..cefc04ebd0 100644 --- a/src/files-and-videos/videos-page/data/thunks.js +++ b/src/files-and-videos/videos-page/data/thunks.js @@ -54,7 +54,7 @@ export function cancelAllUploads(courseId, uploadData) { control.abort(); }); Object.entries(uploadData).forEach(([key, value]) => { - if (value.status === RequestStatus.PENDING) { + if (value.status === RequestStatus.IN_PROGRESS) { updateVideoUploadStatus( courseId, key, @@ -324,7 +324,7 @@ export function addVideoFile( if (uploadUrl && edxVideoId) { uploadingIdsRef.current.uploadData = newUploadData({ - status: RequestStatus.PENDING, + status: RequestStatus.IN_PROGRESS, currentData: uploadingIdsRef.current.uploadData, originalValue: { name, progress }, key: `video_${idx}`, diff --git a/src/files-and-videos/videos-page/messages.js b/src/files-and-videos/videos-page/messages.js index 91096b2f61..e6e25d8aa2 100644 --- a/src/files-and-videos/videos-page/messages.js +++ b/src/files-and-videos/videos-page/messages.js @@ -68,7 +68,7 @@ const messages = defineMessages({ }, videoUploadTrackerAlertEditMessage: { id: 'course-authoring.files-and-videos.video-upload-tracker-alert.edit.message', - defaultMessage: 'Want to coninue editing in Studio during this upload?', + defaultMessage: 'Want to continue editing in Studio during this upload?', description: 'Continue editing message for the Upload Tracker Alert', }, videoUploadTrackerAlertEditHyperlinkLabel: { diff --git a/src/files-and-videos/videos-page/upload-modal/UploadProgressList.jsx b/src/files-and-videos/videos-page/upload-modal/UploadProgressList.jsx index dcdf7f4a3d..fdecdb35b1 100644 --- a/src/files-and-videos/videos-page/upload-modal/UploadProgressList.jsx +++ b/src/files-and-videos/videos-page/upload-modal/UploadProgressList.jsx @@ -1,9 +1,22 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { ProgressBar, Stack, Truncate } from '@openedx/paragon'; +import { Stack, Truncate } from '@openedx/paragon'; import UploadStatusIcon from './UploadStatusIcon'; import { RequestStatus } from '../../../data/constants'; +const getVideoStatus = (status) => { + switch (status) { + case RequestStatus.IN_PROGRESS: + return 'UPLOADING'; + case RequestStatus.PENDING: + return 'QUEUED'; + case RequestStatus.SUCCESSFUL: + return ''; + default: + return status.toUpperCase(); + } +}; + const UploadProgressList = ({ videosList }) => (
{videosList.map(([id, video], index) => { @@ -17,13 +30,9 @@ const UploadProgressList = ({ videosList }) => (
- {video.status === RequestStatus.FAILED ? ( - - {video.status.toUpperCase()} - - ) : ( - - )} + + {getVideoStatus(video.status)} +
diff --git a/src/files-and-videos/videos-page/upload-modal/UploadStatusIcon.jsx b/src/files-and-videos/videos-page/upload-modal/UploadStatusIcon.jsx index 6b8fd5c014..b620372dd0 100644 --- a/src/files-and-videos/videos-page/upload-modal/UploadStatusIcon.jsx +++ b/src/files-and-videos/videos-page/upload-modal/UploadStatusIcon.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Icon } from '@openedx/paragon'; +import { Icon, Spinner } from '@openedx/paragon'; import { Check, ErrorOutline } from '@openedx/paragon/icons'; import { RequestStatus } from '../../../data/constants'; @@ -10,6 +10,14 @@ const UploadStatusIcon = ({ status }) => { return (); case RequestStatus.FAILED: return (); + case RequestStatus.IN_PROGRESS: + return ( + + ); default: return (
); }