From 6dc56e02bd4b1d20dc635305e462d726d92effae Mon Sep 17 00:00:00 2001 From: Kumi Date: Sat, 16 Mar 2024 21:57:25 +0100 Subject: [PATCH] feat(userarea.js): enhance file upload feedback Enhanced the file upload feedback mechanism in `userarea.js` by introducing a clearer, success indication and preparing for future implementations where upload completion will trigger additional checks against the API for resolution availability. This change brings a more intuitive user experience during file uploads and lays groundwork for next steps in upload handling, ensuring users are better informed of the upload status in real-time. - Imported `getElementById` for future feature expansion. - Added a TODO comment as a placeholder for upcoming API check functionality. --- assets/js/userarea.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/js/userarea.js b/assets/js/userarea.js index 9a13b2d..67a48aa 100644 --- a/assets/js/userarea.js +++ b/assets/js/userarea.js @@ -1,7 +1,7 @@ import "../scss/frontend.scss"; import "../css/userarea.css"; -import { getCookie } from "./api"; +import { getCookie, getElementById } from "./api"; import { Tab } from "bootstrap"; import DataTable from "datatables.net-dt"; @@ -129,10 +129,11 @@ function uploadFile(file, progressBar, thumbnail) { xhr.onload = () => { if (xhr.status === 201) { const response = JSON.parse(xhr.responseText); - const thumbnailUrl = response.thumbnailUrl; - thumbnail.src = thumbnailUrl; progressBar.classList.add("bg-success"); progressBar.textContent = "Success!"; + + // TODO: Check API until the first resolution is available + } else { progressBar.classList.add("bg-danger"); progressBar.textContent = "Error!";