From 9d01ab32da14066babcac1c5d527bc765f39d13b Mon Sep 17 00:00:00 2001 From: joel-medicala-yral Date: Tue, 24 Dec 2024 23:09:52 +0530 Subject: [PATCH] added linking --- ssr/src/page/icpump/mod.rs | 71 +++++++++++++++++++++++++---------- ssr/src/page/wallet/tokens.rs | 61 +++++++++++++++++++++--------- 2 files changed, 95 insertions(+), 37 deletions(-) diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 04297005..36f8b3a2 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -208,16 +208,18 @@ pub fn TokenCard( ) -> impl IntoView { let show_nsfw = create_rw_signal(false); - 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!( + let share_link = create_rw_signal("".to_string()); + let share_link_coin = format!("/token/info/{}/{}", root, details.user_id); + let symbol = details.token_symbol.clone(); + let share_message = move || { + 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); + details.token_symbol.clone(), + share_link.get(), + ) + }; + let pop_up = create_rw_signal(false); + let base_url = get_host(); view! {
{details.name} - {details.token_symbol} + {symbol}
{details.description} @@ -270,22 +272,35 @@ pub fn TokenCard( - - - + { + if is_airdrop_claimed{ + + view! { + + + + } + }else{ + view! { + + + + } + } + } - +
- + + share_link=format!("{base_url}{}", share_link()) + message=share_message() + show_popup=pop_up + /> } @@ -338,6 +353,24 @@ pub fn ActionButton( } } +#[component] +pub fn ActionButtonLink( + label: String, + children: Children, + #[prop(optional, default = false)] disabled: bool, +) -> impl IntoView { + view! { + + } +} + #[component] pub fn TelegramIcon(href: String, classes: String) -> impl IntoView { view! { diff --git a/ssr/src/page/wallet/tokens.rs b/ssr/src/page/wallet/tokens.rs index b792ced1..71168fbe 100644 --- a/ssr/src/page/wallet/tokens.rs +++ b/ssr/src/page/wallet/tokens.rs @@ -9,7 +9,7 @@ use crate::component::icons::{ }; use crate::component::overlay::PopupOverlay; use crate::component::share_popup::ShareContent; -use crate::page::icpump::ActionButton; +use crate::page::icpump::{ActionButton, ActionButtonLink}; use crate::state::canisters::authenticated_canisters; use crate::utils::host::get_host; use crate::utils::token::icpump::IcpumpTokenInfo; @@ -69,12 +69,12 @@ pub fn TokenView( } } -fn generate_share_link_from_metadata( +pub fn generate_share_link_from_metadata( token_meta_data: &TokenMetadata, user_principal: Principal, ) -> String { format!( - "/token/info/{}/{user_principal}?airdrop_amt=100", + "/token/info/{}/{user_principal}", token_meta_data .root .map(|r| r.to_text()) @@ -124,17 +124,18 @@ pub fn WalletCard( .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!( + let share_link = create_rw_signal("".to_string()); + let share_link_coin = generate_share_link_from_metadata(&token_meta_data, user_principal); + let symbol = token_meta_data.symbol.clone(); + let share_message = move || { + 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); + token_meta_data.symbol.clone(), + share_link.get(), + ) + }; let pop_up = create_rw_signal(false); let base_url = get_host(); - view! {
@@ -148,7 +149,7 @@ pub fn WalletCard(
{token_meta_data.balance.unwrap().humanize_float_truncate_to_dp(2)}
-
{token_meta_data.symbol}
+
{symbol}
@@ -158,11 +159,35 @@ pub fn WalletCard( - - - + { + match token_meta_data.token_owner{ + Some(token_owner) => { + if is_airdrop_claimed{ + let root = root.clone(); + view! { + + + + } + }else{ + view! { + + + + } + } + }, + None => { + view! { + + + + } + } + } + } - + @@ -171,8 +196,8 @@ pub fn WalletCard(