diff --git a/src/components/dashboard/Officer_EventManagement.astro b/src/components/dashboard/Officer_EventManagement.astro index c9d23c0..d58b5ba 100644 --- a/src/components/dashboard/Officer_EventManagement.astro +++ b/src/components/dashboard/Officer_EventManagement.astro @@ -699,7 +699,7 @@ const currentPage = eventResponse.page;
- +
@@ -1832,19 +1832,26 @@ const currentPage = eventResponse.page; const modal = document.getElementById("filePreviewModal") as HTMLDialogElement; const filePreview = document.getElementById("universalFilePreview") as any; const previewFileName = document.getElementById("previewFileName"); + const loadingSpinner = document.getElementById("previewLoadingSpinner"); - if (filePreview && modal && previewFileName) { - // Update the preview component - const event = new CustomEvent("updateFilePreview", { - detail: { url, filename }, - }); - filePreview.dispatchEvent(event); + if (filePreview && modal && previewFileName && loadingSpinner) { + // Show loading spinner + loadingSpinner.classList.remove("hidden"); // Update the filename display previewFileName.textContent = filename; // Show the modal modal.showModal(); + + // Update the preview component + filePreview.setAttribute("url", url); + filePreview.setAttribute("filename", filename); + + // Hide loading spinner after a short delay + setTimeout(() => { + loadingSpinner.classList.add("hidden"); + }, 500); } }; @@ -1898,26 +1905,15 @@ const currentPage = eventResponse.page; return `
+ ${filename} +
+
- ${filename} -
-
- - - - -
${ filesToDelete.has(filename)