Browse Source

Added loader icon on dashboard

It will be shown when token is still being verified.

Moved loader icon section from auth.njk to _partial/loader.njk,
which will also be included into dashboard.njk.

Bumped v1 version string.
Bobby Wibowo 3 weeks ago
parent
commit
6a934627a2
7 changed files with 18 additions and 11 deletions
  1. 1 1
      dist/js/dashboard.js
  2. 1 1
      dist/js/dashboard.js.map
  3. 6 1
      src/js/dashboard.js
  4. 1 1
      src/versions.json
  5. 7 0
      views/_partial/loader.njk
  6. 1 7
      views/auth.njk
  7. 1 0
      views/dashboard.njk

File diff suppressed because it is too large
+ 1 - 1
dist/js/dashboard.js


File diff suppressed because it is too large
+ 1 - 1
dist/js/dashboard.js.map


+ 6 - 1
src/js/dashboard.js

@@ -90,6 +90,11 @@ const page = {
   albumDescMaxLength: 4000
 }
 
+page.unhide = () => {
+  document.querySelector('#loader').classList.add('is-hidden')
+  document.querySelector('#dashboard').classList.remove('is-hidden')
+}
+
 // Handler for regular JS errors
 page.onError = error => {
   console.error(error)
@@ -218,7 +223,7 @@ page.prepareDashboard = () => {
   document.querySelector('#itemLogout').innerHTML = `Logout ( ${page.username} )`
 
   // Finally display dashboard
-  document.querySelector('#dashboard').classList.remove('is-hidden')
+  page.unhide()
 
   // Load albums sidebar
   page.getAlbumsSidebar()

+ 1 - 1
src/versions.json

@@ -1,5 +1,5 @@
 {
-  "1": "1568900156",
+  "1": "1569041231",
   "2": "1568894058",
   "3": "1568894058",
   "4": "1568894058",

+ 7 - 0
views/_partial/loader.njk

@@ -0,0 +1,7 @@
+<section id="loader" class="hero is-fullheight">
+  <div class="hero-body">
+    <div class="container has-text-centered">
+      <span class="loader is-inline-block"></span>
+    </div>
+  </div>
+</section>

+ 1 - 7
views/auth.njk

@@ -18,13 +18,6 @@
 
 {% block content %}
 {{ super() }}
-<section id="loader" class="hero is-fullheight">
-  <div class="hero-body">
-    <div class="container has-text-centered">
-      <span class="loader is-inline-block"></span>
-    </div>
-  </div>
-</section>
 <section id="login" class="hero is-fullheight is-hidden">
   <div class="hero-body">
     <div class="container">
@@ -74,5 +67,6 @@
   </div>
 </section>
 
+{% include "_partial/loader.njk" %}
 {% include "_partial/noscript.njk" %}
 {% endblock %}

+ 1 - 0
views/dashboard.njk

@@ -95,5 +95,6 @@
   </div>
 </section>
 
+{% include "_partial/loader.njk" %}
 {% include "_partial/noscript.njk" %}
 {% endblock %}