Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Move Loading Indicators to Toast Notifications #1265

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions pages/bookshelf/index.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<template>
<div class="w-full h-full min-h-full relative">
<div v-if="attemptingConnection" class="w-full pt-4 flex items-center justify-center">
<widgets-loading-spinner />
<p class="pl-4">{{ $strings.MessageAttemptingServerConnection }}</p>
</div>
<div v-if="shelves.length && isLoading" class="w-full pt-4 flex items-center justify-center">
<widgets-loading-spinner />
<p class="pl-4">{{ $strings.MessageLoadingServerData }}</p>
</div>

<div class="w-full" :class="{ 'py-6': altViewEnabled }">
<template v-for="(shelf, index) in shelves">
<bookshelf-shelf :key="shelf.id" :label="getShelfLabel(shelf)" :entities="shelf.entities" :type="shelf.type" :style="{ zIndex: shelves.length - index }" />
Expand Down Expand Up @@ -74,6 +65,20 @@ export default {
console.log(`[categories] networkConnected false so fetching categories`)
this.fetchCategories()
}
},
attemptingConnection(newVal) {
if (newVal) {
this.$toast.info(this.$strings.MessageAttemptingServerConnection, { timeout: 0, id: 1 })
} else {
this.$toast.dismiss(1)
}
},
isLoading(newVal) {
if (newVal && this.shelves.length) {
this.$toast.success(this.$strings.MessageLoadingServerData, { timeout: 0, id: 2 })
} else {
this.$toast.dismiss(2)
}
}
},
computed: {
Expand Down