Skip to content

Commit

Permalink
Change color of unavailable song
Browse files Browse the repository at this point in the history
If song is not available/playable, use secondary text color.

Fixes #1300
  • Loading branch information
hrkfdn committed Oct 14, 2023
1 parent a1a9863 commit 76fb357
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/model/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub struct Track {
pub added_at: Option<DateTime<Utc>>,
pub list_index: usize,
pub is_local: bool,
pub is_playable: Option<bool>,
}

impl Track {
Expand Down Expand Up @@ -71,6 +72,7 @@ impl Track {
added_at: None,
list_index: 0,
is_local: track.is_local,
is_playable: track.is_playable,
}
}

Expand Down Expand Up @@ -109,6 +111,7 @@ impl From<&SimplifiedTrack> for Track {
added_at: None,
list_index: 0,
is_local: track.is_local,
is_playable: track.is_playable,
}
}
}
Expand Down Expand Up @@ -149,6 +152,7 @@ impl From<&FullTrack> for Track {
added_at: None,
list_index: 0,
is_local: track.is_local,
is_playable: track.is_playable,
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/ui/listview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ impl<I: ListItem + Clone> View for ListView<I> {
let currently_playing =
item.is_playing(&self.queue) && self.queue.get_current_index() == Some(i);
let is_local = item.track().map(|t| t.is_local).unwrap_or_default();
let is_playable = item.track().map(|t| t.is_playable).unwrap_or_default();

let style = if self.selected == i {
if currently_playing {
Expand All @@ -241,7 +242,7 @@ impl<I: ListItem + Clone> View for ListView<I> {
ColorType::Color(*printer.theme.palette.custom("playing").unwrap()),
ColorType::Color(*printer.theme.palette.custom("playing_bg").unwrap()),
)
} else if is_local {
} else if is_local || is_playable == Some(false) {
ColorStyle::secondary()
} else {
ColorStyle::primary()
Expand Down

0 comments on commit 76fb357

Please sign in to comment.