Skip to content

Make invited room behavior prettier and sleeker #592

Description

@kevinaboos

Although the room InviteScreen is fully functional and works properly, there are still some ways we could make it a bit nicer looking and sleeker.

  • Upon showing the InviteScreen (in set_displayed_invite()), change the join button icon to an "enter room" icon, and set the button as enabled and the button text to be "Join room".
  • Once the join button has been clicked, change the icon to a loading spinner and the text to "Joining...".
    • This will require a special button type that can show other non-icon content. Alternatively, we could hide the button temporarily and just show a LoadingSpinner with a background frame that looks like a disabled button... that might be easier.
  • Once the JoinRoomResultAction::Joined has been received, change the button icon to a green checkmark: " ✅ Joined!"
  • Close rooms when they are successfully Left.
    • We can now do this because navigation between rooms has recently been implemented. See how we achieve this to close a tombstoned room when its successor has been joined:

      robrix/src/app.rs

      Lines 536 to 593 in d7117c3

      fn navigate_to_room(
      &mut self,
      cx: &mut Cx,
      room_to_close: Option<&OwnedRoomId>,
      destination_room: &BasicRoomDetails,
      ) {
      // A closure that closes the given `room_to_close`, if it exists in an open tab.
      let close_room_closure_opt = room_to_close.map(|to_close| {
      let tab_id = LiveId::from_str(to_close.as_str());
      let widget_uid = self.ui.widget_uid();
      move |cx: &mut Cx| {
      cx.widget_action(
      widget_uid,
      &HeapLiveIdPath::default(),
      DockAction::TabCloseWasPressed(tab_id),
      );
      enqueue_rooms_list_update(RoomsListUpdate::HideRoom { room_id: to_close.clone() });
      }
      });
      // If the successor room is not loaded, show a join modal.
      let destination_room_id = destination_room.room_name_id.room_id();
      if !cx.get_global::<RoomsListRef>().is_room_loaded(destination_room_id) {
      log!("Destination room {} not loaded, showing join modal...", destination_room_id);
      self.waiting_to_navigate_to_joined_room = Some((
      destination_room.clone(),
      room_to_close.cloned(),
      ));
      cx.action(JoinLeaveRoomModalAction::Open {
      kind: JoinLeaveModalKind::JoinRoom(destination_room.clone()),
      show_tip: false,
      });
      return;
      }
      log!(
      "Navigating to destination room {} ({}), closing room {room_to_close:?}",
      destination_room_id,
      destination_room.room_name_id
      );
      // Select and scroll to the destination room in the rooms list.
      let new_selected_room = SelectedRoom::JoinedRoom {
      room_name_id: destination_room.room_name_id.clone(),
      };
      enqueue_rooms_list_update(RoomsListUpdate::ScrollToRoom(destination_room_id.clone()));
      cx.widget_action(
      self.ui.widget_uid(),
      &HeapLiveIdPath::default(),
      RoomsListAction::Selected(new_selected_room),
      );
      // Close a previously/currently-open room if specified.
      if let Some(closure) = close_room_closure_opt {
      closure(cx);
      }
      }
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for Feature.

    Projects

    Status
    In review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions