From c1715197eb76be73e35ea539b6590ac8d09a6096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20K=C3=BCnzel?= <simonk@fsmpi.rwth-aachen.de> Date: Tue, 22 Apr 2025 23:08:47 +0200 Subject: [PATCH] Show download status after finished downloading and fix download links --- src/videoag/course/DownloadManager.tsx | 9 ++------- src/videoag/course/Medium.tsx | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/videoag/course/DownloadManager.tsx b/src/videoag/course/DownloadManager.tsx index 334b56e..5f9005d 100644 --- a/src/videoag/course/DownloadManager.tsx +++ b/src/videoag/course/DownloadManager.tsx @@ -181,7 +181,7 @@ async function downloadWithDownloadAPI( ): Promise<boolean> { showWarningToast( "Unable to store files in directory automatically. Using basic download API which might require" + - " you to selected the destination location for every file.", + " you to select the destination location for every file.", ); for (const toDownload of filesToDownload) { try { @@ -211,7 +211,6 @@ async function downloadWithDownloadAPI( } async function downloadMedia( - downloadStatus: Map<int, DownloadStatus> | undefined, setDownloadStatus: ( fn: (old?: Map<int, DownloadStatus> | undefined) => Map<int, DownloadStatus> | undefined, ) => void, @@ -287,9 +286,6 @@ async function downloadMedia( return false; }); console.log(`Download finished. Success: ${success}`); - if (success) { - showInfoToast("Download finished"); - } } function DownloadAllLectureListItem({ @@ -310,7 +306,7 @@ function DownloadAllLectureListItem({ const media = getSortedDownloadablePublishMedia(lecture.publish_media!); let displayedProgress; - if (isDownloading && selectedMediumId !== undefined) { + if ((isDownloading || downloadStatus !== undefined) && selectedMediumId !== undefined) { // Lecture needs to be downloaded if (downloadStatus === undefined) { // Not yet started @@ -495,7 +491,6 @@ export default function DownloadAllModal({ course }: { course: course }) { const startDownloads = async () => { if (isDownloading) return; downloadMedia( - downloadStatus, setDownloadStatus, course, chosenMediumIdByLectureId, diff --git a/src/videoag/course/Medium.tsx b/src/videoag/course/Medium.tsx index 54b50c7..c2a0ae8 100644 --- a/src/videoag/course/Medium.tsx +++ b/src/videoag/course/Medium.tsx @@ -87,7 +87,7 @@ export function PublishMediumList({ publish_media }: { publish_media: publish_me } > <span className="bi bi-download" /> - <a href={medium.download_url} className="mx-1"> + <a href={medium.download_url} download target="_blank" className="mx-1"> {name} </a> {editMode && ( @@ -147,7 +147,7 @@ export function PublishMediumDownloadButton({ return ( <div key={medium.id} className={"d-flex align-items-center " + bgColor}> - <Dropdown.Item href={medium.download_url} download> + <Dropdown.Item href={medium.download_url} download target="_blank"> {name} </Dropdown.Item> {editMode && ( -- GitLab