This commit is contained in:
Connor Johnstone
2026-03-19 15:07:30 -04:00
parent ee60076f70
commit c8e78606b1
10 changed files with 20 additions and 114 deletions

View File

@@ -82,7 +82,7 @@ pub fn album_page(props: &Props) -> Html {
<tbody>
{ for d.tracks.iter().map(|t| {
let duration = t.duration_ms
.map(|ms| fmt_duration(ms))
.map(&fmt_duration)
.unwrap_or_default();
let track_key = t.recording_mbid.clone();

View File

@@ -58,14 +58,11 @@ pub fn artist_page(props: &Props) -> Html {
// Phase 2: if not enriched, fetch full data in background
if needs_enrich && !user_acted.get() {
match api::get_artist_full(&id).await {
Ok(full) => {
// Only apply if user hasn't triggered a refresh
if !user_acted.get() {
detail.set(Some(full));
}
if let Ok(full) = api::get_artist_full(&id).await {
// Only apply if user hasn't triggered a refresh
if !user_acted.get() {
detail.set(Some(full));
}
Err(_) => {} // quick data is still showing, don't overwrite with error
}
}
}
@@ -326,8 +323,7 @@ pub fn artist_page(props: &Props) -> Html {
<td>
if tc > 0 {
<span class="text-sm" style={
if album.watched_tracks >= tc { "color: var(--accent);" }
else if album.watched_tracks > 0 { "color: var(--accent);" }
if album.watched_tracks > 0 { "color: var(--accent);" }
else { "color: var(--text-muted);" }
}>
{ format!("{}/{}", album.watched_tracks, tc) }

View File

@@ -10,7 +10,7 @@ pub fn downloads_page() -> Html {
let items = use_state(|| None::<Vec<DownloadItem>>);
let error = use_state(|| None::<String>);
let message = use_state(|| None::<String>);
let dl_query = use_state(|| String::new());
let dl_query = use_state(String::new);
let refresh = {
let items = items.clone();

View File

@@ -2,7 +2,6 @@ use yew::prelude::*;
use yew_router::prelude::*;
use crate::api;
use crate::components::watch_indicator::WatchIndicator;
use crate::pages::Route;
use crate::types::ArtistListItem;
@@ -73,8 +72,7 @@ pub fn library_page() -> Html {
<td>
if a.total_items > 0 {
<span class="text-sm" style={
if a.total_watched >= a.total_items { "color: var(--accent);" }
else if a.total_watched > 0 { "color: var(--accent);" }
if a.total_watched > 0 { "color: var(--accent);" }
else { "color: var(--text-muted);" }
}>
{ format!("{}/{}", a.total_watched, a.total_items) }

View File

@@ -16,7 +16,7 @@ enum SearchResults {
#[function_component(SearchPage)]
pub fn search_page() -> Html {
let query = use_state(|| String::new());
let query = use_state(String::new);
let search_type = use_state(|| "artist".to_string());
let results = use_state(|| SearchResults::None);
let error = use_state(|| None::<String>);