diff --git a/web/src/lib/components/AlphaLibrary.svelte b/web/src/lib/components/AlphaLibrary.svelte new file mode 100644 index 00000000..956e9768 --- /dev/null +++ b/web/src/lib/components/AlphaLibrary.svelte @@ -0,0 +1,131 @@ + + +
+
+
+

{title}

+ {#if !query.isPending && !failed} +

{plural(total, one, many)}

+ {/if} +
+ {#if items.length > 0} + + {/if} +
+ + {#if failed} + + {:else if showSkeleton.value && items.length === 0} +

Loading…

+ {:else if !query.isPending && total === 0} + + {#if user.value?.is_admin} + + {#snippet actions()} + + Run a scan + + {/snippet} + + {:else} + + {/if} + {:else if filter.trim() && filtered.length === 0} +

+ No {many} in your loaded library match + '{filter.trim()}'. + + Search the full library → + +

+ {:else} + query.fetchNextPage()} + {item} + /> + + query.fetchNextPage()} + endLabel="End of library" + /> + {/if} +
diff --git a/web/src/routes/library/albums/+page.svelte b/web/src/routes/library/albums/+page.svelte index 04ca50ff..6b92c6b7 100644 --- a/web/src/routes/library/albums/+page.svelte +++ b/web/src/routes/library/albums/+page.svelte @@ -1,104 +1,26 @@ {pageTitle('Library · Albums')} -
-
-
-

Albums

- {#if !query.isPending && !(query.isError && !query.isFetchNextPageError)} -

- {plural(total, 'album', 'albums')} -

- {/if} -
- {#if albums.length > 0} - - {/if} -
- - {#if query.isError && !query.isFetchNextPageError} - - {:else if showSkeleton.value && albums.length === 0} -

Loading…

- {:else if !query.isPending && total === 0} - - {#if user.value?.is_admin} - - {#snippet actions()} - - Run a scan - - {/snippet} - - {:else} - - {/if} - {:else if filter.trim() && filtered.length === 0} -

- No albums in your loaded library match - '{filter.trim()}'. - - Search the full library → - -

- {:else} - a.sort_title || a.title} - hasMore={!!query.hasNextPage} - onLoadMore={() => query.fetchNextPage()} - > - {#snippet item(album: AlbumRef)} - - {/snippet} - - - query.fetchNextPage()} - endLabel="End of library" - /> - {/if} -
+ a.title.toLowerCase().includes(q) || a.artist_name.toLowerCase().includes(q)} + getKey={(a: AlbumRef) => a.sort_title || a.title} + searchPath="/search/albums" +> + {#snippet item(album: AlbumRef)} + + {/snippet} + diff --git a/web/src/routes/library/artists/+page.svelte b/web/src/routes/library/artists/+page.svelte index 88ddf950..c8f34c9a 100644 --- a/web/src/routes/library/artists/+page.svelte +++ b/web/src/routes/library/artists/+page.svelte @@ -1,102 +1,26 @@ {pageTitle('Library · Artists')} -
-
-
-

Artists

- {#if !query.isPending && !(query.isError && !query.isFetchNextPageError)} -

- {plural(total, 'artist', 'artists')} -

- {/if} -
- {#if artists.length > 0} - - {/if} -
- - {#if query.isError && !query.isFetchNextPageError} - - {:else if showSkeleton.value && artists.length === 0} -

Loading…

- {:else if !query.isPending && total === 0} - - {#if user.value?.is_admin} - - {#snippet actions()} - - Run a scan - - {/snippet} - - {:else} - - {/if} - {:else if filter.trim() && filtered.length === 0} -

- No artists in your loaded library match - '{filter.trim()}'. - - Search the full library → - -

- {:else} - a.sort_name || a.name} - hasMore={!!query.hasNextPage} - onLoadMore={() => query.fetchNextPage()} - > - {#snippet item(a: ArtistRef)} - - {/snippet} - - - query.fetchNextPage()} - endLabel="End of library" - /> - {/if} -
+ a.name.toLowerCase().includes(q)} + getKey={(a: ArtistRef) => a.sort_name || a.name} + searchPath="/search/artists" +> + {#snippet item(a: ArtistRef)} + + {/snippet} +