diff --git a/Cargo.lock b/Cargo.lock index 758ab5b..db213f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3376,6 +3376,7 @@ dependencies = [ "htmlize", "imbl", "imghdr", + "indexmap", "linkify", "makepad-widgets", "matrix-sdk", diff --git a/Cargo.toml b/Cargo.toml index dc492e4..9101e05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,6 +51,7 @@ url = "2.5.0" emojis = "0.6.1" bytesize = "1.3.0" bitflags = "2.6.0" +indexmap = "2.6.0" ################################################################################################### #### Note: we now enable the usage of `rustls-tls` and the `bundled-sqlite` features in the 2 #### diff --git a/src/app.rs b/src/app.rs index 378edbc..6f4b3b0 100644 --- a/src/app.rs +++ b/src/app.rs @@ -297,6 +297,9 @@ impl MatchEvent for App { impl AppMain for App { fn handle_event(&mut self, cx: &mut Cx, event: &Event) { + if let Event::WindowGeomChange(window_geom_change_event) = event { + self.app_state.window_geom = Some(window_geom_change_event.new_geom.clone()); + } // Forward events to the MatchEvent trait impl, and then to the App's UI element. self.match_event(cx, event); let scope = &mut Scope::with_data(&mut self.app_state); @@ -321,6 +324,8 @@ impl App { pub struct AppState { pub rooms_panel: RoomsPanelState, pub logged_in: bool, + /// The current window geometry. + pub window_geom: Option, } #[derive(Default, Debug)] diff --git a/src/home/event_reaction_list.rs b/src/home/event_reaction_list.rs new file mode 100644 index 0000000..6fa820f --- /dev/null +++ b/src/home/event_reaction_list.rs @@ -0,0 +1,307 @@ +use crate::sliding_sync::{current_user_id, submit_async_request, MatrixRequest}; +use makepad_widgets::*; +use matrix_sdk::ruma::{OwnedRoomId, OwnedUserId}; +use matrix_sdk_ui::timeline::{ReactionInfo, ReactionsByKeyBySender, TimelineEventItemId}; +use crate::profile::user_profile_cache::get_user_profile_and_room_member; +use crate::home::room_screen::RoomScreenTooltipActions; +use indexmap::IndexMap; + +const TOOLTIP_WIDTH: f64 = 200.0; +const EMOJI_BORDER_COLOR_INCLUDE_SELF: Vec4 = Vec4 { x: 0.0, y: 0.6, z: 0.47, w: 1.0 }; // DarkGreen +const EMOJI_BORDER_COLOR_NOT_INCLUDE_SELF: Vec4 = Vec4 { x: 0.714, y: 0.73, z: 0.75, w: 1.0 }; // Grey + +const EMOJI_BG_COLOR_INCLUDE_SELF: Vec4 = Vec4 { x: 0.89, y: 0.967, z: 0.929, w: 1.0 }; // LightGreen +const EMOJI_BG_COLOR_NOT_INCLUDE_SELF: Vec4 = Vec4 { x: 0.968, y: 0.976, z: 0.98, w: 1.0 }; // LightGrey + +live_design! { + use link::theme::*; + use link::shaders::*; + use link::widgets::*; + + use crate::shared::styles::*; + COLOR_BUTTON_GREY = #B6BABF + REACTION_LIST_PADDING_RIGHT = 30.0; + pub ReactionList = {{ReactionList}} { + width: Fill, + height: Fit, + flow: RightWrap, + margin: {top: 5.0} + padding:{ + right: (REACTION_LIST_PADDING_RIGHT) + } + item: