From ff2c0057e890b9ecb552df30914333349ea20eb7 Mon Sep 17 00:00:00 2001 From: C4illin Date: Tue, 3 Jun 2025 18:23:26 +0200 Subject: [PATCH] fix: progress bars on firefox --- public/script.js | 32 ++--- src/pages/results.tsx | 326 ++++++++++++++---------------------------- 2 files changed, 124 insertions(+), 234 deletions(-) diff --git a/public/script.js b/public/script.js index e99ad78..81caee2 100644 --- a/public/script.js +++ b/public/script.js @@ -17,20 +17,20 @@ dropZone.addEventListener("dragleave", () => { }); dropZone.addEventListener("drop", (e) => { - e.preventDefault(); - dropZone.classList.remove("dragover"); - - const files = e.dataTransfer.files; - - if (files.length === 0) { - console.warn("No files dropped — likely a URL or unsupported source."); - return; - } - - for (const file of files) { - console.log("Handling dropped file:", file.name); - handleFile(file); - } + e.preventDefault(); + dropZone.classList.remove("dragover"); + + const files = e.dataTransfer.files; + + if (files.length === 0) { + console.warn("No files dropped — likely a URL or unsupported source."); + return; + } + + for (const file of files) { + console.log("Handling dropped file:", file.name); + handleFile(file); + } }); // Extracted handleFile function for reusability in drag-and-drop and file input @@ -40,7 +40,7 @@ function handleFile(file) { const row = document.createElement("tr"); row.innerHTML = ` ${file.name} - + ${(file.size / 1024).toFixed(2)} kB Remove `; @@ -207,7 +207,7 @@ const uploadFile = (file) => { const formData = new FormData(); formData.append("file", file, file.name); - let xhr = new XMLHttpRequest(); + let xhr = new XMLHttpRequest(); xhr.open("POST", `${webroot}/upload`, true); diff --git a/src/pages/results.tsx b/src/pages/results.tsx index 8d5f916..a1570db 100644 --- a/src/pages/results.tsx +++ b/src/pages/results.tsx @@ -7,6 +7,112 @@ import { Header } from "../components/header"; import { BaseHtml } from "../components/base"; import db from "../db/db"; +function ResultsArticle({ job, files, outputPath }: { job: Jobs, files: Filename[], outputPath: string }) { + return (
+
+

Results

+
+ +
+
+ + + + + + + + + + + + {files.map((file) => ( + + + + + + + ))} + +
+ Converted File Name + + Status + + View + + Download +
+ {file.output_file_name} + {file.status} + + View + + + + Download + +
+
+ ) +} + export const results = new Elysia() .use(userService) .get( @@ -59,114 +165,7 @@ export const results = new Elysia() sm:px-4 `} > -
-
-

Results

-
- -
-
- - - - - - - - - - - - {files.map((file) => ( - - - - - - - ))} - -
- Converted File Name - - Status - - View - - Download -
- {file.output_file_name} - {file.status} - - View - - - - Download - -
-
+