From 837dd5ea3c8ca57190fba1409c03e2a2b95aad7a Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Wed, 11 Dec 2024 03:45:15 +0000 Subject: [PATCH] Added top songs component that shows the top songs by an artist --- src/pages/artist.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/pages/artist.rs b/src/pages/artist.rs index b7ff17a..6c42640 100644 --- a/src/pages/artist.rs +++ b/src/pages/artist.rs @@ -87,3 +87,33 @@ fn ArtistDetails(artist: Artist) -> impl IntoView { } } + +#[component] +fn TopSongsByArtist(#[prop(into)] artist_id: MaybeSignal) -> impl IntoView { + let top_songs = create_resource(move || artist_id.get(), |artist_id| async move { + top_songs_by_artist(artist_id, Some(10)).await + }); + + view! { +

"Top Songs"

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

}) + .collect_view() + } + } + > + {move || top_songs.get().map(|top_songs| { + top_songs.map(|top_songs| { + view! { } + }) + })} +
+
+ } +}