From 544ea43a84a57924fae10fd766d8710622b09f8a Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Tue, 27 Jan 2026 16:04:57 +0100 Subject: [PATCH] Fix Android navigation and improve UI responsiveness - Convert music category buttons from + {#if idx < track.artistItems.length - 1} , {/if} @@ -279,13 +288,13 @@ {#if showAlbum}
{#if track.albumId} - + {:else} {track.albumName || "-"} {/if} @@ -333,9 +342,10 @@ + {#if idx < track.artistItems.length - 1} , {/if} @@ -381,26 +391,26 @@ {/if} {#if track.albumId} - + {:else} {track.albumName || "-"} {/if} {:else if showArtist} {#if track.artistItems && track.artistItems.length > 0} {#each track.artistItems as artist, idx} - + {#if idx < track.artistItems.length - 1} , {/if} @@ -410,13 +420,13 @@ {/if} {:else if showAlbum} {#if track.albumId} - + {:else} {track.albumName || "-"} {/if} diff --git a/src/routes/library/+page.svelte b/src/routes/library/+page.svelte index 2279574..801f639 100644 --- a/src/routes/library/+page.svelte +++ b/src/routes/library/+page.svelte @@ -43,17 +43,21 @@ }); async function handleLibraryClick(lib: Library) { - // Route to dedicated music library page - if (lib.collectionType === "music") { - library.setCurrentLibrary(lib); - goto("/library/music"); - return; - } + try { + // Route to dedicated music library page + if (lib.collectionType === "music") { + library.setCurrentLibrary(lib); + await goto("/library/music"); + return; + } - // For other library types, load items normally - library.setCurrentLibrary(lib); - library.clearGenres(); - await library.loadItems(lib.id); + // For other library types, load items normally + library.setCurrentLibrary(lib); + library.clearGenres(); + await library.loadItems(lib.id); + } catch (error) { + console.error("Navigation error:", error); + } } async function handleGenreFilterChange() { @@ -64,35 +68,39 @@ } } - function handleItemClick(item: MediaItem | Library) { - if ("type" in item) { - // It's a MediaItem - const mediaItem = item as MediaItem; - switch (mediaItem.type) { - case "Series": - case "Movie": - case "MusicAlbum": - case "MusicArtist": - case "Folder": - case "CollectionFolder": - case "Playlist": - case "Channel": - case "ChannelFolderItem": - // Navigate to detail view - goto(`/library/${mediaItem.id}`); - break; - case "Episode": - // Episodes play directly - goto(`/player/${mediaItem.id}`); - break; - default: - // For other items, try detail page first - goto(`/library/${mediaItem.id}`); - break; + async function handleItemClick(item: MediaItem | Library) { + try { + if ("type" in item) { + // It's a MediaItem + const mediaItem = item as MediaItem; + switch (mediaItem.type) { + case "Series": + case "Movie": + case "MusicAlbum": + case "MusicArtist": + case "Folder": + case "CollectionFolder": + case "Playlist": + case "Channel": + case "ChannelFolderItem": + // Navigate to detail view + await goto(`/library/${mediaItem.id}`); + break; + case "Episode": + // Episodes play directly + await goto(`/player/${mediaItem.id}`); + break; + default: + // For other items, try detail page first + await goto(`/library/${mediaItem.id}`); + break; + } + } else { + // It's a Library + await handleLibraryClick(item as Library); } - } else { - // It's a Library - handleLibraryClick(item as Library); + } catch (error) { + console.error("Navigation error:", error); } } @@ -180,11 +188,11 @@

No libraries found

{:else} -
+
{#each $libraries as lib (lib.id)} handleLibraryClick(lib)} /> {/each} diff --git a/src/routes/library/music/+page.svelte b/src/routes/library/music/+page.svelte index c6b832d..37d289c 100644 --- a/src/routes/library/music/+page.svelte +++ b/src/routes/library/music/+page.svelte @@ -1,6 +1,4 @@
@@ -59,27 +53,27 @@

Music Library

Choose a category to browse

- +
{#each categories as category (category.id)} -
- + {/each}