Skip to content
Open
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
31ccf5b
added highlight
alanpoon Apr 3, 2025
8009d1e
added search message logic
alanpoon Apr 11, 2025
0cff367
Merge branch 'main' into search_messages#122
alanpoon Apr 11, 2025
4506ddb
resolve conflict
alanpoon Apr 11, 2025
1620a30
add search_all_room
alanpoon Apr 11, 2025
81a842a
added room_name in search result
alanpoon Apr 12, 2025
52d7efa
added small_state display in search result
alanpoon Apr 12, 2025
6b3fc4b
EventableWrapperETI
alanpoon Apr 13, 2025
a772bc2
before populate_small_state
alanpoon Apr 14, 2025
9c4b11e
migrate to use generic
alanpoon Apr 14, 2025
6d2d63e
Added early abort search message
alanpoon Apr 14, 2025
ea6cb60
t
alanpoon Apr 15, 2025
ef2ddb5
t
alanpoon Apr 15, 2025
5321861
added body_inner
alanpoon Apr 15, 2025
c76173e
fix condensed message in search result
alanpoon Apr 15, 2025
c0e0931
used relations
alanpoon May 10, 2025
497973a
Merge remote-tracking branch 'origin/main' into seacr2
alanpoon May 10, 2025
af68741
rebase
alanpoon May 16, 2025
02b09db
Merge branch 'main' into search_messages_3#122
alanpoon May 16, 2025
ca2ca78
move room_search_result underneath room_screen mod
alanpoon May 19, 2025
fbfb272
Merge branch 'main' into search_messages_3#122
alanpoon May 19, 2025
747cb44
search_button_wrap improvement
alanpoon May 23, 2025
dfa349b
Merge branch 'main' into search_messages_3#122
alanpoon May 23, 2025
3357364
abort previous search request
alanpoon May 23, 2025
687cdf1
allow finding messages in encrypted room
alanpoon May 26, 2025
2c160eb
Merge branch 'search_messages_3#122' of https://github.com/alanpoon/r…
alanpoon May 26, 2025
9a48f94
fix selection
alanpoon May 26, 2025
2d6f5f9
fix clippy
alanpoon May 27, 2025
c86643a
fix spelling
alanpoon May 27, 2025
769c517
remove specific ruma
alanpoon Jun 3, 2025
6d2c06e
don't use trait
alanpoon Jun 3, 2025
1a010bf
separate populate_message_search_view
alanpoon Jun 4, 2025
75aec63
display search result on the right
alanpoon Jun 6, 2025
51d5869
highlight yellow
alanpoon Jun 9, 2025
8314625
rounded view for search result
alanpoon Jun 10, 2025
50d3a5a
revert roomscreen
alanpoon Jun 10, 2025
b0e97af
cleanup
alanpoon Jun 11, 2025
5b8f99a
added date for search result
alanpoon Jun 11, 2025
9290fd8
Change to search_screen to right_panel
alanpoon Jun 13, 2025
8cb2ff0
Merge branch 'main' into search_messages_3#122
alanpoon Jul 16, 2025
31ca5dc
right
alanpoon Jul 16, 2025
6adad73
click search input to open
alanpoon Jul 16, 2025
20db1bd
search
alanpoon Jul 16, 2025
2025fb1
added right panel
alanpoon Jul 17, 2025
fb9b75d
remove cancel_button
alanpoon Jul 18, 2025
bccb820
Fix
alanpoon Jul 18, 2025
62d6612
added doc
alanpoon Jul 18, 2025
69bc0c4
cargo fmt
alanpoon Jul 18, 2025
874e95f
remove unneccessary changes
alanpoon Jul 21, 2025
64ab172
minor code improvement
alanpoon Jul 21, 2025
a830265
Merge branch 'main' into search_messages_3#122
alanpoon Jul 21, 2025
151f123
SearchResultView fix
alanpoon Jul 22, 2025
19e00fb
Merge branch 'main' into search_messages_4#122
alanpoon Jul 22, 2025
efb995e
Save Previous search result
alanpoon Jul 22, 2025
4f81dd8
Added scroll to message in roomscreen
alanpoon Jul 26, 2025
203fefa
Merge branch 'main' into search_messages_3#122
alanpoon Jul 28, 2025
d738c2d
code restructure
alanpoon Jul 28, 2025
98c8715
added constraint to search term length
alanpoon Jul 28, 2025
d4766d6
string optimization
alanpoon Jul 29, 2025
c69e9ba
update cargo lock
alanpoon Jul 29, 2025
609c73c
revert cargo lock
alanpoon Jul 29, 2025
557b0f0
Merge branch 'main' into search_messages_3#122
alanpoon Jul 29, 2025
faaf403
search again button
alanpoon Jul 29, 2025
ffd41d8
Added search input limit as const
alanpoon Aug 1, 2025
568096f
speed up Scroll To Message from search result
alanpoon Aug 5, 2025
aee984c
Merge branch 'main' into search_messages_3#122
alanpoon Aug 6, 2025
2d71975
remove set_room_screen_widget_uid
alanpoon Aug 6, 2025
4003e5c
remove populate_message_search_view's search widget_uid
alanpoon Aug 6, 2025
6fe116f
search_message cleanup
alanpoon Aug 12, 2025
e3de362
minor cleanup
alanpoon Aug 12, 2025
59d7169
Text improvement
alanpoon Aug 13, 2025
3c9d936
change function name
alanpoon Aug 13, 2025
bf71ffd
search_all_rooms_button fix query twice
alanpoon Aug 13, 2025
c5eb255
fix query twice
alanpoon Aug 13, 2025
ce12f4f
Rephrasing
alanpoon Aug 13, 2025
db2f1af
Use 2 dots
alanpoon Aug 13, 2025
bdd4383
add new line
alanpoon Aug 13, 2025
da4c301
Added regex
alanpoon Aug 20, 2025
499c370
Merge branch 'main' into search_messages_3#122
alanpoon Aug 20, 2025
8144a44
Added remove_timeline_loaded_notify
alanpoon Aug 26, 2025
32b0463
Merge branch 'main' into search_messages_3#122
alanpoon Aug 26, 2025
e541b3e
search message improvement
alanpoon Aug 27, 2025
4833fcd
fix clippy
alanpoon Aug 27, 2025
fbb72dc
Merge branch 'main' into search_messages_3#122
alanpoon Sep 26, 2025
c2417e4
remove notify
alanpoon Sep 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ use crate::{
},
login::login_screen::LoginAction,
persistence,
shared::callout_tooltip::{
shared::{callout_tooltip::{
CalloutTooltipOptions,
CalloutTooltipWidgetRefExt,
TooltipAction,
},
}, message_search_input_bar::MessageSearchAction},
sliding_sync::current_user_id,
utils::{
room_name_or_id,
Expand Down Expand Up @@ -153,6 +153,8 @@ impl LiveRegister for App {
crate::settings::live_design(cx);
crate::room::live_design(cx);
crate::join_leave_room_modal::live_design(cx);
crate::right_panel::live_design(cx);
crate::right_panel::search_message::live_design(cx);
crate::verification_modal::live_design(cx);
crate::home::live_design(cx);
crate::profile::live_design(cx);
Expand Down Expand Up @@ -243,6 +245,7 @@ impl MatchEvent for App {
&Scope::default().path,
StackNavigationAction::Push(live_id!(main_content_view))
);
self.ui.view(id!(message_search_input_view)).set_visible(cx, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this (and the other two places where you call set_visible() on message_search_input_view), we ideally should not query and access/modify views or states that are far outside of the bounds of the current widget/module. That violates separation of concerns and typical best practices surrounding abstraction layers.

Instead, you should access the message_search_input_view within the widget/module code where it is defined (or its immediate parent). You can do this in one of two ways:

  1. By creating a new actions (e.g., MessageSearchInputAction::Show/Hide) and emitting the appropriate action here.
  2. By directly handling the existing actions (RoomsListAction::Selected, AppStateAction::RoomFocused/FocusNone) within the other widget or its parent.

In my opinion, #1 is much better because it is much more clear about expressing the intent of the action.

Copy link
Contributor Author

@alanpoon alanpoon Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Previously Homescreen was just a view and couldn't handle action.

self.ui.redraw(cx);
continue;
}
Expand All @@ -251,10 +254,12 @@ impl MatchEvent for App {
match action.as_widget_action().cast() {
AppStateAction::RoomFocused(selected_room) => {
self.app_state.selected_room = Some(selected_room.clone());
self.ui.view(id!(message_search_input_view)).set_visible(cx, true);
continue;
}
AppStateAction::FocusNone => {
self.app_state.selected_room = None;
self.ui.view(id!(message_search_input_view)).set_visible(cx, false);
continue;
}
AppStateAction::UpgradedInviteToJoinedRoom(room_id) => {
Expand Down Expand Up @@ -345,6 +350,13 @@ impl MatchEvent for App {
// }
// _ => {}
// }
if let MessageSearchAction::Click(_) = action.as_widget_action().cast() {
cx.widget_action(
self.ui.widget_uid(),
&Scope::default().path,
StackNavigationAction::Push(live_id!(search_result_view))
);
}
}
}
}
Expand Down
77 changes: 73 additions & 4 deletions src/home/home_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ live_design! {
use crate::home::spaces_dock::SpacesDock;
use crate::shared::styles::*;
use crate::shared::room_filter_input_bar::RoomFilterInputBar;
use crate::shared::message_search_input_bar::MessageSearchInputBar;
use crate::shared::icon_button::RobrixIconButton;
use crate::home::main_desktop_ui::MainDesktopUI;
use crate::settings::settings_screen::SettingsScreen;
use crate::right_panel::*;

NavigationWrapper = {{NavigationWrapper}} {
view_stack = <StackNavigation> {}
Expand Down Expand Up @@ -51,11 +54,32 @@ live_design! {
main_page = <View> {
width: Fill, height: Fill
flow: Down

<CachedWidget> {
room_filter_input_bar = <RoomFilterInputBar> {}
<View> {
width: Fill, height: Fit
flow: Right,
<CachedWidget> {
room_filter_input_bar = <RoomFilterInputBar> {
align: {x: 0.0 }
}
}
message_search_input_view = <View> {
width: Fill, height: Fit,
visible: false,
align: {x: 1.0},
<CachedWidget> {
message_search_input_bar = <MessageSearchInputBar> {
width: 300,
}
}
}
Comment on lines 68 to 78
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we want the outer message_search_input_view to be the CachedWidget itself, instead of the inner message_search_input_bar? That way, the visibility state (whether it is currently visible) will automatically be preserved across changes in AdaptiveView from Mobile <--> Desktop.

I think that would simplify a lot of the code too. If you tried that already and it didn't work, or there is some other reason why that design is not desirable, please let me know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cachedWidget also cached the width of the width, causing a singleton for the width. I want the search input bar to display shorter in the mobile mode. So there is an extra view wrapper for that. Also the cached visibility is not useful as the search input bar should always appear at the room screen stack navigation view. While in the desktop, search input bar should not appear in the welcome screen.

}

<View> {
width: Fill, height: Fill
flow: Right
<MainDesktopUI> {}
<RightPanel> {}
}
<MainDesktopUI> {}
}

settings_page = <View> {
Expand Down Expand Up @@ -128,12 +152,57 @@ live_design! {
}
}
}
<View> {
height: Fit,
width: Fill,
align: {x: 1.0 }
mobile_message_search_input_view = <View> {
height: Fit,
width: 140,
visible: false,
<CachedWidget> {
message_search_input_bar = <MessageSearchInputBar> {
width: 300
}
}
}
}
}
}
body = {
main_content = <MainMobileUI> {}
}
}
search_result_view = <SearchResultView> {
flow: Overlay
header = {
height: 50.0,
margin: { top: 30.0 },
content = {
flow: Right,
title_container = {
width: 0
}
button_container = <View> {
align: { y: 0.5 }
left_button = <RobrixIconButton> {
draw_icon: {
color: #666;
}
text: "Back"
}
}
<CachedWidget> {
message_search_input_bar = <MessageSearchInputBar> {
width: 300
}
}
}
}
body = {
margin: { top: 80.0 },
}
}
}
}
}
Expand Down
17 changes: 15 additions & 2 deletions src/home/main_desktop_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ use makepad_widgets::*;
use matrix_sdk::ruma::OwnedRoomId;
use std::collections::HashMap;

use crate::{app::{AppState, AppStateAction, SelectedRoom}, utils::room_name_or_id};
use crate::{app::{AppState, AppStateAction, SelectedRoom}, shared::message_search_input_bar::MessageSearchAction, utils::room_name_or_id};
use super::{invite_screen::InviteScreenWidgetRefExt, room_screen::RoomScreenWidgetRefExt, rooms_list::RoomsListAction};

live_design! {
use link::theme::*;
use link::shaders::*;
Expand Down Expand Up @@ -214,6 +213,7 @@ impl MainDesktopUI {
dock.close_tab(cx, tab_id);
self.tab_to_close = None;
self.open_rooms.remove(&tab_id);
cx.widget_action(self.widget_uid(), &Scope::empty().path, MessageSearchAction::Clear);
}

/// Replaces an invite with a joined room in the dock.
Expand Down Expand Up @@ -381,6 +381,19 @@ impl WidgetMatchEvent for MainDesktopUI {

if let Some(ref selected_room) = &app_state.selected_room {
self.focus_or_create_tab(cx, selected_room.clone());
// Call DockSave action to display the search message input box when a room is open.
cx.widget_action(
self.widget_uid(),
&HeapLiveIdPath::default(),
AppStateAction::RoomFocused(selected_room.clone())
);
} else {
// If there is no selected room, focus on the home tab.
cx.widget_action(
self.widget_uid(),
&HeapLiveIdPath::default(),
AppStateAction::FocusNone,
);
}
self.view.redraw(cx);
}
Expand Down
Loading