From a53ea582e451f17aa02c13f6b2ad23fc5d740967 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Mon, 8 Aug 2022 10:12:41 -0400 Subject: [PATCH] Added version indicator option 3 (#3393) lukew3 * Fix missing step in contributing advanced * Removed condition that will never be hit * Replace version banner with newVersionIndicator * Update CONTRIBUTING_ADVANCED.md * Changed newVersionIndicator to text * Add negative margin to indicator to fix alignment * close newVersionIndicator on click * Removed show x on hover * style touch ups Co-authored-by: Miodec --- CONTRIBUTING_ADVANCED.md | 2 +- frontend/src/styles/footer.scss | 18 ++++++++++++++++-- frontend/src/ts/elements/version-check.ts | 17 +---------------- frontend/src/ts/popups/version-popup.ts | 5 +++++ frontend/static/html/bottom.html | 11 +++++++---- 5 files changed, 30 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTING_ADVANCED.md b/CONTRIBUTING_ADVANCED.md index 65c0ebda8..0be34a18c 100644 --- a/CONTRIBUTING_ADVANCED.md +++ b/CONTRIBUTING_ADVANCED.md @@ -52,7 +52,7 @@ Alternatively, if you use `nvm` then you can run `nvm install` and `nvm use` (yo - Run `firebase projects:list` to find your firebase project id. -1. Within the `frontend/src/ts/constants` directory, duplicate `firebase-config-example.ts`, rename it to `firebase-config.ts` and paste in your firebase config +1. Within the `frontend/src/ts/constants` directory, duplicate `firebase-config-example.ts`, rename it to `firebase-config.ts` and paste in your firebase config object - To find it, go to the Firebase console - Navigate to `Project Settings > General > Your apps` diff --git a/frontend/src/styles/footer.scss b/frontend/src/styles/footer.scss index 7b499240f..969ee509f 100644 --- a/frontend/src/styles/footer.scss +++ b/frontend/src/styles/footer.scss @@ -87,8 +87,19 @@ } } - .version { - opacity: 0; + #versionGroup { + display: flex; + .version { + opacity: 0; + } + #newVersionIndicator { + background-color: var(--main-color); + border-radius: calc(var(--roundness) / 2); + color: var(--bg-color); + text-align: center; + cursor: pointer; + transition: 0.125s; + } } } @@ -99,6 +110,9 @@ a { opacity: 0 !important; } + #newVersionIndicator { + opacity: 0 !important; + } #commandLineMobileButton { opacity: 0 !important; pointer-events: none !important; diff --git a/frontend/src/ts/elements/version-check.ts b/frontend/src/ts/elements/version-check.ts index 7923cdb9e..3798ef85f 100644 --- a/frontend/src/ts/elements/version-check.ts +++ b/frontend/src/ts/elements/version-check.ts @@ -1,5 +1,3 @@ -import * as Notifications from "./notifications"; - function setMemory(v: string): void { window.localStorage.setItem("lastSeenVersion", v); } @@ -14,23 +12,10 @@ export async function show(version: string): Promise { setMemory(version); return; } - if ( - window.location.hostname === "localhost" || - window.location.hostname === "127.0.0.1" - ) { - caches.keys().then(function (names) { - for (const name of names) caches.delete(name); - }); - } if (memory === version) return; caches.keys().then(function (names) { for (const name of names) caches.delete(name); }); - Notifications.addBanner( - `Version ${version} has been released. Click the version number in the bottom right to view the changelog.`, - 1, - "code-branch", - false - ); + $("#newVersionIndicator").removeClass("hidden"); setMemory(version); } diff --git a/frontend/src/ts/popups/version-popup.ts b/frontend/src/ts/popups/version-popup.ts index 1e74135fc..95870b42a 100644 --- a/frontend/src/ts/popups/version-popup.ts +++ b/frontend/src/ts/popups/version-popup.ts @@ -3,8 +3,13 @@ export function show(): void { .css("opacity", 0) .removeClass("hidden") .animate({ opacity: 1 }, 125); + $("#newVersionIndicator").addClass("hidden"); } +$(document.body).on("click", "#newVersionIndicator", () => { + $("#newVersionIndicator").addClass("hidden"); +}); + $(document.body).on("click", ".version", (e) => { if (e.shiftKey) return; show(); diff --git a/frontend/static/html/bottom.html b/frontend/static/html/bottom.html index 038b79aa0..92ad144d9 100644 --- a/frontend/static/html/bottom.html +++ b/frontend/static/html/bottom.html @@ -77,10 +77,13 @@
serika dark
- - -
version
-
+
+ + +
version
+
+ new +