impl DashboardTile for Songdata
This commit is contained in:
parent
f02a22d805
commit
097b1fc491
@ -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<Song> for SongData {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<DashboardTile> 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<String> {
|
||||
Some(format!("Song • {}", Artist::display_list(&self.artists)))
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user