Skip to content

Implement the Space Lobby screen: show a list of all rooms & subspaces in a given space #645

@kevinaboos

Description

@kevinaboos

Background

Spaces support within Robrix was recently added (see PRs #623, #624, #636, #644), and it is mostly complete. The last remaining component is the Spaces "lobby"/"homepage", which allows the user to explore the full list of subspaces and rooms within a given space.

Here is how Element displays a space's homepage:

Image

Implementation: Viewing the space

Key components that we need to implement are:

  • Space avatar and name (already known in the SpacesBar)
  • Whether it is public/private
  • How many members there are
  • A search box
    • Keywords should match on the room/space ID, name, alias, and topic
  • The list of rooms and subspaces
    • Each subspace can be expanded/collapsed to show its children
    • Each room displays its name & avatar, the number of members, whether you've joined it, whether it is "Suggested"
    • Each subspace displays the name & avatar of that subspace, the number of child rooms/space, the number of members, whether it is joined
  • Buttons to join/leave each room or subspace

There is already an existing SpaceLobbyScreen, but it is just a placeholder for now:

// The main view that shows the lobby (homepage) for a space.
pub SpaceLobbyScreen = {{SpaceLobbyScreen}} {
width: Fill, height: Fill,
padding: {top: 100}
align: {x: 0.5}
show_bg: true
draw_bg: {
color: (COLOR_PRIMARY)
}
title = <Label> {
flow: RightWrap,
align: {x: 0.5}
draw_text: {
text_style: <TITLE_TEXT>{font_size: 13},
color: #000
wrap: Word
}
text: "Space Lobby Screen is not yet implemented"
}
}

The RoomsList is the main "driver" of the background space sync service, and uses this space_request_sender to send requests to it:

/// The sender used to send Space-related requests to the background service.
#[rust] space_request_sender: Option<UnboundedSender<SpaceRequest>>,

The RoomsList has a full map of all spaces, including each space's parents, list of direct rooms, and list of nested subspaces:

/// A flattened map of all spaces known to the client.
///
/// The key is a Space ID, and the value contains a list of all regular rooms
/// and nested subspaces *directly* within that space.
///
/// This can include both joined and non-joined spaces.
#[rust] space_map: HashMap<OwnedRoomId, SpaceMapValue>,

So, the SpaceLobbyScreen can query the RoomsList for the basic structure of a given space, but the RoomsList doesn't hold all details about each space. Thus, we will need to add some additional requests to get the full details of a space. Perhaps something like a more detailed version of the existing SpaceRequest::GetChildren, which will return the full SpaceRoom object for each space instead of just a list of child room/subspace IDs.

Implementation: editing the space

If the current logged-in user can edit the space, then we also need to allow them to:

  1. Add rooms or subspaces to the space.
  2. Remove rooms or subspaces from the space.
  3. Mark rooms or subspaces as "suggested" (or not).

Here are some screenshots from Element showing how they display it.

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedLooking for help from anyone!

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions