Use Signal instead of MaybeSignal
This commit is contained in:
@ -46,7 +46,7 @@ pub fn ArtistPage() -> impl IntoView {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn ArtistIdProfile(#[prop(into)] id: MaybeSignal<i32>) -> impl IntoView {
|
||||
fn ArtistIdProfile(#[prop(into)] id: Signal<i32>) -> impl IntoView {
|
||||
let artist_info = Resource::new(move || id.get(), move |id| {
|
||||
get_artist_by_id(id)
|
||||
});
|
||||
@ -103,7 +103,7 @@ fn ArtistProfile(artist: Artist) -> impl IntoView {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn TopSongsByArtist(#[prop(into)] artist_id: MaybeSignal<i32>) -> impl IntoView {
|
||||
fn TopSongsByArtist(#[prop(into)] artist_id: Signal<i32>) -> impl IntoView {
|
||||
let top_songs = Resource::new(move || artist_id.get(), |artist_id| async move {
|
||||
let top_songs = top_songs_by_artist(artist_id, Some(10)).await;
|
||||
|
||||
@ -145,7 +145,7 @@ fn TopSongsByArtist(#[prop(into)] artist_id: MaybeSignal<i32>) -> impl IntoView
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn AlbumsByArtist(#[prop(into)] artist_id: MaybeSignal<i32>) -> impl IntoView {
|
||||
fn AlbumsByArtist(#[prop(into)] artist_id: Signal<i32>) -> impl IntoView {
|
||||
use crate::components::dashboard_row::*;
|
||||
|
||||
let albums = Resource::new(move || artist_id.get(), |artist_id| async move {
|
||||
|
@ -91,7 +91,7 @@ fn OwnProfile() -> impl IntoView {
|
||||
|
||||
/// Show a user's profile by ID
|
||||
#[component]
|
||||
fn UserIdProfile(#[prop(into)] id: MaybeSignal<i32>) -> impl IntoView {
|
||||
fn UserIdProfile(#[prop(into)] id: Signal<i32>) -> impl IntoView {
|
||||
let user_info = Resource::new(move || id.get(), move |id| {
|
||||
get_user_by_id(id)
|
||||
});
|
||||
@ -176,7 +176,7 @@ fn UserProfile(user: User) -> impl IntoView {
|
||||
|
||||
/// Show a list of top songs for a user
|
||||
#[component]
|
||||
fn TopSongs(#[prop(into)] user_id: MaybeSignal<i32>) -> impl IntoView {
|
||||
fn TopSongs(#[prop(into)] user_id: Signal<i32>) -> impl IntoView {
|
||||
let top_songs = Resource::new(move || user_id.get(), |user_id| async move {
|
||||
use chrono::{Local, Duration};
|
||||
let now = Local::now();
|
||||
@ -226,7 +226,7 @@ fn TopSongs(#[prop(into)] user_id: MaybeSignal<i32>) -> impl IntoView {
|
||||
|
||||
/// Show a list of recently played songs for a user
|
||||
#[component]
|
||||
fn RecentSongs(#[prop(into)] user_id: MaybeSignal<i32>) -> impl IntoView {
|
||||
fn RecentSongs(#[prop(into)] user_id: Signal<i32>) -> impl IntoView {
|
||||
let recent_songs = Resource::new(move || user_id.get(), |user_id| async move {
|
||||
let recent_songs = recent_songs(user_id, Some(RECENT_SONGS_COUNT)).await;
|
||||
|
||||
@ -267,7 +267,7 @@ fn RecentSongs(#[prop(into)] user_id: MaybeSignal<i32>) -> impl IntoView {
|
||||
|
||||
/// Show a list of top artists for a user
|
||||
#[component]
|
||||
fn TopArtists(#[prop(into)] user_id: MaybeSignal<i32>) -> impl IntoView {
|
||||
fn TopArtists(#[prop(into)] user_id: Signal<i32>) -> impl IntoView {
|
||||
let top_artists = Resource::new(move || user_id.get(), |user_id| async move {
|
||||
use chrono::{Local, Duration};
|
||||
|
||||
|
@ -51,7 +51,7 @@ pub fn SongPage() -> impl IntoView {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn SongDetails(#[prop(into)] id: MaybeSignal<i32>) -> impl IntoView {
|
||||
fn SongDetails(#[prop(into)] id: Signal<i32>) -> impl IntoView {
|
||||
let song_info = Resource::new(move || id.get(), move |id| {
|
||||
get_song_by_id(id)
|
||||
});
|
||||
@ -145,7 +145,7 @@ fn SongOverview(song: SongData) -> impl IntoView {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn SongPlays(#[prop(into)] id: MaybeSignal<i32>) -> impl IntoView {
|
||||
fn SongPlays(#[prop(into)] id: Signal<i32>) -> impl IntoView {
|
||||
let plays = Resource::new(move || id.get(), move |id| songs::get_song_plays(id));
|
||||
|
||||
view! {
|
||||
@ -174,7 +174,7 @@ fn SongPlays(#[prop(into)] id: MaybeSignal<i32>) -> impl IntoView {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn MySongPlays(#[prop(into)] id: MaybeSignal<i32>) -> impl IntoView {
|
||||
fn MySongPlays(#[prop(into)] id: Signal<i32>) -> impl IntoView {
|
||||
let plays = Resource::new(move || id.get(), move |id| songs::get_my_song_plays(id));
|
||||
|
||||
view! {
|
||||
|
Reference in New Issue
Block a user