Skip to content

Commit

Permalink
fix missing empty indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
tamland committed Oct 21, 2024
1 parent f652633 commit f5709b9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/discover/Discover.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div v-if="!loading">
<ContentLoader :loading="loading">
<div v-for="section in sections" :key="section.key" class="mb-4">
<template v-if="result[section.key].length > 0">
<h1>
Expand All @@ -14,7 +14,8 @@
<AlbumList :items="result[section.key]" allow-h-scroll />
</template>
</div>
</div>
<EmptyIndicator v-if="empty" />
</ContentLoader>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
Expand Down Expand Up @@ -44,6 +45,9 @@
{ name: 'Most played', key: 'most-played' },
{ name: 'Random', key: 'random' },
]
},
empty() {
return Object.values(this.result).findIndex(x => x.length > 0) === -1
}
},
created() {
Expand Down
3 changes: 2 additions & 1 deletion src/library/album/AlbumLibrary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</ul>
<AlbumList :items="albums" />
<InfiniteLoader :key="sort" :loading="loading" :has-more="hasMore" @load-more="loadMore" />
<EmptyIndicator v-if="!loading && albums.length === 0" />
</div>
</template>
<script lang="ts">
Expand All @@ -26,7 +27,7 @@
data() {
return {
albums: [] as | Album[],
loading: false,
loading: true,
offset: 0 as number,
hasMore: true,
}
Expand Down
1 change: 1 addition & 0 deletions src/library/artist/ArtistLibrary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</ul>
<ContentLoader v-slot :loading="loading">
<ArtistList :items="sortedItems" />
<EmptyIndicator v-if="items.length === 0" />
</ContentLoader>
</div>
</template>
Expand Down
3 changes: 2 additions & 1 deletion src/library/genre/GenreLibrary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</li>
</ul>
<ContentLoader v-slot :loading="loading">
<Tiles>
<Tiles v-if="sortedItems.length > 0">
<Tile v-for="item in sortedItems" :key="item.id"
:to="{name: 'genre', params: { id: item.id } }"
:title="item.name" :image="item.image">
Expand All @@ -23,6 +23,7 @@
</template>
</Tile>
</Tiles>
<EmptyIndicator v-else />
</ContentLoader>
</div>
</template>
Expand Down

0 comments on commit f5709b9

Please sign in to comment.