feat: improve chat state
This commit is contained in:
@@ -40,7 +40,7 @@ pub struct Compose {
|
||||
|
||||
impl Compose {
|
||||
pub fn new(window: &mut Window, cx: &mut Context<'_, Self>) -> Self {
|
||||
let contacts = cx.new(|_| Vec::with_capacity(200));
|
||||
let contacts = cx.new(|_| Vec::new());
|
||||
let selected = cx.new(|_| HashSet::new());
|
||||
|
||||
let user_input = cx.new(|cx| {
|
||||
@@ -157,7 +157,10 @@ impl Compose {
|
||||
let content = message.to_string();
|
||||
|
||||
// Get room title from user's input
|
||||
let title = Tag::title(self.title_input.read(cx).text().to_string());
|
||||
let title = Tag::custom(
|
||||
TagKind::Subject,
|
||||
vec![self.title_input.read(cx).text().to_string()],
|
||||
);
|
||||
|
||||
// Get all pubkeys
|
||||
let current_user = current_user.public_key();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use crate::views::app::{AddPanel, PanelKind};
|
||||
use chat_state::registry::ChatRegistry;
|
||||
use common::utils::message_ago;
|
||||
use gpui::{
|
||||
div, img, percentage, prelude::FluentBuilder, px, relative, Context, InteractiveElement,
|
||||
IntoElement, ParentElement, Render, SharedString, StatefulInteractiveElement, Styled,
|
||||
@@ -75,9 +74,7 @@ impl Inbox {
|
||||
} else {
|
||||
this.children(inbox.rooms.iter().map(|model| {
|
||||
let room = model.read(cx);
|
||||
let id = room.id;
|
||||
let room_id: SharedString = id.to_string().into();
|
||||
let ago: SharedString = message_ago(room.last_seen).into();
|
||||
let room_id: SharedString = room.id.to_string().into();
|
||||
|
||||
div()
|
||||
.id(room_id)
|
||||
@@ -115,11 +112,14 @@ impl Inbox {
|
||||
div()
|
||||
.flex_shrink_0()
|
||||
.text_color(cx.theme().base.step(cx, ColorScaleStep::ELEVEN))
|
||||
.child(ago),
|
||||
.child(room.last_seen.ago()),
|
||||
)
|
||||
.on_click(cx.listener(move |this, _, window, cx| {
|
||||
this.action(id, window, cx);
|
||||
}))
|
||||
.on_click({
|
||||
let id = room.id;
|
||||
cx.listener(move |this, _, window, cx| {
|
||||
this.action(id, window, cx);
|
||||
})
|
||||
})
|
||||
}))
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user