diff --git a/ssr/src/component/buttons.rs b/ssr/src/component/buttons.rs new file mode 100644 index 00000000..0798db76 --- /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! { + + } +} diff --git a/ssr/src/component/icons/airdrop_icon.rs b/ssr/src/component/icons/airdrop_icon.rs new file mode 100755 index 00000000..ac923889 --- /dev/null +++ b/ssr/src/component/icons/airdrop_icon.rs @@ -0,0 +1,36 @@ +use crate::utils::icon::icon_gen; + +icon_gen!( + AirdropIcon, + view_box = "0 0 30 30", + r###" + + + + + + + + + + "### +); 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..e0ceb6fd --- /dev/null +++ b/ssr/src/component/icons/arrow_left_right_icon.rs @@ -0,0 +1,23 @@ +use crate::utils::icon::icon_gen; + +icon_gen!( + ArrowLeftRightIcon, + view_box = "0 0 31 30", + r###" + + + + + "### +); 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..6024a15c --- /dev/null +++ b/ssr/src/component/icons/chevron_right_icon.rs @@ -0,0 +1,10 @@ +use crate::utils::icon::icon_gen; + +icon_gen!( + ChevronRightIcon, + view_box = "0 0 30 30", + r###""### +); 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..6346b2ec --- /dev/null +++ b/ssr/src/component/icons/mod.rs @@ -0,0 +1,6 @@ +pub mod airdrop_icon; +pub mod arrow_left_right_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/icons/send_icon.rs b/ssr/src/component/icons/send_icon.rs new file mode 100755 index 00000000..c20b8a7f --- /dev/null +++ b/ssr/src/component/icons/send_icon.rs @@ -0,0 +1,25 @@ +use crate::utils::icon::icon_gen; + +icon_gen!( + SendIcon, + view_box = "0 0 31 30", + r###" + + + + + "### +); diff --git a/ssr/src/component/icons/share_icon.rs b/ssr/src/component/icons/share_icon.rs new file mode 100755 index 00000000..04aca169 --- /dev/null +++ b/ssr/src/component/icons/share_icon.rs @@ -0,0 +1,36 @@ +use crate::utils::icon::icon_gen; + +icon_gen!( + ShareIcon, + view_box = "0 0 31 30", + r###" + + + + + + + + + + "### +); diff --git a/ssr/src/component/mod.rs b/ssr/src/component/mod.rs index 38bd66c1..61b72338 100644 --- a/ssr/src/component/mod.rs +++ b/ssr/src/component/mod.rs @@ -3,6 +3,7 @@ pub mod auth_providers; pub mod back_btn; pub mod base_route; pub mod bullet_loader; +pub mod buttons; pub mod canisters_prov; pub mod coming_soon; pub mod connect; @@ -11,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; diff --git a/ssr/src/page/icpump/mod.rs b/ssr/src/page/icpump/mod.rs index 22f3d0dd..0effd31b 100644 --- a/ssr/src/page/icpump/mod.rs +++ b/ssr/src/page/icpump/mod.rs @@ -3,78 +3,25 @@ use std::collections::VecDeque; use futures::StreamExt; use leptos::*; -use leptos_icons::*; +use leptos_icons::Icon; +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; 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; -#[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); @@ -84,13 +31,11 @@ pub fn ICPumpListing() -> impl IntoView { let new_token_list: RwSignal> = create_rw_signal(VecDeque::new()); let act = create_resource(page, move |page| async move { - // reset new_token_list 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() }); @@ -110,98 +55,296 @@ 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, + #[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") + .to_string(); // Convert to owned String + 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, + #[prop(optional, default = false)] disabled: bool, +) -> impl IntoView { + view! { + +
{children()}
+ +
{label}
+
+ } +} + +#[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! { + + + + + + + + } +} + +#[component] +pub fn XIcon(href: String, classes: String) -> impl IntoView { + view! { + + + + + + + + + } +} + +#[component] +pub fn InstagramIcon(href: String, classes: String) -> impl IntoView { + view! { + + + + + + + + + } +}