From ff333a05264f92572eba447d013329b0fb0c27b5 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Sat, 16 Dec 2023 21:45:59 +0100 Subject: [PATCH] Loading indicator --- index.html | 2 +- src/DomElements.ts | 1 + src/InterfaceLogic.ts | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 839a2c0..0fa0aee 100644 --- a/index.html +++ b/index.html @@ -383,7 +383,7 @@ diff --git a/src/DomElements.ts b/src/DomElements.ts index 411d41d..bc9d7bb 100644 --- a/src/DomElements.ts +++ b/src/DomElements.ts @@ -19,6 +19,7 @@ export const singleElements = { download_universe_button: "download-universes", upload_universe_button: "upload-universes", upload_samples_button: "upload-samples", + sample_indicator: "sample-indicator", destroy_universes_button: "destroy-universes", documentation_button: "doc-button-1", eval_button: "eval-button-1", diff --git a/src/InterfaceLogic.ts b/src/InterfaceLogic.ts index a616224..e729521 100644 --- a/src/InterfaceLogic.ts +++ b/src/InterfaceLogic.ts @@ -161,14 +161,17 @@ export const installInterfaceLogic = (app: Editor) => { }); app.interface.upload_samples_button.addEventListener("input", async (event) => { - console.log("Il se passe quelque chose") let fileInput = event.target as HTMLInputElement; if (!fileInput.files?.length) { return; } - console.log(fileInput.files) + app.interface.sample_indicator.innerText = "Loading..."; + app.interface.sample_indicator.classList.add("animate-pulse"); await uploadSamplesToDB(samplesDBConfig, fileInput.files).then(() => { - registerSamplesFromDB(samplesDBConfig, () => {}); + registerSamplesFromDB(samplesDBConfig, () => { + app.interface.sample_indicator.innerText = "Import samples"; + app.interface.sample_indicator.classList.remove("animate-pulse"); + }); }); });