Skip to content

Commit

Permalink
add loading tip
Browse files Browse the repository at this point in the history
  • Loading branch information
daiagi committed Apr 10, 2023
1 parent 9e1eef1 commit 63f3944
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
23 changes: 14 additions & 9 deletions components/common/NotificationBox/NotificationBoxModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,20 @@
</div>
</div>
</div>
<div v-if="displayedEvents.length === 0" class="empty-tip">
<p>{{ $t('notification.emptyTipLine1') }}</p>
<p>{{ $t('notification.emptyTipLine2') }}</p>
<div v-if="loading" class="empty-tip">
<p>{{ $t('notification.loadingTip') }}</p>
</div>
<div v-else class="is-flex is-flex-direction-column">
<NotificationItem
v-for="(event, index) in displayedEvents"
:key="`${event.id}-${index}`"
:event="event" />
<div v-else>
<div v-if="allEvents.length === 0" class="empty-tip">
<p>{{ $t('notification.emptyTipLine1') }}</p>
<p>{{ $t('notification.emptyTipLine2') }}</p>
</div>
<div v-else class="is-flex is-flex-direction-column">
<NotificationItem
v-for="(event, index) in displayedEvents"
:key="`${event.id}-${index}`"
:event="event" />
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -124,7 +129,7 @@ const eventFilter = ref<string[]>([])
const showFilter = ref(false)
const emit = defineEmits(['close'])
const { collections, events: allEvents } = useNotification()
const { collections, events: allEvents, loading } = useNotification()
const toggleCollectionFilter = (target: FilterOption) => {
if (collectionFilter.value?.id === target.id) {
Expand Down
3 changes: 2 additions & 1 deletion components/common/NotificationBox/useNotification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const useNotification = () => {
account: accountId.value,
},
})
const { data: eventData } = useGraphql({
const { data: eventData, loading } = useGraphql({
queryPrefix:
urlPrefix.value === 'bsx' || urlPrefix.value === 'snek'
? 'chain-bsx'
Expand Down Expand Up @@ -86,5 +86,6 @@ export const useNotification = () => {
return {
collections,
events,
loading,
}
}
3 changes: 2 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,7 @@
"byCollection": "By collection",
"byEvent": "By event",
"emptyTipLine1": "Don't wait for notifications,",
"emptyTipLine2": "make your own buzz with your art."
"emptyTipLine2": "make your own buzz with your art.",
"loadingTip": "Loading Your Notifications..."
}
}

0 comments on commit 63f3944

Please sign in to comment.