about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/RoomState/RoomStateRoomList.razor
blob: 82b5d75ec93ac16131d6071c40c11519d244ac1f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@page "/RoomStateViewer"
@inject ILocalStorageService LocalStorage
@inject NavigationManager NavigationManager
<h3>Room state viewer - Room list</h3>
<hr/>
@if (Rooms.Count == 0) {
    <p>You are not in any rooms!</p>
    @* <p>Loading progress: @checkedRoomCount/@totalRoomCount</p> *@
}
else {
    @foreach (var room in Rooms) {
        <a style="color: unset; text-decoration: unset;" href="/RoomStateViewer/@room.Replace('.', '~')">
            <RoomListItem RoomId="@room"></RoomListItem>
        </a>
    }
    <div style="margin-bottom: 4em;"></div>
}

<LogView></LogView>

@code {
    public List<string> Rooms { get; set; } = new();

    protected override async Task OnInitializedAsync() {
        await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
        await base.OnInitializedAsync();
        if (RuntimeCache.CurrentHomeServer == null) {
            NavigationManager.NavigateTo("/Login");
            return;
        }
        Rooms = (await RuntimeCache.CurrentHomeServer.GetJoinedRooms()).Select(x => x.RoomId).ToList();
        Console.WriteLine("Fetched joined rooms!");
    }

}