Skip to content

Enhance popup notifications with colors, severity icons, and a progress bar #526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8107131
added check and cross for popup notification
alanpoon Jun 23, 2025
fcc86c2
improve color scheme for popup
alanpoon Jun 23, 2025
6130a11
Merge branch 'main' into popup_animate_enhancement#517
alanpoon Jun 23, 2025
4d0a503
cleanup
alanpoon Jun 23, 2025
80fae43
Revert back to requirement color schemes
alanpoon Jun 23, 2025
a3fa614
popup notification remove removed_indices
alanpoon Jun 26, 2025
48ef58f
cleanup
alanpoon Jun 26, 2025
7f6f94c
Merge branch 'main' into popup_animate_enhancement#517
alanpoon Jun 26, 2025
a783bd1
Added 5 PopupKind enum
alanpoon Jul 2, 2025
c502250
Merge branch 'main' into popup_animate_enhancement#517
alanpoon Jul 2, 2025
c02d483
change to more uniform usage and added debug progress_bar
alanpoon Jul 3, 2025
630663d
Merge branch 'main' into popup_animate_enhancement#517
alanpoon Jul 9, 2025
fcf3724
Merge branch 'main' into popup_animate_enhancement#517
alanpoon Jul 11, 2025
325327c
Added get_global_popup_list and set_global_popup_list
alanpoon Jul 11, 2025
f455e32
spell fix
alanpoon Jul 14, 2025
6f37402
spell fix
alanpoon Jul 14, 2025
eec0f54
icon info improvement
alanpoon Jul 14, 2025
1c8434d
Merge branch 'main' into popup_animate_enhancement#517
alanpoon Jul 15, 2025
31b68c4
fix review, Remove Fat cross
alanpoon Jul 20, 2025
41d8d04
Remove all capping
alanpoon Jul 23, 2025
6c0a629
Merge branch 'main' into popup_animate_enhancement#517
alanpoon Jul 23, 2025
99ad644
remove extra whitespaces
alanpoon Jul 23, 2025
8d857e2
revert cargo.lock
alanpoon Jul 23, 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
4 changes: 4 additions & 0 deletions resources/icons/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions resources/icons/warning-bold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ live_design! {
use crate::verification_modal::VerificationModal;
use crate::join_leave_room_modal::JoinLeaveRoomModal;
use crate::login::login_screen::LoginScreen;
use crate::shared::popup_list::PopupList;
use crate::shared::popup_list::*;
use crate::home::new_message_context_menu::*;
use crate::shared::callout_tooltip::CalloutTooltip;

Expand Down Expand Up @@ -210,6 +210,12 @@ impl LiveHook for App {
fn after_update_from_doc(&mut self, cx: &mut Cx) {
self.update_login_visibility(cx);
}

fn after_new_from_doc(&mut self, cx: &mut Cx) {
// Here we set the global singleton for the PopupList widget,
// which is used to access PopupList Widget from anywhere in the app.
crate::shared::popup_list::set_global_popup_list(cx, &self.ui);
}
}

impl MatchEvent for App {
Expand All @@ -218,7 +224,6 @@ impl MatchEvent for App {
// such that background threads/tasks will be able to can access it.
let _app_data_dir = crate::app_data_dir();
log!("App::handle_startup(): app_data_dir: {:?}", _app_data_dir);

self.update_login_visibility(cx);

log!("App::handle_startup(): starting matrix sdk loop");
Expand Down
22 changes: 12 additions & 10 deletions src/home/editing_pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use matrix_sdk_ui::timeline::{EventTimelineItem, MsgLikeKind, TimelineEventItemI

use crate::shared::mentionable_text_input::MentionableTextInputWidgetExt;
use crate::{
shared::popup_list::{enqueue_popup_notification, PopupItem}, sliding_sync::{submit_async_request, MatrixRequest}
shared::popup_list::{enqueue_popup_notification, PopupItem, PopupKind}, sliding_sync::{submit_async_request, MatrixRequest}
};

live_design! {
Expand Down Expand Up @@ -301,7 +301,7 @@ impl Widget for EditingPane {
)
},
_non_editable => {
enqueue_popup_notification(PopupItem { message: "That message type cannot be edited.".into(), auto_dismissal_duration: None });
enqueue_popup_notification(PopupItem { message: "That message type cannot be edited.".into(), kind: PopupKind::Error, auto_dismissal_duration: None });
self.animator_play(cx, id!(panel.hide));
self.redraw(cx);
return;
Expand Down Expand Up @@ -335,8 +335,10 @@ impl Widget for EditingPane {
.try_into()
else {
enqueue_popup_notification(
PopupItem { message: "Failed to obtain existing poll answers while editing poll.".into(), auto_dismissal_duration: None }
);
PopupItem { message: "Failed to obtain existing poll answers while editing poll.".into(),
kind: PopupKind::Error,
auto_dismissal_duration: None
});
return;
};
let mut new_content_block = UnstablePollStartContentBlock::new(
Expand All @@ -355,13 +357,13 @@ impl Widget for EditingPane {

}
_ => {
enqueue_popup_notification(PopupItem { message: "That event type cannot be edited.".into(), auto_dismissal_duration: None });
enqueue_popup_notification(PopupItem { message: "That event type cannot be edited.".into(), kind: PopupKind::Error, auto_dismissal_duration: None });
return;
}
}
}
_ => {
enqueue_popup_notification(PopupItem { message: "That event type cannot be edited.".into(), auto_dismissal_duration: None });
enqueue_popup_notification(PopupItem { message: "That event type cannot be edited.".into(), kind: PopupKind::Error, auto_dismissal_duration: None });
return;
},
};
Expand Down Expand Up @@ -414,15 +416,15 @@ impl EditingPane {
self.animator_play(cx, id!(panel.hide));
},
Err(e) => {
enqueue_popup_notification(PopupItem { message: format!("Failed to edit message: {}", e), auto_dismissal_duration: None});
enqueue_popup_notification(PopupItem { message: format!("Failed to edit message: {}", e), kind: PopupKind::Error, auto_dismissal_duration: None });
},
}
}

/// Shows the editing pane and sets it up to edit the given `event`'s content.
pub fn show(&mut self, cx: &mut Cx, event_tl_item: EventTimelineItem, room_id: OwnedRoomId) {
if !event_tl_item.is_editable() {
enqueue_popup_notification(PopupItem { message: "That message cannot be edited.".into(), auto_dismissal_duration: None });
enqueue_popup_notification(PopupItem { message: "That message cannot be edited.".into(), kind: PopupKind::Error, auto_dismissal_duration: None });
return;
}

Expand All @@ -433,8 +435,8 @@ impl EditingPane {
} else if let Some(poll) = event_tl_item.content().as_poll() {
edit_text_input.set_text(cx, &poll.results().question);
} else {
enqueue_popup_notification(PopupItem { message: "That message cannot be edited.".into(), auto_dismissal_duration: None });
return;
enqueue_popup_notification(PopupItem { message: "That message cannot be edited.".into(), kind: PopupKind::Error, auto_dismissal_duration: None });
return;
}


Expand Down
10 changes: 5 additions & 5 deletions src/home/invite_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::ops::Deref;
use makepad_widgets::*;
use matrix_sdk::ruma::OwnedRoomId;

use crate::{app::RoomsPanelRestoreAction, home::rooms_list::RoomsListRef, join_leave_room_modal::{JoinLeaveModalKind, JoinLeaveRoomModalAction}, room::{BasicRoomDetails, RoomPreviewAvatar}, shared::{avatar::AvatarWidgetRefExt, popup_list::{enqueue_popup_notification, PopupItem}}, sliding_sync::{submit_async_request, MatrixRequest}, utils};
use crate::{app::RoomsPanelRestoreAction, home::rooms_list::RoomsListRef, join_leave_room_modal::{JoinLeaveModalKind, JoinLeaveRoomModalAction}, room::{BasicRoomDetails, RoomPreviewAvatar}, shared::{avatar::AvatarWidgetRefExt, popup_list::{enqueue_popup_notification, PopupItem, PopupKind}}, sliding_sync::{submit_async_request, MatrixRequest}, utils};

use super::rooms_list::{InviteState, InviterInfo};

Expand Down Expand Up @@ -360,15 +360,15 @@ impl Widget for InviteScreen {
Some(JoinRoomAction::Joined { room_id }) if room_id == &info.room_id => {
self.invite_state = InviteState::WaitingForJoinedRoom;
if !self.has_shown_confirmation {
enqueue_popup_notification(PopupItem{ message: "Successfully joined room.".into(), auto_dismissal_duration: None });
enqueue_popup_notification(PopupItem{ message: "Successfully joined room.".into(), kind: PopupKind::Success, auto_dismissal_duration: None });
}
continue;
}
Some(JoinRoomAction::Failed { room_id, error }) if room_id == &info.room_id => {
self.invite_state = InviteState::WaitingOnUserInput;
if !self.has_shown_confirmation {
let msg = utils::stringify_join_leave_error(error, info.room_name.as_deref(), true, true);
enqueue_popup_notification(PopupItem { message: msg, auto_dismissal_duration: None });
enqueue_popup_notification(PopupItem { message: msg, kind: PopupKind::Error, auto_dismissal_duration: None });
}
continue;
}
Expand All @@ -379,14 +379,14 @@ impl Widget for InviteScreen {
Some(LeaveRoomAction::Left { room_id }) if room_id == &info.room_id => {
self.invite_state = InviteState::RoomLeft;
if !self.has_shown_confirmation {
enqueue_popup_notification(PopupItem { message: "Successfully rejected invite.".into(), auto_dismissal_duration: None });
enqueue_popup_notification(PopupItem { message: "Successfully rejected invite.".into(), kind: PopupKind::Success, auto_dismissal_duration: None });
}
continue;
}
Some(LeaveRoomAction::Failed { room_id, error }) if room_id == &info.room_id => {
self.invite_state = InviteState::WaitingOnUserInput;
if !self.has_shown_confirmation {
enqueue_popup_notification(PopupItem { message: format!("Failed to reject invite: {error}"), auto_dismissal_duration: None });
enqueue_popup_notification(PopupItem { message: format!("Failed to reject invite: {error}"), kind: PopupKind::Error, auto_dismissal_duration: None });
}
continue;
}
Expand Down
Loading