diff --git a/src/home/room_screen.rs b/src/home/room_screen.rs index 085cdae4..63a12008 100644 --- a/src/home/room_screen.rs +++ b/src/home/room_screen.rs @@ -1,32 +1,59 @@ //! A room screen is the UI page that displays a single Room's timeline of events/messages //! along with a message input bar at the bottom. -use std::{borrow::Cow, collections::BTreeMap, ops::{DerefMut, Range}, sync::{Arc, Mutex}}; +use std::{ + borrow::Cow, + collections::BTreeMap, + ops::{DerefMut, Range}, + sync::{Arc, Mutex}, +}; use imbl::Vector; use makepad_widgets::*; -use matrix_sdk::{ruma::{ - events::{ - room::{ - guest_access::GuestAccess, - history_visibility::HistoryVisibility, - join_rules::JoinRule, message::{MessageFormat, MessageType, RoomMessageEventContent}, MediaSource, +use matrix_sdk::{ + ruma::{ + events::{ + room::{ + guest_access::GuestAccess, + history_visibility::HistoryVisibility, + join_rules::JoinRule, + message::{ + sanitize::remove_plain_reply_fallback, MessageFormat, MessageType, + RoomMessageEventContent, + }, + MediaSource, + }, + AnySyncMessageLikeEvent, AnySyncTimelineEvent, FullStateEventContent, + SyncMessageLikeEvent, }, - AnySyncMessageLikeEvent, AnySyncTimelineEvent, FullStateEventContent, SyncMessageLikeEvent, - }, matrix_uri::MatrixId, uint, MatrixToUri, MatrixUri, MilliSecondsSinceUnixEpoch, OwnedRoomId, RoomId, -}, OwnedServerName}; + matrix_uri::MatrixId, + uint, MatrixToUri, MatrixUri, MilliSecondsSinceUnixEpoch, OwnedRoomId, RoomId, UserId, + }, + OwnedServerName, +}; use matrix_sdk_ui::timeline::{ - self, AnyOtherFullStateEventContent, EventTimelineItem, MemberProfileChange, MembershipChange, ReactionsByKeyBySender, RoomMembershipChange, TimelineDetails, TimelineItem, TimelineItemContent, TimelineItemKind, VirtualTimelineItem + self, AnyOtherFullStateEventContent, EventTimelineItem, MemberProfileChange, MembershipChange, + Profile, ReactionsByKeyBySender, RepliedToInfo, ReplyContent, RoomMembershipChange, + TimelineDetails, TimelineItem, TimelineItemContent, TimelineItemKind, VirtualTimelineItem, }; -use rangemap::RangeSet; use crate::{ media_cache::{MediaCache, MediaCacheEntry, AVATAR_CACHE}, - profile::user_profile::{AvatarInfo, ShowUserProfileAction, UserProfile, UserProfilePaneInfo, UserProfileSlidingPaneRef, UserProfileSlidingPaneWidgetExt}, - shared::{avatar::{AvatarRef, AvatarWidgetRefExt}, html_or_plaintext::HtmlOrPlaintextWidgetRefExt, text_or_image::TextOrImageWidgetRefExt}, - sliding_sync::{get_client, submit_async_request, take_timeline_update_receiver, MatrixRequest}, + profile::user_profile::{ + AvatarInfo, ShowUserProfileAction, UserProfile, UserProfilePaneInfo, + UserProfileSlidingPaneRef, UserProfileSlidingPaneWidgetExt, + }, + shared::{ + avatar::{AvatarRef, AvatarWidgetRefExt}, + html_or_plaintext::HtmlOrPlaintextWidgetRefExt, + text_or_image::TextOrImageWidgetRefExt, + }, + sliding_sync::{ + get_client, submit_async_request, take_timeline_update_receiver, MatrixRequest, + }, utils::{self, unix_time_millis_to_datetime, MediaFormatConst}, }; +use rangemap::RangeSet; live_design! { import makepad_draw::shader::std::*; @@ -49,18 +76,21 @@ live_design! { ICO_LIKES = dep("crate://self/resources/icon_likes.svg") ICO_USER = dep("crate://self/resources/icon_user.svg") ICO_ADD = dep("crate://self/resources/icon_add.svg") + ICO_CLOSE = dep("crate://self/resources/icons/close.svg") + // TODO: Maybe replace with a specific reply icon. + ICO_REPLY = dep("crate://self/resources/icons/go_back.svg") TEXT_SUB = { font_size: (10), font: {path: dep("crate://makepad-widgets/resources/GoNotoKurrent-Regular.ttf")} } - + TEXT_P = { font_size: (12), height_factor: 1.65, font: {path: dep("crate://makepad-widgets/resources/GoNotoKurrent-Regular.ttf")} } - + COLOR_BG = #xfff8ee COLOR_BRAND = #xf88 COLOR_BRAND_HOVER = #xf66 @@ -70,12 +100,12 @@ live_design! { COLOR_OVERLAY_BG = #x000000d8 COLOR_READ_MARKER = #xeb2733 COLOR_PROFILE_CIRCLE = #xfff8ee - + FillerY = {width: Fill} - + FillerX = {height: Fill} - - + + IconButton =