From 4d9f8a25cdda5ce81e16162f39a2bf3cb195ae9f Mon Sep 17 00:00:00 2001 From: Komal <157946119+komal-rs@users.noreply.github.com> Date: Fri, 3 May 2024 09:50:03 +0530 Subject: [PATCH] link copied popup, like icon and icon sizes (#217) * link copied popup * icon dist --- Cargo.toml | 1 - src/page/post_view/overlay.rs | 30 +++++++++++++++++++++++------- src/page/refer_earn/mod.rs | 12 ++++++++++++ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c51457c3..da1c1776 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -250,4 +250,3 @@ lib-default-features = false # # Optional. Defaults to "release". lib-profile-release = "wasm-release" - diff --git a/src/page/post_view/overlay.rs b/src/page/post_view/overlay.rs index 1bd3d81e..8227459e 100644 --- a/src/page/post_view/overlay.rs +++ b/src/page/post_view/overlay.rs @@ -7,6 +7,7 @@ use crate::{ web::{copy_to_clipboard, share_url}, }, }; +use gloo::timers::callback::Timeout; use leptos::*; use leptos_icons::*; use leptos_use::use_window; @@ -88,15 +89,15 @@ fn LikeAndAuthCanLoader(post: PostDetails) -> impl IntoView { let liking = like_toggle.pending(); view! { -
+
- {likes} + {likes}
{move || liked.set(Some(d.1))} @@ -107,6 +108,7 @@ fn LikeAndAuthCanLoader(post: PostDetails) -> impl IntoView { #[component] pub fn VideoDetailsOverlay(post: PostDetails) -> impl IntoView { let show_share = create_rw_signal(false); + let show_copied_popup = create_rw_signal(false); let base_url = || { use_window() .as_ref() @@ -133,8 +135,14 @@ pub fn VideoDetailsOverlay(post: PostDetails) -> impl IntoView { let profile_url = format!("/profile/{}", post.poster_principal.to_text()); let post_c = post.clone(); + let click_copy = move |text: String| { + _ = copy_to_clipboard(&text); + show_copied_popup.set(true); + Timeout::new(1200, move || show_copied_popup.set(false)).forget(); + }; + view! { -
+
- @@ -172,11 +180,19 @@ pub fn VideoDetailsOverlay(post: PostDetails) -> impl IntoView {

{video_url}

-
+ + +
+ +

Link Copied!

+
+
+
} } diff --git a/src/page/refer_earn/mod.rs b/src/page/refer_earn/mod.rs index 1c588e46..051f0ab9 100644 --- a/src/page/refer_earn/mod.rs +++ b/src/page/refer_earn/mod.rs @@ -1,6 +1,7 @@ mod history; use candid::Principal; +use gloo::timers::callback::Timeout; use ic_agent::Identity; use leptos::*; use leptos_icons::*; @@ -44,6 +45,7 @@ fn ReferLoaded(user_principal: Principal) -> impl IntoView { .unwrap_or_default(); let (logged_in, _) = account_connected_reader(); + let show_copied_popup = create_rw_signal(false); let click_copy = create_action(move |()| { let refer_link = refer_link.clone(); @@ -51,6 +53,9 @@ fn ReferLoaded(user_principal: Principal) -> impl IntoView { let _ = copy_to_clipboard(&refer_link); ReferShareLink.send_event(logged_in); + + show_copied_popup.set(true); + Timeout::new(1200, move || show_copied_popup.set(false)).forget(); } }); @@ -61,6 +66,13 @@ fn ReferLoaded(user_principal: Principal) -> impl IntoView {
+ +
+ +

Link Copied!

+
+
+
} }