diff --git a/ssr/src/component/icons/mod.rs b/ssr/src/component/icons/mod.rs index 6346b2ec..d2df8213 100755 --- a/ssr/src/component/icons/mod.rs +++ b/ssr/src/component/icons/mod.rs @@ -2,5 +2,6 @@ pub mod airdrop_icon; pub mod arrow_left_right_icon; pub mod chevron_right_icon; pub mod eye_hide_icon; +pub mod notification_icon; pub mod send_icon; pub mod share_icon; diff --git a/ssr/src/component/icons/notification_icon.rs b/ssr/src/component/icons/notification_icon.rs new file mode 100755 index 00000000..bed1345c --- /dev/null +++ b/ssr/src/component/icons/notification_icon.rs @@ -0,0 +1,51 @@ +use leptos::*; + +#[component] +pub fn NotificationIcon( + #[prop(optional, default = "w-full h-full".to_string())] classes: String, + #[prop(optional)] show_dot: bool, +) -> impl IntoView { + if show_dot { + view! { + + + + + } + } else { + view! { + + + + } + } +} diff --git a/ssr/src/component/share_popup.rs b/ssr/src/component/share_popup.rs index 1300eb1c..9f901026 100644 --- a/ssr/src/component/share_popup.rs +++ b/ssr/src/component/share_popup.rs @@ -10,7 +10,7 @@ use crate::{ }; #[component] -fn ShareContent( +pub fn ShareContent( share_link: String, message: String, #[prop(into)] show_popup: SignalSetter, diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 2eb43d0a..edc5450a 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -12,8 +12,10 @@ use crate::component::icons::chevron_right_icon::ChevronRightIcon; use crate::component::icons::eye_hide_icon::EyeHiddenIcon; use crate::component::icons::send_icon::SendIcon; use crate::component::icons::share_icon::ShareIcon; +use crate::component::share_popup::ShareContent; use crate::component::spinner::FullScreenSpinner; use crate::consts::ICPUMP_LISTING_PAGE_SIZE; +use crate::utils::host::get_host; use crate::utils::token::firestore::init_firebase; use crate::utils::token::firestore::listen_to_documents; use crate::utils::token::icpump::get_paginated_token_list; @@ -146,6 +148,17 @@ pub fn TokenCard( .expect("URL should have at least one segment") .to_string(); + let popup = create_rw_signal(false); + let base_url = get_host(); + + let share_link_s = store_value(format!("{}/{}", details.link, details.user_id)); + let share_message = format!( + "Hey! Check out the token: {} I created on YRAL 👇 {}. I just minted my own token—come see and create yours! 🚀 #YRAL #TokenMinter", + details.token_symbol, + share_link_s(), + ); + let share_message_s = store_value(share_message); + view! {
- - + +
+ + + } } - +use crate::component::overlay::PopupOverlay; #[component] pub fn PageSelector(page: RwSignal, end_of_list: RwSignal) -> impl IntoView { view! { diff --git a/ssr/src/page/profile/tokens.rs b/ssr/src/page/profile/tokens.rs index c05a0b1b..ef59b929 100644 --- a/ssr/src/page/profile/tokens.rs +++ b/ssr/src/page/profile/tokens.rs @@ -5,7 +5,7 @@ use yral_canisters_client::individual_user_template::DeployedCdaoCanisters; use crate::{ component::{bullet_loader::BulletLoader, token_confetti_symbol::TokenConfettiSymbol}, - page::wallet::tokens::TokenTile, + page::wallet::tokens::WalletCard, state::canisters::{authenticated_canisters, unauth_canisters}, utils::token::icpump::IcpumpTokenInfo, }; @@ -84,7 +84,7 @@ pub fn ProfileTokens(user_canister: Principal, user_principal: Principal) -> imp .into_iter() .map(|token| { view! { - diff --git a/ssr/src/page/wallet/mod.rs b/ssr/src/page/wallet/mod.rs index c1a4c02f..9850ce1b 100644 --- a/ssr/src/page/wallet/mod.rs +++ b/ssr/src/page/wallet/mod.rs @@ -1,6 +1,8 @@ pub mod tokens; pub mod transactions; pub mod txn; + +use crate::component::icons::notification_icon::NotificationIcon; use crate::{ component::share_popup::ShareButtonWithFallbackPopup, state::canisters::unauth_canisters, }; @@ -31,22 +33,26 @@ fn ProfileGreeter(details: ProfileDetails, is_own_account: bool) -> impl IntoVie ); view! { -
- {is_own_account - .then(|| { - view! { Welcome! } - })}
- - // TEMP: Workaround for hydration bug until leptos 0.7 +
+
+ Profile picture + + // TEMP: Workaround for hydration bug until leptos 0.7 // class=("md:w-5/12", move || !is_connected()) {details.display_name_or_fallback()} -
-
-
- + + + + + +
} } @@ -105,22 +111,6 @@ pub fn WalletImpl(principal: Principal) -> impl IntoView { let (is_connected, _) = account_connected_reader(); let auth_cans = authenticated_canisters(); - let balance_fetch = create_resource( - move || principal, - move |principal| async move { - let canisters = unauth_canisters(); - let Some(user_canister) = canisters - .get_individual_canister_by_user_principal(principal) - .await? - else { - return Err(ServerFnError::new("Failed to get user canister")); - }; - let user = canisters.individual_user(user_canister).await; - - let bal = user.get_utility_token_balance().await?; - Ok::<_, ServerFnError>(bal.to_string()) - }, - ); let profile_info_res = auth_cans.derive( move || principal, @@ -163,85 +153,49 @@ pub fn WalletImpl(principal: Principal) -> impl IntoView { }, ); view! { -
-
-
- - {move || { - let profile_details = try_or_redirect_opt!(profile_info_res()?); - let is_own_account = try_or_redirect_opt!(is_own_account()?); - Some( - view! { }, - ) - }} - -
-
- - {move || { - let is_own_account = try_or_redirect_opt!(is_own_account() ?); - let balance = try_or_redirect_opt!(balance_fetch() ?); - Some( - view! { - - {if is_own_account { - "Your Coyns Balance" - } else { - "Coyns Balance" - }} - -
{balance}
- }, - ) - }} -
-
+
+ {move || { - let is_own_account = try_or_redirect_opt!(is_own_account() ?); + let profile_details = try_or_redirect_opt!(profile_info_res()?); + let is_own_account = try_or_redirect_opt!(is_own_account()?); Some( - view! { - -
-
- -
+ view! { }, + ) + }} + + + {move || { + let is_own_account = try_or_redirect_opt!(is_own_account() ?); + Some( + view! { + +
+
+
- +
+
+ }, + ) + }} +
+
+
+
All Tokens
+ + {move || { + let canister_id = try_or_redirect_opt!(canister_id() ?); + Some( + view! { + }, ) }} -
- - {move || { - let is_own_account = try_or_redirect_opt!(is_own_account()?); - Some( - view! { -
- - {if is_own_account { "My Tokens" } else { "Tokens" }} - -
- }, - ) - }} -
-
- - {move || { - let canister_id = try_or_redirect_opt!(canister_id() ?); - Some( - view! { - - }, - ) - }} - -
diff --git a/ssr/src/page/wallet/tokens.rs b/ssr/src/page/wallet/tokens.rs index 41c462bd..0866af95 100644 --- a/ssr/src/page/wallet/tokens.rs +++ b/ssr/src/page/wallet/tokens.rs @@ -2,9 +2,17 @@ use candid::Principal; use yral_canisters_common::cursored_data::token_roots::TokenRootList; use yral_canisters_common::utils::token::{RootType, TokenMetadata}; -use crate::page::wallet::ShareButtonWithFallbackPopup; +use crate::component::icons::{ + airdrop_icon::AirdropIcon, arrow_left_right_icon::ArrowLeftRightIcon, + chevron_right_icon::ChevronRightIcon, send_icon::SendIcon, share_icon::ShareIcon, +}; +use crate::component::overlay::PopupOverlay; +use crate::component::share_popup::ShareContent; +use crate::page::icpump::ActionButton; +use crate::utils::host::get_host; use crate::utils::token::icpump::IcpumpTokenInfo; use crate::{component::infinite_scroller::InfiniteScroller, state::canisters::unauth_canisters}; + use leptos::*; use leptos_icons::*; @@ -37,12 +45,7 @@ pub fn TokenView( {move || { info.map(|info| { - view! { - - } + view! { } }) }} @@ -63,73 +66,9 @@ fn generate_share_link_from_metadata( ) } -#[component] -pub fn TokenTile(user_principal: Principal, token_meta_data: TokenMetadata) -> impl IntoView { - let share_link = generate_share_link_from_metadata(&token_meta_data, user_principal); - let share_link_s = store_value(share_link); - let share_message = format!( - "Hey! Check out the token: {} I created on YRAL 👇 {}. I just minted my own token—come see and create yours! 🚀 #YRAL #TokenMinter", - token_meta_data.symbol, - share_link_s(), - ); - let share_message_s = store_value(share_message); - let info = token_meta_data; - view! { - - } -} - #[component] pub fn TokenList(user_principal: Principal, user_canister: Principal) -> impl IntoView { - let canisters = unauth_canisters(); + let canisters: yral_canisters_common::Canisters = unauth_canisters(); let provider = TokenRootList { canisters, @@ -144,10 +83,78 @@ pub fn TokenList(user_principal: Principal, user_canister: Principal) -> impl In provider fetch_count=10 children=move |token_root, _ref| { - view! { } + view! { + + } } />
} } + +#[component] +pub fn WalletCard(user_principal: Principal, token_meta_data: TokenMetadata) -> impl IntoView { + let root: String = token_meta_data + .root + .map(|r| r.to_text()) + .unwrap_or(token_meta_data.name.to_lowercase()); + + let share_link = generate_share_link_from_metadata(&token_meta_data, user_principal); + let share_link_s = store_value(share_link); + let share_message = format!( + "Hey! Check out the token: {} I created on YRAL 👇 {}. I just minted my own token—come see and create yours! 🚀 #YRAL #TokenMinter", + token_meta_data.symbol, + share_link_s(), + ); + let share_message_s = store_value(share_message); + let pop_up = create_rw_signal(false); + let base_url = get_host(); + view! { +
+
+
+ token_meta_data.name.clone() +
{token_meta_data.name}
+
+
+
{token_meta_data.balance.unwrap().humanize_float_truncate_to_dp(2)}
+
{token_meta_data.symbol}
+
+
+
+ + + + + + + + + + + + + + + +
+ + + + +
+ } +}