Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Jan 29, 2025
1 parent 0016c38 commit ddb3328
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion psst-gui/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::sync::Arc;
use std::time::Duration;

use crate::{
data::Alert,
data::{Nav, PlaybackPayload, QueueBehavior, QueueEntry},
ui::find::Find,
};
Expand Down
8 changes: 4 additions & 4 deletions psst-gui/src/data/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod album;
mod album;
mod artist;
pub mod config;
mod ctx;
Expand Down Expand Up @@ -311,7 +311,7 @@ impl AppState {
impl AppState {
pub fn add_alert(&mut self, message: impl Display, style: AlertStyle) {
let alert = Alert {
message: Arc::from(message.to_string()),
message: message.to_string().into(),
style,
id: Alert::fresh_id(),
created_at: Instant::now(),
Expand Down Expand Up @@ -576,8 +576,8 @@ pub struct Alert {
}

impl Alert {
pub fn fresh_id() -> usize {
ALERT_ID.fetch_add(1, Ordering::Relaxed)
fn fresh_id() -> usize {
ALERT_ID.fetch_add(1, Ordering::SeqCst)
}
}

Expand Down
15 changes: 9 additions & 6 deletions psst-gui/src/data/playback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ pub struct NowPlaying {
}

impl NowPlaying {
pub fn cover_image_url(&self, _width: f64, _height: f64) -> Option<String> {
pub fn cover_image_url(&self, width: f64, height: f64) -> Option<&str> {
match &self.item {
Playable::Track(track) => track
.album
.as_ref()
.and_then(|album| album.images.get(0).map(|img| img.url.to_string())),
Playable::Episode(episode) => episode.images.get(0).map(|img| img.url.to_string()),
Playable::Track(track) => {
let album = track.album.as_ref().or(match &self.origin {
PlaybackOrigin::Album(album) => Some(album),
_ => None,
})?;
Some(&album.image(width, height)?.url)
}
Playable::Episode(episode) => Some(&episode.image(width, height)?.url),
}
}

Expand Down
1 change: 0 additions & 1 deletion psst-gui/src/ui/playback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ fn cover_widget(size: f64) -> impl Widget<NowPlaying> {
})
.fix_size(size, size)
.clip(Size::new(size, size).to_rounded_rect(4.0))
.link()
.on_left_click(|ctx, _, _, _| {
ctx.submit_command(SHOW_ARTWORK);
})
Expand Down

0 comments on commit ddb3328

Please sign in to comment.