From 7cdd46e261f20fd9e905a0a0a96509a7eb3eedb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Gon=C3=A7alves=20Marchi?= Date: Tue, 14 Nov 2023 10:03:31 -0300 Subject: [PATCH 1/2] fix(Upload): Fix upload button in chatbar (#1501) --- ui/src/layouts/chats/presentation/chatbar/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/src/layouts/chats/presentation/chatbar/mod.rs b/ui/src/layouts/chats/presentation/chatbar/mod.rs index 00ce737a1b2..81e1272b718 100644 --- a/ui/src/layouts/chats/presentation/chatbar/mod.rs +++ b/ui/src/layouts/chats/presentation/chatbar/mod.rs @@ -405,7 +405,8 @@ pub fn get_chatbar<'a>(cx: &'a Scoped<'a, ChatProps>) -> Element<'a> { let script = SHOW_CONTEXT .replace("UUID", upload_button_menu_uuid) .replace("$PAGE_X", &mouse_data.page_coordinates().x.to_string()) - .replace("$PAGE_Y", &mouse_data.page_coordinates().y.to_string()); + .replace("$PAGE_Y", &mouse_data.page_coordinates().y.to_string()) + .replace("$SELF", "false"); update_script.set(script); }, tooltip: cx.render(rsx!( From b9cfec0a81e674952e59dd692d25475f45b28a8c Mon Sep 17 00:00:00 2001 From: Flemmli97 <34157027+Flemmli97@users.noreply.github.com> Date: Tue, 14 Nov 2023 17:14:35 +0100 Subject: [PATCH 2/2] fix(chat): Fix upload bar gone missing (#1506) --- kit/src/components/message/mod.rs | 3 ++- ui/src/layouts/chats/data/msg_group.rs | 7 ++++++- ui/src/layouts/chats/presentation/messages/mod.rs | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/kit/src/components/message/mod.rs b/kit/src/components/message/mod.rs index d99e7095b5c..98ab0d004c4 100644 --- a/kit/src/components/message/mod.rs +++ b/kit/src/components/message/mod.rs @@ -101,7 +101,8 @@ pub struct Props<'a> { pending: bool, // Progress for attachments which are being uploaded - attachments_pending_uploads: Option>, + #[props(!optional)] + attachments_pending_uploads: Option<&'a Vec>, pinned: bool, } diff --git a/ui/src/layouts/chats/data/msg_group.rs b/ui/src/layouts/chats/data/msg_group.rs index ca368c8b15c..37a6dbc9b08 100644 --- a/ui/src/layouts/chats/data/msg_group.rs +++ b/ui/src/layouts/chats/data/msg_group.rs @@ -4,7 +4,7 @@ use std::collections::VecDeque; use common::{state::pending_message::PendingMessage, warp_runner::ui_adapter}; -use warp::crypto::DID; +use warp::{constellation::Progression, crypto::DID}; // Define a struct to represent a group of messages from the same sender. #[derive(Clone)] @@ -32,6 +32,7 @@ pub struct MessageGroupMsg { pub is_pending: bool, pub is_first: bool, pub is_last: bool, + pub file_progress: Option>, } impl MessageGroupMsg { @@ -54,6 +55,7 @@ pub fn create_message_groups( is_pending: false, is_first: false, is_last: true, + file_progress: None, }; // I really hope last() is O(1) time if let Some(g) = group.messages.iter_mut().last() { @@ -72,6 +74,7 @@ pub fn create_message_groups( is_pending: false, is_first: true, is_last: true, + file_progress: None, }; grp.messages.push(g); messages.push(grp); @@ -93,6 +96,7 @@ pub fn pending_group_messages(pending: &Vec, own_did: DID) -> Op is_pending: true, is_first: false, is_last: true, + file_progress: Some(msg.attachments_progress.values().cloned().collect()), }; messages.push(g); continue; @@ -102,6 +106,7 @@ pub fn pending_group_messages(pending: &Vec, own_did: DID) -> Op is_pending: true, is_first: true, is_last: true, + file_progress: Some(msg.attachments_progress.values().cloned().collect()), }; messages.push(g); } diff --git a/ui/src/layouts/chats/presentation/messages/mod.rs b/ui/src/layouts/chats/presentation/messages/mod.rs index 351cfa59a7b..151864e95da 100644 --- a/ui/src/layouts/chats/presentation/messages/mod.rs +++ b/ui/src/layouts/chats/presentation/messages/mod.rs @@ -511,8 +511,8 @@ fn render_message<'a>(cx: Scope<'a, MessageProps<'a>>) -> Element<'a> { .collect(); let user_did_2 = user_did.clone(); - // todo: get attachment progress from a hook like state. - let pending_uploads = vec![]; + + let pending_uploads = grouped_message.file_progress.as_ref(); let render_markdown = state.read().ui.should_transform_markdown_text(); let should_transform_ascii_emojis = state.read().ui.should_transform_ascii_emojis();