diff --git a/public/img/loading-dark.gif b/public/img/loading-dark.gif new file mode 100644 index 0000000..54c888b Binary files /dev/null and b/public/img/loading-dark.gif differ diff --git a/public/img/loading-light.gif b/public/img/loading-light.gif new file mode 100644 index 0000000..66472af Binary files /dev/null and b/public/img/loading-light.gif differ diff --git a/sass/colors.scss b/sass/colors.scss index 441062c..83b5325 100644 --- a/sass/colors.scss +++ b/sass/colors.scss @@ -56,6 +56,8 @@ $pagination-hover-color: rgb(115, 151, 186); --button-link-text-color: #2C364A; + --loader-img: url('/img/loading-light.gif'); + --nord0: #{$nord0}; --nord1: #{$nord1}; --nord2: #{$nord2}; @@ -94,4 +96,6 @@ $pagination-hover-color: rgb(115, 151, 186); --border-color: #{$nord1}; --button-link-text-color: #{$white}; + + --loader-img: url('/img/loading-dark.gif'); } \ No newline at end of file diff --git a/sass/index.scss b/sass/index.scss index 373b302..1979bb1 100644 --- a/sass/index.scss +++ b/sass/index.scss @@ -39,6 +39,7 @@ @import './icons'; @import './list'; @import './box'; +@import './loader'; @import './error'; @import './500'; diff --git a/sass/loader.scss b/sass/loader.scss new file mode 100644 index 0000000..a2ecace --- /dev/null +++ b/sass/loader.scss @@ -0,0 +1,13 @@ +.loader { + display: flex; + flex-direction: column; + align-items: center; + + .animation { + background-image: var(--loader-img); + background-repeat: no-repeat; + background-position: center center; + width: 64px; + height: 64px; + } +} \ No newline at end of file diff --git a/views/pages/mon-compte/ma-collection/index.ejs b/views/pages/mon-compte/ma-collection/index.ejs index f8c5f2e..54f129a 100644 --- a/views/pages/mon-compte/ma-collection/index.ejs +++ b/views/pages/mon-compte/ma-collection/index.ejs @@ -89,6 +89,12 @@
+
+
+
+ Chargement des données en cours… +
+
{{ item.artists_sort}} - {{ item.title }} @@ -226,6 +232,7 @@ methods: { fetch() { this.loading = true; + this.total = 0; let url = `/api/v1/albums?page=${this.page}&limit=${this.limit}&sort=${this.sort}&order=${this.order}`; if ( this.artist ) { @@ -247,9 +254,8 @@ axios.get(url) .then( response => { this.items = response.data.rows; - this.total = response.data.count; + this.total = response.data.count || 0; this.totalPages = parseInt(response.data.count / this.limit) + (response.data.count % this.limit > 0 ? 1 : 0); - }) .catch((err) => { showToastr(err.response?.data?.message || "Impossible de charger votre collection");