From e6038f45a8ba5fef8f6e032b3c649bfb15b854c5 Mon Sep 17 00:00:00 2001 From: Kai Kuehner Date: Thu, 15 Aug 2024 21:36:00 -0400 Subject: [PATCH] badges CSS and fade in --- src/badges.ts | 6 ++++ src/components/ExtensionBar.vue | 21 ++++++++++++- src/components/UserProfile.vue | 53 +++++++++++++++++++++++++++++---- 3 files changed, 73 insertions(+), 7 deletions(-) diff --git a/src/badges.ts b/src/badges.ts index 94fc068..311ab2d 100644 --- a/src/badges.ts +++ b/src/badges.ts @@ -1,3 +1,9 @@ +/* +TODO: +This should be replaced with just copying the images folder. +But the build system has to be rewritten for that, and not just use neuroglancer's +*/ + import edits10 from './images/badges/edits10.png'; import edits100 from './images/badges/edits100.png'; import edits1000000 from './images/badges/edits1000000.png'; diff --git a/src/components/ExtensionBar.vue b/src/components/ExtensionBar.vue index 6c82479..b68dec2 100644 --- a/src/components/ExtensionBar.vue +++ b/src/components/ExtensionBar.vue @@ -47,6 +47,25 @@ function logout(session: loginSession) { login.logout(session); } +function openUserProfile() { + showUserProfile.value = true; + const badgeEls = document.querySelectorAll('.nge-user-profile-badge'); + let i = 0; + const delay = 300; + for (const badgeEl of badgeEls) { + badgeEl.classList.add('animate-hide'); + setTimeout(function() { + badgeEl.classList.remove('animate-hide'); + badgeEl.classList.add('animate-fade-in'); + //reset animation + (badgeEl as HTMLElement).style.animation = 'none'; + (badgeEl as HTMLElement).offsetHeight; + (badgeEl as HTMLElement).style.animation = ''; + }, i * delay); + i++; + } +} +