about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/RoomState/RoomStateRoomList.razor
blob: 55c44d916fe9ecdcc60f564596c11a87d69785c8 (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
@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 base.OnInitializedAsync();
        var hs = await MRUStorage.GetCurrentSessionOrNavigate();
        if (hs is null) return;
        Rooms = (await hs.GetJoinedRooms()).Select(x => x.RoomId).ToList();
        Console.WriteLine("Fetched joined rooms!");
    }

}