From 94880ead7cac612fed3f5f81f7a1941b7fa0b189 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Wed, 11 Dec 2024 03:45:35 +0000 Subject: [PATCH] Added related artists component --- src/pages/artist.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/pages/artist.rs b/src/pages/artist.rs index 6c42640..349b634 100644 --- a/src/pages/artist.rs +++ b/src/pages/artist.rs @@ -117,3 +117,37 @@ fn TopSongsByArtist(#[prop(into)] artist_id: MaybeSignal) -> impl IntoView } } + +#[component] +fn RelatedArtists(#[prop(into)] artist_id: MaybeSignal) -> impl IntoView { + let related_artists = create_resource(move || artist_id.get(), |artist_id| async move { + get_related_artists(artist_id).await + }); + + view! { +

"Related Artists"

+ } + > + {e.to_string()}

}) + .collect_view() + } + } + > + {move || related_artists.get().map(|related_artists| { + related_artists.map(|artists| { + let tiles = artists.into_iter().map(|artist| { + Box::new(artist) as Box + }).collect::>(); + + DashboardRow::new("Related Artists", tiles) + }) + })} +
+
+ } +}