@page "/Rooms2" @using LibMatrix.Responses @using System.Collections.ObjectModel @using System.ComponentModel @using MatrixUtils.Abstractions @using MatrixUtils.Web.Pages.Rooms.Index2Components @inject ILogger logger

Room list

@if (Data.Homeserver is null || Data.GlobalProfile is null) {

Creating homeserver instance and fetching global profile...

return; }
Main DMs By room type

@switch (SelectedTab) { case Tab.Main:

Main tab

break; case Tab.DMs:

DMs tab

break; case Tab.ByRoomType:

By room type tab

break; default: throw new InvalidEnumArgumentException(); }

@* Create new room *@ @code { private Tab SelectedTab { get => _selectedTab; set { _selectedTab = value; StateHasChanged(); } } public RoomListViewData Data { get; set; } = new RoomListViewData(); protected override async Task OnInitializedAsync() { Data.Homeserver = await RMUStorage.GetCurrentSessionOrNavigate(); if (Data.Homeserver is null) return; var rooms = await Data.Homeserver.GetJoinedRooms(); Data.GlobalProfile = await Data.Homeserver.GetProfileAsync(Data.Homeserver.WhoAmI.UserId); foreach (var room in rooms) { Data.Rooms.Add(new RoomInfo(room)); } StateHasChanged(); await base.OnInitializedAsync(); } private Tab _selectedTab = Tab.Main; private enum Tab { Main, DMs, ByRoomType } public class RoomListViewData { public ObservableCollection Rooms { get; } = []; public UserProfileResponse? GlobalProfile { get; set; } public AuthenticatedHomeserverGeneric? Homeserver { get; set; } } }