-
Notifications
You must be signed in to change notification settings - Fork 63
Make invited room behavior prettier and sleeker #592 #951
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
base: main
Are you sure you want to change the base?
Changes from all commits
1c6c11b
897d17e
25e7941
28961eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ use std::ops::Deref; | |
| use makepad_widgets::*; | ||
| use matrix_sdk::ruma::OwnedRoomId; | ||
|
|
||
| use crate::{app::AppStateAction, home::rooms_list::RoomsListRef, join_leave_room_modal::{JoinLeaveModalKind, JoinLeaveRoomModalAction}, room::{BasicRoomDetails, FetchedRoomAvatar}, shared::{avatar::AvatarWidgetRefExt, popup_list::{enqueue_popup_notification, PopupKind}, restore_status_view::RestoreStatusViewWidgetExt}, sliding_sync::{submit_async_request, MatrixRequest}, utils::{self, RoomNameId}}; | ||
| use crate::{app::AppStateAction, home::rooms_list::RoomsListRef, join_leave_room_modal::{JoinLeaveModalKind, JoinLeaveRoomModalAction}, room::{BasicRoomDetails, FetchedRoomAvatar}, shared::{avatar::AvatarWidgetRefExt, bouncing_dots::BouncingDotsWidgetExt, popup_list::{enqueue_popup_notification, PopupKind}, restore_status_view::RestoreStatusViewWidgetExt}, sliding_sync::{submit_async_request, MatrixRequest}, utils::{self, RoomNameId}}; | ||
|
|
||
| use super::rooms_list::{InviteState, InviterInfo}; | ||
|
|
||
|
|
@@ -165,10 +165,41 @@ script_mod! { | |
| accept_button := RobrixPositiveIconButton { | ||
| align: Align{x: 0.5, y: 0.5} | ||
| padding: 15, | ||
| draw_icon.svg: (ICON_CHECKMARK) | ||
| draw_icon.svg: (ICON_JOIN_ROOM) | ||
| icon_walk: Walk{width: 16, height: 16, margin: Inset{left: -2, right: -1} } | ||
| text: "Join Room" | ||
| } | ||
|
|
||
| // Shown in place of the `accept_button` while a join is in progress. | ||
| // A spinner inside a frame that mimics the disabled button's appearance. | ||
| joining_view := RoundedView { | ||
| visible: false | ||
| width: Fit, height: Fit | ||
| align: Align{x: 0.5, y: 0.5} | ||
| padding: 15, | ||
| spacing: 10, | ||
| flow: Right | ||
|
|
||
| show_bg: true | ||
| draw_bg +: { | ||
| color: (COLOR_BG_DISABLED) | ||
| border_radius: 4.0 | ||
| } | ||
|
|
||
| Label { | ||
| align: Align{x: 0.5, y: 0.5} | ||
| draw_text +: { | ||
| color: (COLOR_FG_DISABLED) | ||
| text_style: REGULAR_TEXT {font_size: 10} | ||
| } | ||
| text: "Joining..." | ||
| } | ||
|
|
||
| joining_spinner := BouncingDots { | ||
| margin: Inset{top: 1.0} | ||
| draw_bg.color: (COLOR_FG_DISABLED) | ||
| } | ||
| } | ||
|
Comment on lines
+173
to
+202
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now that we have the LoadingSpinner widget, I vote that we should use that instead. You can follow the example of the 3 spinners used in Alternatively, you can keep this UI style of an imitation button, but just replace the BouncingDots with a LoadingSpinner. |
||
| } | ||
|
|
||
| completion_label := Label { | ||
|
|
@@ -454,35 +485,57 @@ impl Widget for InviteScreen { | |
|
|
||
| // Third, set the buttons' text based on the invite state. | ||
| let cancel_button = self.view.button(cx, ids!(cancel_button)); | ||
| let accept_button = self.view.button(cx, ids!(accept_button)); | ||
| let mut accept_button = self.view.button(cx, ids!(accept_button)); | ||
| let joining_view = self.view.view(cx, ids!(joining_view)); | ||
| let joining_spinner = self.view.bouncing_dots(cx, ids!(joining_spinner)); | ||
| match self.invite_state { | ||
| InviteState::WaitingOnUserInput => { | ||
| cancel_button.set_enabled(cx, true); | ||
| accept_button.set_enabled(cx, true); | ||
| accept_button.set_visible(cx, true); | ||
| joining_view.set_visible(cx, false); | ||
| joining_spinner.stop_animation(cx); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the benefit of using the LoadingSpinner is that you won't need to start/stop it. |
||
| cancel_button.set_text(cx, "Reject Invite"); | ||
| accept_button.set_text(cx, "Join Room"); | ||
| script_apply_eval!(cx, accept_button, { | ||
| draw_icon.svg: mod.widgets.ICON_JOIN_ROOM, | ||
| }); | ||
| } | ||
| InviteState::WaitingForJoinResult => { | ||
| cancel_button.set_enabled(cx, false); | ||
| accept_button.set_enabled(cx, false); | ||
| cancel_button.set_text(cx, "Reject Invite"); | ||
| accept_button.set_text(cx, "Joining..."); | ||
| // Hide the join button and show the spinner in its place. | ||
| accept_button.set_visible(cx, false); | ||
| joining_view.set_visible(cx, true); | ||
| joining_spinner.start_animation(cx); | ||
| } | ||
| InviteState::WaitingForLeaveResult => { | ||
| cancel_button.set_enabled(cx, false); | ||
| accept_button.set_enabled(cx, false); | ||
| accept_button.set_visible(cx, true); | ||
| joining_view.set_visible(cx, false); | ||
| joining_spinner.stop_animation(cx); | ||
| cancel_button.set_text(cx, "Rejecting..."); | ||
| accept_button.set_text(cx, "Join Room"); | ||
| } | ||
| InviteState::WaitingForJoinedRoom => { | ||
| cancel_button.set_enabled(cx, false); | ||
| accept_button.set_enabled(cx, false); | ||
| accept_button.set_visible(cx, true); | ||
| joining_view.set_visible(cx, false); | ||
| joining_spinner.stop_animation(cx); | ||
| cancel_button.set_text(cx, "Reject Invite"); | ||
| accept_button.set_text(cx, "Joined!"); | ||
| accept_button.set_text(cx, "✅ Joined!"); | ||
| script_apply_eval!(cx, accept_button, { | ||
| draw_icon.svg: mod.widgets.ICON_CHECKMARK, | ||
| draw_icon.color: (COLOR_FG_ACCEPT_GREEN), | ||
| }); | ||
|
Comment on lines
+529
to
+532
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, this is correct, you need to make this change. |
||
| } | ||
| InviteState::RoomLeft => { | ||
| cancel_button.set_visible(cx, false); | ||
| accept_button.set_visible(cx, false); | ||
| joining_view.set_visible(cx, false); | ||
| joining_spinner.stop_animation(cx); | ||
| self.view.label(cx, ids!(completion_label)).set_text( | ||
| cx, | ||
| "Invite successfully rejected. You may close this invite.", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, i can see that you duplicated this from the
close_room_closure_optbelow (innavigate_to_room()), which is fine, but you didn't dedup the code there to call this new function. Let's do that as well, please.Also, did you test this? What happens in mobile view mode where there is no dock? Note that the other code that you copied this from (
close_room_closure_opt) only works because a new room has already been selected, which is what drives the mobile UI behavior. AFAICT, this will do nothing in mobile view mode.