diff --git a/frontend/src/pages/library.rs b/frontend/src/pages/library.rs index 113a920..eee107b 100644 --- a/frontend/src/pages/library.rs +++ b/frontend/src/pages/library.rs @@ -1,3 +1,6 @@ +use std::collections::{HashMap, HashSet}; + +use wasm_bindgen::JsCast; use yew::prelude::*; use yew_router::prelude::*; @@ -17,7 +20,7 @@ pub fn library_page() -> Html { let artists = artists.clone(); let error = error.clone(); wasm_bindgen_futures::spawn_local(async move { - match api::list_artists(200, 0).await { + match api::list_artists(0, 0).await { Ok(a) => artists.set(Some(a)), Err(e) => error.set(Some(e.0)), } @@ -40,6 +43,33 @@ pub fn library_page() -> Html { return html! {
{ "Loading..." }
}; }; + // Pre-compute which artist IDs are first in their letter group (for anchor IDs) + let mut seen_letters = HashSet::new(); + let first_of_letter: HashMap{ "No artists in library. Use Search to add some!" }
} else { +|
to={Route::Artist { id: a.id.to_string() }}>
{ &a.name }
diff --git a/frontend/src/pages/playlists.rs b/frontend/src/pages/playlists.rs
index ecca670..163a93b 100644
--- a/frontend/src/pages/playlists.rs
+++ b/frontend/src/pages/playlists.rs
@@ -17,7 +17,7 @@ pub fn playlists_page() -> Html {
let all_artists = all_artists.clone();
use_effect_with((), move |_| {
wasm_bindgen_futures::spawn_local(async move {
- if let Ok(artists) = api::list_artists(500, 0).await {
+ if let Ok(artists) = api::list_artists(0, 0).await {
all_artists.set(artists);
}
});
diff --git a/frontend/style.css b/frontend/style.css
index f119d19..90181b2 100644
--- a/frontend/style.css
+++ b/frontend/style.css
@@ -445,4 +445,38 @@ tr[draggable="true"]:active { cursor: grabbing; }
.album-art-lg { width: 120px; height: 120px; }
.album-header { flex-direction: column; }
.artist-photo { width: 80px; height: 80px; }
+ .scroll-track { right: 2px; width: 14px; }
+ .scroll-track-letter { font-size: 0.5rem; }
+}
+
+/* Alphabetical scroll track */
+.scroll-track {
+ position: fixed;
+ right: 8px;
+ top: 60px;
+ bottom: 20px;
+ width: 24px;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ align-items: center;
+ z-index: 100;
+}
+.scroll-track-letter {
+ font-size: 1.4rem;
+ font-weight: 600;
+ color: var(--text-muted);
+ cursor: default;
+ padding: 0 2px;
+ line-height: 1;
+ user-select: none;
+ opacity: 0.3;
+}
+.scroll-track-letter.has-artists {
+ color: var(--text-secondary);
+ cursor: pointer;
+ opacity: 1;
+}
+.scroll-track-letter.has-artists:hover {
+ color: var(--accent);
}
diff --git a/src/routes/artists.rs b/src/routes/artists.rs
index bc177bb..a391bd4 100644
--- a/src/routes/artists.rs
+++ b/src/routes/artists.rs
@@ -94,7 +94,11 @@ async fn list_artists(
query: web::Query |