Skip to content

Commit

Permalink
Merge branch 'dev' into calling_ui_improv
Browse files Browse the repository at this point in the history
  • Loading branch information
Flemmli97 authored Nov 14, 2023
2 parents 1e652c0 + b9cfec0 commit 450cd03
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion kit/src/components/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ pub struct Props<'a> {
pending: bool,

// Progress for attachments which are being uploaded
attachments_pending_uploads: Option<Vec<Progression>>,
#[props(!optional)]
attachments_pending_uploads: Option<&'a Vec<Progression>>,

pinned: bool,
}
Expand Down
7 changes: 6 additions & 1 deletion ui/src/layouts/chats/data/msg_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -32,6 +32,7 @@ pub struct MessageGroupMsg {
pub is_pending: bool,
pub is_first: bool,
pub is_last: bool,
pub file_progress: Option<Vec<Progression>>,
}

impl MessageGroupMsg {
Expand All @@ -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() {
Expand All @@ -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);
Expand All @@ -93,6 +96,7 @@ pub fn pending_group_messages(pending: &Vec<PendingMessage>, 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;
Expand All @@ -102,6 +106,7 @@ pub fn pending_group_messages(pending: &Vec<PendingMessage>, 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);
}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/layouts/chats/presentation/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 450cd03

Please sign in to comment.