From 097b1fc491f35d4fa8198cdd16e414ee1eacdb1d Mon Sep 17 00:00:00 2001 From: Ethan Girouard Date: Sun, 6 Oct 2024 15:37:26 -0400 Subject: [PATCH] impl DashboardTile for Songdata --- src/songdata.rs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/songdata.rs b/src/songdata.rs index 99464c8..6851a85 100644 --- a/src/songdata.rs +++ b/src/songdata.rs @@ -1,6 +1,5 @@ use crate::models::{Album, Artist, Song}; use crate::components::dashboard_tile::DashboardTile; -use crate::media_type::MediaType; use time::Date; @@ -63,13 +62,20 @@ impl TryInto for SongData { } } -impl Into for SongData { - fn into(self) -> DashboardTile { - DashboardTile { - image_path: self.image_path, - title: self.title, - media_type: Some(MediaType::Song), - artist: Some(Artist::display_list(&self.artists)), - } +impl DashboardTile for SongData { + fn image_path(&self) -> String { + self.image_path.clone() + } + + fn title(&self) -> String { + self.title.clone() + } + + fn link(&self) -> String { + format!("/song/{}", self.id) + } + + fn description(&self) -> Option { + Some(format!("Song • {}", Artist::display_list(&self.artists))) } }