Skip to content
11 changes: 9 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,11 @@ impl MatchEvent for App {

if let RoomsListAction::Selected(selected_room) = action.as_widget_action().cast() {
// A room has been selected, update the app state and navigate to the main content view.
let display_name = selected_room.room_name().to_string();
let display_name = match &selected_room {
SelectedRoom::JoinedRoom { room_name_id } => room_name_id.to_string(),
SelectedRoom::InvitedRoom { room_name_id } => room_name_id.to_string(),
SelectedRoom::Space { space_name_id } => format!("[Space] {}", space_name_id),
};
self.app_state.selected_room = Some(selected_room);
// Set the Stack Navigation header to show the name of the newly-selected room.
self.ui
Expand Down Expand Up @@ -770,7 +774,10 @@ impl App {
room_to_close.cloned(),
));
cx.action(JoinLeaveRoomModalAction::Open {
kind: JoinLeaveModalKind::JoinRoom(destination_room.clone()),
kind: JoinLeaveModalKind::JoinRoom {
details: destination_room.clone(),
is_space: false,
},
show_tip: false,
});
return;
Expand Down
2 changes: 1 addition & 1 deletion src/home/invite_modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ live_design! {
/// Actions emitted by other widgets to show or hide the `InviteModal`.
#[derive(Clone, Debug)]
pub enum InviteModalAction {
/// Open the modal to invite a user to the given room.
/// Open the modal to invite a user to the given room or space.
Open(RoomNameId),
/// Close the modal.
Close,
Expand Down
2 changes: 1 addition & 1 deletion src/home/main_desktop_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl MainDesktopUI {
),
SelectedRoom::Space { space_name_id } => (
id!(space_lobby_screen),
space_name_id.to_string(),
format!("[Space] {}", space_name_id),
),
};

Expand Down
21 changes: 21 additions & 0 deletions src/home/rooms_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,27 @@ impl RoomsList {
None,
);
}
SpaceRoomListAction::LeaveSpaceResult { space_name_id, result } => match result {
Ok(()) => {
enqueue_popup_notification(
format!("Successfully left space \"{}\".", space_name_id),
PopupKind::Success,
Some(4.0),
);
// If the space we left was the currently-selected one, go back to the main Home view.
if self.selected_space.as_ref().is_some_and(|s| s.room_id() == space_name_id.room_id()) {
cx.action(NavigationBarAction::GoToHome);
}
}
Err(e) => {
error!("Failed to leave space {space_name_id:?}: {e:?}");
enqueue_popup_notification(
format!("Failed to leave space \"{space_name_id}\".\n\nError: {e}"),
PopupKind::Error,
None,
);
}
},
// Details-related space actions are handled by SpaceLobbyScreen, not RoomsList.
SpaceRoomListAction::DetailedChildren { .. }
| SpaceRoomListAction::TopLevelSpaceDetails(_) => { }
Expand Down
Loading