From cf74a54aea31db5e17553e3a5a813dd3b18c0405 Mon Sep 17 00:00:00 2001 From: harsh-mn-yral Date: Mon, 9 Dec 2024 15:23:37 +0530 Subject: [PATCH 01/22] icons --- ssr/src/component/icons/airdrop_icon.rs | 46 +++++++++++++++++++ .../component/icons/arrow_left_right_icon.rs | 33 +++++++++++++ ssr/src/component/icons/chevron_right_icon.rs | 20 ++++++++ ssr/src/component/icons/eye_hide_icon.rs | 24 ++++++++++ ssr/src/component/icons/mod.rs | 7 +++ ssr/src/component/icons/send_icon.rs | 36 +++++++++++++++ ssr/src/component/icons/share_icon.rs | 46 +++++++++++++++++++ 7 files changed, 212 insertions(+) create mode 100755 ssr/src/component/icons/airdrop_icon.rs create mode 100755 ssr/src/component/icons/arrow_left_right_icon.rs create mode 100755 ssr/src/component/icons/chevron_right_icon.rs create mode 100755 ssr/src/component/icons/eye_hide_icon.rs create mode 100755 ssr/src/component/icons/mod.rs create mode 100755 ssr/src/component/icons/send_icon.rs create mode 100755 ssr/src/component/icons/share_icon.rs diff --git a/ssr/src/component/icons/airdrop_icon.rs b/ssr/src/component/icons/airdrop_icon.rs new file mode 100755 index 00000000..2512702b --- /dev/null +++ b/ssr/src/component/icons/airdrop_icon.rs @@ -0,0 +1,46 @@ +use leptos::*; + +#[component] +pub fn AirdropIcon( + #[prop(optional, default = "w-full h-full".to_string())] classes: String, +) -> impl IntoView { + view! { + + + + + + + + + + + + + + } +} diff --git a/ssr/src/component/icons/arrow_left_right_icon.rs b/ssr/src/component/icons/arrow_left_right_icon.rs new file mode 100755 index 00000000..afdc932e --- /dev/null +++ b/ssr/src/component/icons/arrow_left_right_icon.rs @@ -0,0 +1,33 @@ +use leptos::*; + +#[component] +pub fn ArrowLeftRightIcon( + #[prop(optional, default = "w-full h-full".to_string())] classes: String, +) -> impl IntoView { + view! { + + + + + + + + + } +} diff --git a/ssr/src/component/icons/chevron_right_icon.rs b/ssr/src/component/icons/chevron_right_icon.rs new file mode 100755 index 00000000..e045dc76 --- /dev/null +++ b/ssr/src/component/icons/chevron_right_icon.rs @@ -0,0 +1,20 @@ +use leptos::*; + +#[component] +pub fn ChevronRightIcon( + #[prop(optional, default = "w-full h-full".to_string())] classes: String, +) -> impl IntoView { + view! { + + + + } +} diff --git a/ssr/src/component/icons/eye_hide_icon.rs b/ssr/src/component/icons/eye_hide_icon.rs new file mode 100755 index 00000000..8b772477 --- /dev/null +++ b/ssr/src/component/icons/eye_hide_icon.rs @@ -0,0 +1,24 @@ +use leptos::*; + +#[component] +pub fn EyeHiddenIcon( + #[prop(optional, default = "w-full h-full".to_string())] classes: String, +) -> impl IntoView { + view! { + + + + + } +} diff --git a/ssr/src/component/icons/mod.rs b/ssr/src/component/icons/mod.rs new file mode 100755 index 00000000..bbd82c09 --- /dev/null +++ b/ssr/src/component/icons/mod.rs @@ -0,0 +1,7 @@ +pub mod airdrop_icon; +pub mod arrow_left_right_icon; +pub mod arrow_right_long_icon; +pub mod chevron_left_icon; +pub mod eye_hide_icon; +pub mod send_icon; +pub mod share_icon; diff --git a/ssr/src/component/icons/send_icon.rs b/ssr/src/component/icons/send_icon.rs new file mode 100755 index 00000000..fbed9d7c --- /dev/null +++ b/ssr/src/component/icons/send_icon.rs @@ -0,0 +1,36 @@ +use leptos::*; + +#[component] +pub fn SendIcon( + #[prop(optional, default = "w-full h-full".to_string())] classes: String, + #[prop(optional)] filled: bool, +) -> impl IntoView { + view! { + + + + + + + + + } +} diff --git a/ssr/src/component/icons/share_icon.rs b/ssr/src/component/icons/share_icon.rs new file mode 100755 index 00000000..fda5a53e --- /dev/null +++ b/ssr/src/component/icons/share_icon.rs @@ -0,0 +1,46 @@ +use leptos::*; + +#[component] +pub fn ShareIcon( + #[prop(optional, default = "w-full h-full".to_string())] classes: String, +) -> impl IntoView { + view! { + + + + + + + + + + + + + + } +} From 2a0004afa4579e0015d17fe7b445c24a209255c7 Mon Sep 17 00:00:00 2001 From: harsh-mn-yral Date: Mon, 9 Dec 2024 15:23:49 +0530 Subject: [PATCH 02/22] button --- ssr/src/component/buttons.rs | 133 +++++++++++++++++++++++++++++++++++ ssr/src/component/mod.rs | 1 + 2 files changed, 134 insertions(+) create mode 100644 ssr/src/component/buttons.rs diff --git a/ssr/src/component/buttons.rs b/ssr/src/component/buttons.rs new file mode 100644 index 00000000..fcf1cfbe --- /dev/null +++ b/ssr/src/component/buttons.rs @@ -0,0 +1,133 @@ +use leptos::*; + +#[component] +pub fn Button( + children: Children, + on_click: impl Fn() + 'static, + #[prop(optional)] classes: String, + #[prop(optional)] alt_style: Signal, + #[prop(optional)] disabled: Signal, +) -> impl IntoView { + let on_click = move |_| on_click(); + view! { + + } +} + +#[component] +pub fn LinkButton( + children: Children, + href: String, + #[prop(optional)] classes: String, + #[prop(optional)] alt_style: Signal, + #[prop(optional)] disabled: Signal, +) -> impl IntoView { + view! { + + {children()} + + } +} + +#[component] +pub fn SecondaryLinkButton( + children: Children, + href: String, + #[prop(optional)] classes: String, + #[prop(optional)] alt_style: Signal, +) -> impl IntoView { + view! { + + {children()} + + } +} + +#[component] +pub fn SecondaryButton( + children: Children, + disabled: Signal, + alt_style: Signal, + classes: String, + on_click: impl Fn() + 'static, +) -> impl IntoView { + let on_click = move |_| on_click(); + view! { + + } +} \ No newline at end of file diff --git a/ssr/src/component/mod.rs b/ssr/src/component/mod.rs index 38bd66c1..e95fb22b 100644 --- a/ssr/src/component/mod.rs +++ b/ssr/src/component/mod.rs @@ -1,6 +1,7 @@ pub mod airdrop_logo; pub mod auth_providers; pub mod back_btn; +pub mod buttons; pub mod base_route; pub mod bullet_loader; pub mod canisters_prov; From 309786d2fb42c341ae95aaa973593e4f482dc9ef Mon Sep 17 00:00:00 2001 From: harsh-mn-yral Date: Mon, 9 Dec 2024 15:25:34 +0530 Subject: [PATCH 03/22] add mod --- ssr/src/component/icons/mod.rs | 3 +-- ssr/src/component/mod.rs | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ssr/src/component/icons/mod.rs b/ssr/src/component/icons/mod.rs index bbd82c09..6346b2ec 100755 --- a/ssr/src/component/icons/mod.rs +++ b/ssr/src/component/icons/mod.rs @@ -1,7 +1,6 @@ pub mod airdrop_icon; pub mod arrow_left_right_icon; -pub mod arrow_right_long_icon; -pub mod chevron_left_icon; +pub mod chevron_right_icon; pub mod eye_hide_icon; pub mod send_icon; pub mod share_icon; diff --git a/ssr/src/component/mod.rs b/ssr/src/component/mod.rs index e95fb22b..197cf18c 100644 --- a/ssr/src/component/mod.rs +++ b/ssr/src/component/mod.rs @@ -12,6 +12,7 @@ pub mod dashbox; pub mod feed_popup; pub mod hn_icons; pub mod ic_symbol; +pub mod icons; pub mod infinite_scroller; pub mod loading; pub mod login_modal; From f10039121303cff971fa578f52468ef9f45410d0 Mon Sep 17 00:00:00 2001 From: harsh-mn-yral Date: Mon, 9 Dec 2024 15:25:38 +0530 Subject: [PATCH 04/22] update style --- ssr/src/page/icpump/mod.rs | 392 ++++++++++++++++++++++++------------- 1 file changed, 252 insertions(+), 140 deletions(-) diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 22f3d0dd..2c0a6d5f 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -3,8 +3,14 @@ use std::collections::VecDeque; use futures::StreamExt; use leptos::*; -use leptos_icons::*; +use crate::component::buttons::LinkButton; +use crate::component::icons::airdrop_icon::AirdropIcon; +use crate::component::icons::arrow_left_right_icon::ArrowLeftRightIcon; +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::spinner::FullScreenSpinner; use crate::consts::ICPUMP_LISTING_PAGE_SIZE; use crate::utils::token::firestore::init_firebase; @@ -14,67 +20,6 @@ use crate::utils::token::icpump::TokenListItem; pub mod ai; -#[component] -pub fn TokenListing( - details: TokenListItem, - #[prop(optional, default = false)] is_new_token: bool, -) -> impl IntoView { - view! { - -
- details.token_name.clone() - -
- -
-
-
-
-
- - {details.token_name} - - - "$" - {details.token_symbol} - -
-
- {details.description} -
-
- "Created by: "{details.user_id} - -
- - {details.formatted_created_at} - -
-
- } -} - #[component] pub fn ICPumpListing() -> impl IntoView { let page = create_rw_signal(1); @@ -110,98 +55,265 @@ pub fn ICPumpListing() -> impl IntoView { }); view! { -
- - {move || { - let _ = act - .get() - .map(|res| { - if res.len() < ICPUMP_LISTING_PAGE_SIZE { - end_of_list.set(true); - } - update!( - move |token_list, cache| { + + {move || { + let _ = act + .get() + .map(|res| { + if res.len() < ICPUMP_LISTING_PAGE_SIZE { + end_of_list.set(true); + } + update!( + move |token_list, cache| { *token_list = res.clone(); cache.insert(page.get_untracked(), res.clone()); } - ); - }); - view! { -
- } - } - /> - } - } - /> -
- -
- - {page} - -
- } - }} -
-
+ ); + }); + view! { +
+ } + } + /> + } + } + /> +
+
+ +
+ } + }} + } } #[component] pub fn ICPumpLanding() -> impl IntoView { view! { -
-
- - -
- - [telegram] - +
+
+
+
Follow us:
+
+ + + +
+ + "Create a new coin" + +
+
+
-
- + } +} + +#[component] +pub fn TokenCard( + details: TokenListItem, + #[prop(optional, default = false)] is_new_token: bool, +) -> impl IntoView { + let show_nsfw = create_rw_signal(false); + + view! { +
+
+
+ + + + details.token_name.clone() +
+
+
+ {details.name} + {details.token_symbol} +
+ + {details.description} + +
+ "Created by" {details.user_id} + {details.formatted_created_at} +
-
- +
+ + + + + + + + + + + + + + +
} } + +#[component] +pub fn PageSelector(page: RwSignal, end_of_list: RwSignal) -> impl IntoView { + view! { +
+ +
{page}
+ +
+ } +} + +#[component] +pub fn ActionButton(href: String, label: String, children: Children) -> impl IntoView { + view! { + +
{children()}
+ +
{label}
+
+ } +} + +#[component] +pub fn TelegramIcon(href: String, classes: String) -> impl IntoView { + view! { + + + + + + + + } +} + +#[component] +pub fn XIcon(href: String, classes: String) -> impl IntoView { + view! { + + + + + + + + + } +} + +#[component] +pub fn InstagramIcon(href: String, classes: String) -> impl IntoView { + view! { + + + + + + + + + } +} \ No newline at end of file From 78a843f102bfc6d76f04d3e4833cbac0bf6e2aea Mon Sep 17 00:00:00 2001 From: harsh-mn-yral Date: Mon, 9 Dec 2024 15:28:01 +0530 Subject: [PATCH 05/22] lint --- ssr/src/component/buttons.rs | 2 +- ssr/src/component/mod.rs | 2 +- ssr/src/page/icpump/mod.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ssr/src/component/buttons.rs b/ssr/src/component/buttons.rs index fcf1cfbe..0798db76 100644 --- a/ssr/src/component/buttons.rs +++ b/ssr/src/component/buttons.rs @@ -130,4 +130,4 @@ pub fn SecondaryButton( {children()} } -} \ No newline at end of file +} diff --git a/ssr/src/component/mod.rs b/ssr/src/component/mod.rs index 197cf18c..61b72338 100644 --- a/ssr/src/component/mod.rs +++ b/ssr/src/component/mod.rs @@ -1,9 +1,9 @@ pub mod airdrop_logo; pub mod auth_providers; pub mod back_btn; -pub mod buttons; pub mod base_route; pub mod bullet_loader; +pub mod buttons; pub mod canisters_prov; pub mod coming_soon; pub mod connect; diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 2c0a6d5f..5b1c7e62 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -316,4 +316,4 @@ pub fn InstagramIcon(href: String, classes: String) -> impl IntoView { } -} \ No newline at end of file +} From 636519aaae8d9ff60be4d58c0e2993dfa5ef2a40 Mon Sep 17 00:00:00 2001 From: joel-medicala-yral Date: Wed, 11 Dec 2024 10:51:08 +0530 Subject: [PATCH 06/22] integrated links --- ssr/src/page/icpump/mod.rs | 142 ++++++++++++++++++++++++++++++++----- 1 file changed, 123 insertions(+), 19 deletions(-) diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 5b1c7e62..3e968933 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -1,8 +1,14 @@ use std::collections::HashMap; use std::collections::VecDeque; +use candid::Principal; +use codee::string::FromToStringCodec; use futures::StreamExt; use leptos::*; +use leptos_use::use_cookie; +use yral_canisters_client::sns_root::GetSnsCanistersSummaryRequest; +use yral_canisters_client::sns_root::ListSnsCanistersArg; +use yral_canisters_common::Canisters; use crate::component::buttons::LinkButton; use crate::component::icons::airdrop_icon::AirdropIcon; @@ -13,6 +19,8 @@ use crate::component::icons::send_icon::SendIcon; use crate::component::icons::share_icon::ShareIcon; use crate::component::spinner::FullScreenSpinner; use crate::consts::ICPUMP_LISTING_PAGE_SIZE; +use crate::consts::USER_PRINCIPAL_STORE; +use crate::state::canisters::unauth_canisters; use crate::utils::token::firestore::init_firebase; use crate::utils::token::firestore::listen_to_documents; use crate::utils::token::icpump::get_paginated_token_list; @@ -20,34 +28,119 @@ use crate::utils::token::icpump::TokenListItem; pub mod ai; +async fn is_airdrop_claimed( + root: Principal, + cans: Canisters, + user_principal: Principal, +) -> bool { + let root = cans.sns_root(root).await; + let governance = root + .list_sns_canisters(ListSnsCanistersArg {}) + .await + .unwrap() + .governance + .unwrap(); + + let token_owner_canister = root + .get_sns_canisters_summary(GetSnsCanistersSummaryRequest { + update_canister_list: Some(true), + }) + .await + .unwrap() + .root + .unwrap() + .status + .unwrap() + .settings + .controllers + .into_iter() + .filter(|c| !(c == &governance || c.to_text().ends_with("-cai"))) + .collect::>()[0]; + let individual_cans = cans.individual_user(token_owner_canister).await; + + individual_cans + .deployed_cdao_canisters() + .await + .unwrap() + .into_iter() + .any(|cdao| { + cdao.airdrop_info + .principals_who_successfully_claimed + .into_iter() + .any(|claimed| claimed.0 == user_principal) + }) +} #[component] pub fn ICPumpListing() -> impl IntoView { let page = create_rw_signal(1); - let token_list: RwSignal> = create_rw_signal(vec![]); + let token_list: RwSignal> = create_rw_signal(vec![]); let end_of_list = create_rw_signal(false); - let cache = create_rw_signal(HashMap::>::new()); - let new_token_list: RwSignal> = create_rw_signal(VecDeque::new()); + let cache = create_rw_signal(HashMap::>::new()); + let new_token_list: RwSignal> = + create_rw_signal(VecDeque::new()); let act = create_resource(page, move |page| async move { // reset new_token_list + let cans = unauth_canisters(); new_token_list.set(VecDeque::new()); if let Some(cached) = cache.with_untracked(|c| c.get(&page).cloned()) { return cached.clone(); } - get_paginated_token_list(page as u32).await.unwrap() + // weird janky root canister creator fetching + let (user_principal, _) = use_cookie::(USER_PRINCIPAL_STORE); + + let mut ret = Vec::new(); + for details in get_paginated_token_list(page as u32) + .await + .unwrap() + .into_iter() + { + let root = Principal::from_text( + details + .link + .trim_end_matches('/') + .split('/') + .last() + .expect("URL should have at least one segment"), + ) + .unwrap(); + let is_airdrop_claimed = + is_airdrop_claimed(root, cans.clone(), user_principal.get_untracked().unwrap()) + .await; + ret.push((details, is_airdrop_claimed)); + } + ret }); create_effect(move |_| { spawn_local(async move { let (_app, firestore) = init_firebase(); let mut stream = listen_to_documents(&firestore); + let cans = unauth_canisters(); + let (user_principal, _) = + use_cookie::(USER_PRINCIPAL_STORE); while let Some(doc) = stream.next().await { // push each item in doc to new_token_list for item in doc { + let root = Principal::from_text( + item.link + .trim_end_matches('/') + .split('/') + .last() + .expect("URL should have at least one segment"), + ) + .unwrap(); + let is_airdrop_claimed = is_airdrop_claimed( + root, + cans.clone(), + user_principal.get_untracked().unwrap(), + ) + .await; + new_token_list.update(move |list| { - list.push_front(item.clone()); + list.push_front((item.clone(), is_airdrop_claimed)); }); } } @@ -74,16 +167,16 @@ pub fn ICPumpListing() -> impl IntoView {
} + key=|(t, _)| t.token_symbol.clone() + children=move |(token, is_airdrop_claimed)| { + view! { } } /> } + key=|(t, _)| t.token_symbol.clone() + children=move |(token, is_airdrop_claimed)| { + view! { } } />
@@ -136,9 +229,15 @@ pub fn ICPumpLanding() -> impl IntoView { pub fn TokenCard( details: TokenListItem, #[prop(optional, default = false)] is_new_token: bool, + #[prop(optional, default = true)] _is_airdrop_claimed: bool, ) -> impl IntoView { let show_nsfw = create_rw_signal(false); - + let root = details + .link + .trim_end_matches('/') + .split('/') + .last() + .expect("URL should have at least one segment"); view! {
- + - + - + - + @@ -230,11 +329,16 @@ pub fn PageSelector(page: RwSignal, end_of_list: RwSignal) -> impl In } #[component] -pub fn ActionButton(href: String, label: String, children: Children) -> impl IntoView { +pub fn ActionButton( + href: String, + label: String, + children: Children, + #[prop(optional, default = false)] disabled: bool, +) -> impl IntoView { view! {
{children()}
From 79a89206c6b1597b5817946e6158e90e921bec98 Mon Sep 17 00:00:00 2001 From: joel-medicala-yral Date: Wed, 11 Dec 2024 11:20:18 +0530 Subject: [PATCH 07/22] removed airdrop related stuff --- ssr/src/page/icpump/mod.rs | 119 ++++--------------------------------- 1 file changed, 12 insertions(+), 107 deletions(-) diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 3e968933..42245c36 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -1,14 +1,8 @@ use std::collections::HashMap; use std::collections::VecDeque; -use candid::Principal; -use codee::string::FromToStringCodec; use futures::StreamExt; use leptos::*; -use leptos_use::use_cookie; -use yral_canisters_client::sns_root::GetSnsCanistersSummaryRequest; -use yral_canisters_client::sns_root::ListSnsCanistersArg; -use yral_canisters_common::Canisters; use crate::component::buttons::LinkButton; use crate::component::icons::airdrop_icon::AirdropIcon; @@ -19,8 +13,6 @@ use crate::component::icons::send_icon::SendIcon; use crate::component::icons::share_icon::ShareIcon; use crate::component::spinner::FullScreenSpinner; use crate::consts::ICPUMP_LISTING_PAGE_SIZE; -use crate::consts::USER_PRINCIPAL_STORE; -use crate::state::canisters::unauth_canisters; use crate::utils::token::firestore::init_firebase; use crate::utils::token::firestore::listen_to_documents; use crate::utils::token::icpump::get_paginated_token_list; @@ -28,119 +20,32 @@ use crate::utils::token::icpump::TokenListItem; pub mod ai; -async fn is_airdrop_claimed( - root: Principal, - cans: Canisters, - user_principal: Principal, -) -> bool { - let root = cans.sns_root(root).await; - let governance = root - .list_sns_canisters(ListSnsCanistersArg {}) - .await - .unwrap() - .governance - .unwrap(); - - let token_owner_canister = root - .get_sns_canisters_summary(GetSnsCanistersSummaryRequest { - update_canister_list: Some(true), - }) - .await - .unwrap() - .root - .unwrap() - .status - .unwrap() - .settings - .controllers - .into_iter() - .filter(|c| !(c == &governance || c.to_text().ends_with("-cai"))) - .collect::>()[0]; - let individual_cans = cans.individual_user(token_owner_canister).await; - - individual_cans - .deployed_cdao_canisters() - .await - .unwrap() - .into_iter() - .any(|cdao| { - cdao.airdrop_info - .principals_who_successfully_claimed - .into_iter() - .any(|claimed| claimed.0 == user_principal) - }) -} #[component] pub fn ICPumpListing() -> impl IntoView { let page = create_rw_signal(1); - let token_list: RwSignal> = create_rw_signal(vec![]); + let token_list: RwSignal> = create_rw_signal(vec![]); let end_of_list = create_rw_signal(false); - let cache = create_rw_signal(HashMap::>::new()); - let new_token_list: RwSignal> = - create_rw_signal(VecDeque::new()); + let cache = create_rw_signal(HashMap::>::new()); + let new_token_list: RwSignal> = create_rw_signal(VecDeque::new()); let act = create_resource(page, move |page| async move { - // reset new_token_list - let cans = unauth_canisters(); new_token_list.set(VecDeque::new()); if let Some(cached) = cache.with_untracked(|c| c.get(&page).cloned()) { return cached.clone(); } - - // weird janky root canister creator fetching - let (user_principal, _) = use_cookie::(USER_PRINCIPAL_STORE); - - let mut ret = Vec::new(); - for details in get_paginated_token_list(page as u32) - .await - .unwrap() - .into_iter() - { - let root = Principal::from_text( - details - .link - .trim_end_matches('/') - .split('/') - .last() - .expect("URL should have at least one segment"), - ) - .unwrap(); - let is_airdrop_claimed = - is_airdrop_claimed(root, cans.clone(), user_principal.get_untracked().unwrap()) - .await; - ret.push((details, is_airdrop_claimed)); - } - ret + get_paginated_token_list(page as u32).await.unwrap() }); create_effect(move |_| { spawn_local(async move { let (_app, firestore) = init_firebase(); let mut stream = listen_to_documents(&firestore); - let cans = unauth_canisters(); - let (user_principal, _) = - use_cookie::(USER_PRINCIPAL_STORE); while let Some(doc) = stream.next().await { // push each item in doc to new_token_list for item in doc { - let root = Principal::from_text( - item.link - .trim_end_matches('/') - .split('/') - .last() - .expect("URL should have at least one segment"), - ) - .unwrap(); - let is_airdrop_claimed = is_airdrop_claimed( - root, - cans.clone(), - user_principal.get_untracked().unwrap(), - ) - .await; - new_token_list.update(move |list| { - list.push_front((item.clone(), is_airdrop_claimed)); + list.push_front(item.clone()); }); } } @@ -167,16 +72,16 @@ pub fn ICPumpListing() -> impl IntoView {
} + key=|t| t.token_symbol.clone() + children=move |token| { + view! { } } /> } + key=|t| t.token_symbol.clone() + children=move |token| { + view! { } } />
@@ -289,7 +194,7 @@ pub fn TokenCard( - + From c1b7c0085419e2544b3fb1f15b04cf9ad72779d1 Mon Sep 17 00:00:00 2001 From: joel-medicala-yral Date: Wed, 11 Dec 2024 11:41:13 +0530 Subject: [PATCH 08/22] fixed disabled colors --- ssr/src/page/icpump/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 42245c36..072d03b7 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -243,7 +243,7 @@ pub fn ActionButton( view! {
{children()}
From 7a416a03d9dd297fb61b0bf33e614a619b31d234 Mon Sep 17 00:00:00 2001 From: joel-medicala-yral Date: Wed, 11 Dec 2024 12:05:50 +0530 Subject: [PATCH 09/22] reverted styling --- ssr/src/page/icpump/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 072d03b7..baa80d0d 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -243,7 +243,7 @@ pub fn ActionButton( view! {
{children()}
From fb692dcb9d4fda281ea5d088c49d0e8734264797 Mon Sep 17 00:00:00 2001 From: joel-medicala-yral Date: Wed, 11 Dec 2024 14:00:33 +0530 Subject: [PATCH 10/22] added new button component like ActionButton but with handlers --- ssr/src/page/icpump/mod.rs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index baa80d0d..481afa88 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -17,6 +17,7 @@ use crate::utils::token::firestore::init_firebase; use crate::utils::token::firestore::listen_to_documents; use crate::utils::token::icpump::get_paginated_token_list; use crate::utils::token::icpump::TokenListItem; +use crate::utils::web::copy_to_clipboard; pub mod ai; @@ -142,7 +143,8 @@ pub fn TokenCard( .trim_end_matches('/') .split('/') .last() - .expect("URL should have at least one segment"); + .expect("URL should have at least one segment") + .to_string(); // Convert to owned String view! {
- + - + @@ -252,6 +254,24 @@ pub fn ActionButton( } } +#[component] +pub fn ActionButtonWithHandler( + label: String, + children: Children, + #[prop(optional, default = false)] disabled: bool, + on_click: impl Fn() + 'static, +) -> impl IntoView { + view! { + + } +} #[component] pub fn TelegramIcon(href: String, classes: String) -> impl IntoView { view! { From 8e8bbc2ee91a6a5817d17b5ac31e002533b2da4f Mon Sep 17 00:00:00 2001 From: joel-medicala-yral Date: Wed, 11 Dec 2024 15:08:13 +0530 Subject: [PATCH 11/22] replaced icons with more pragmatic leptos::icon_gen macro --- ssr/src/component/icons/airdrop_icon.rs | 24 ++++++------------ .../component/icons/arrow_left_right_icon.rs | 24 ++++++------------ ssr/src/component/icons/chevron_right_icon.rs | 24 ++++++------------ ssr/src/component/icons/send_icon.rs | 25 ++++++------------- ssr/src/component/icons/share_icon.rs | 24 ++++++------------ ssr/src/page/icpump/mod.rs | 17 +++++++------ 6 files changed, 44 insertions(+), 94 deletions(-) diff --git a/ssr/src/component/icons/airdrop_icon.rs b/ssr/src/component/icons/airdrop_icon.rs index 2512702b..ac923889 100755 --- a/ssr/src/component/icons/airdrop_icon.rs +++ b/ssr/src/component/icons/airdrop_icon.rs @@ -1,17 +1,9 @@ -use leptos::*; +use crate::utils::icon::icon_gen; -#[component] -pub fn AirdropIcon( - #[prop(optional, default = "w-full h-full".to_string())] classes: String, -) -> impl IntoView { - view! { - - - - - } -} + "### +); diff --git a/ssr/src/component/icons/arrow_left_right_icon.rs b/ssr/src/component/icons/arrow_left_right_icon.rs index afdc932e..e0ceb6fd 100755 --- a/ssr/src/component/icons/arrow_left_right_icon.rs +++ b/ssr/src/component/icons/arrow_left_right_icon.rs @@ -1,17 +1,9 @@ -use leptos::*; +use crate::utils::icon::icon_gen; -#[component] -pub fn ArrowLeftRightIcon( - #[prop(optional, default = "w-full h-full".to_string())] classes: String, -) -> impl IntoView { - view! { - - - - - } -} + "### +); diff --git a/ssr/src/component/icons/chevron_right_icon.rs b/ssr/src/component/icons/chevron_right_icon.rs index e045dc76..6024a15c 100755 --- a/ssr/src/component/icons/chevron_right_icon.rs +++ b/ssr/src/component/icons/chevron_right_icon.rs @@ -1,20 +1,10 @@ -use leptos::*; +use crate::utils::icon::icon_gen; -#[component] -pub fn ChevronRightIcon( - #[prop(optional, default = "w-full h-full".to_string())] classes: String, -) -> impl IntoView { - view! { - - - - } -} + />"### +); diff --git a/ssr/src/component/icons/send_icon.rs b/ssr/src/component/icons/send_icon.rs index fbed9d7c..c20b8a7f 100755 --- a/ssr/src/component/icons/send_icon.rs +++ b/ssr/src/component/icons/send_icon.rs @@ -1,18 +1,9 @@ -use leptos::*; +use crate::utils::icon::icon_gen; -#[component] -pub fn SendIcon( - #[prop(optional, default = "w-full h-full".to_string())] classes: String, - #[prop(optional)] filled: bool, -) -> impl IntoView { - view! { - - - - - } -} + "### +); diff --git a/ssr/src/component/icons/share_icon.rs b/ssr/src/component/icons/share_icon.rs index fda5a53e..04aca169 100755 --- a/ssr/src/component/icons/share_icon.rs +++ b/ssr/src/component/icons/share_icon.rs @@ -1,17 +1,9 @@ -use leptos::*; +use crate::utils::icon::icon_gen; -#[component] -pub fn ShareIcon( - #[prop(optional, default = "w-full h-full".to_string())] classes: String, -) -> impl IntoView { - view! { - - - - - } -} + "### +); diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 481afa88..126148e9 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -3,6 +3,7 @@ use std::collections::VecDeque; use futures::StreamExt; use leptos::*; +use leptos_icons::Icon; use crate::component::buttons::LinkButton; use crate::component::icons::airdrop_icon::AirdropIcon; @@ -188,19 +189,19 @@ pub fn TokenCard(
- + - + - + - - + + - +
@@ -219,7 +220,7 @@ pub fn PageSelector(page: RwSignal, end_of_list: RwSignal) -> impl In } disabled=move || page.get() == 1 > - +
{page}
} From f6e35a3ec9de259ea3c8db83b7412621fe31a66a Mon Sep 17 00:00:00 2001 From: joel-medicala-yral Date: Wed, 11 Dec 2024 16:17:42 +0530 Subject: [PATCH 12/22] disabled share link and added disablity feat to the buttons --- ssr/src/page/icpump/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 126148e9..abd4f279 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -264,8 +264,9 @@ pub fn ActionButtonWithHandler( ) -> impl IntoView { view! { -
{page}
+
{page}
@@ -251,8 +247,9 @@ pub fn ActionButton( ) -> impl IntoView { view! {
{children()}
@@ -261,25 +258,6 @@ pub fn ActionButton( } } -#[component] -pub fn ActionButtonWithHandler( - label: String, - children: Children, - #[prop(optional, default = false)] disabled: bool, - on_click: impl Fn() + 'static, -) -> impl IntoView { - view! { - - } -} #[component] pub fn TelegramIcon(href: String, classes: String) -> impl IntoView { view! { diff --git a/ssr/src/utils/token/icpump.rs b/ssr/src/utils/token/icpump.rs index 99ea2e8f..80cd4e38 100644 --- a/ssr/src/utils/token/icpump.rs +++ b/ssr/src/utils/token/icpump.rs @@ -130,6 +130,7 @@ pub async fn get_paginated_token_list(page: u32) -> Result, S #[cfg(not(feature = "firestore"))] { use crate::consts::ICPUMP_LISTING_PAGE_SIZE; + use candid::Principal; let test_user_id = TokenListItem { user_id: Principal::anonymous().to_text(), name: "Test Token".to_string(),