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();