From 6689c99589251186f23aa574e4cce04a4548b12f Mon Sep 17 00:00:00 2001 From: Oj Date: Thu, 23 Dec 2021 16:26:36 +0000 Subject: [PATCH] [Splash] Rewrite to fix progress UI, fix state text --- src/splash/index.html | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/splash/index.html b/src/splash/index.html index cfaaf13..afef31b 100644 --- a/src/splash/index.html +++ b/src/splash/index.html @@ -1,9 +1,8 @@ -
Launching...
+
Starting...
-
-
+
@@ -69,9 +68,6 @@ } #bar-container, #bar-fill { - margin-top: 10px; - transform: translate(-50%, -50%); - width: 180px; height: 8px; @@ -81,16 +77,15 @@ } #bar-container { - position: absolute; - background: var(--background-secondary); + background-color: var(--background-secondary); + + position: relative; + margin-top: 12px; } #bar-fill { background-color: var(--brand-experiment); width: 0; - - transform: translate(0%, -50%); - left: 10%; } #debug { @@ -114,34 +109,36 @@ DiscordSplash.signalReady(); DiscordSplash.onStateUpdate(({ status, current, total, progress, seconds }) => { - let text = status.replaceAll('-', ' '); + let statusText = status.replaceAll('-', ' '); + let showProgress = false; switch (status) { case 'downloading-updates': // X of Y states case 'installing-updates': - text = text.slice(0, -1) + ` ${current} of ${total}`; // Remove "s" and concat + statusText = statusText.slice(0, -1) + ` ${current} of ${total}`; // Remove "s" and concat + showProgress = true; break; case 'update-failure': // Custom for update failure, include retry and reorder text - text = `Update Failed - Retrying in ${seconds}`; + statusText = `Update Failed - Retrying in ${seconds}`; break; case 'launching': - text = 'Starting...'; + statusText = 'Starting...'; break; } - text.textContent = text; + text.textContent = statusText; - if (progress) { + if (showProgress) { barContainer.style.visibility = 'visible'; barFill.style.visibility = 'visible'; - barFill.style.width = 80 * (progress / 100) + '%'; + barFill.style.width = 100 * (progress / 100) + '%'; } else { - barContainer.style.display = ''; - barFill.style.display = ''; + barContainer.style.visibility = ''; + barFill.style.visibility = ''; } });