about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/RoomManager.razor
blob: deb6fd5b2ba924195b6d8765881a74af59d24b90 (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
36
37
38
39
40
@page "/RoomManager"
@inject ILocalStorageService LocalStorage
@inject NavigationManager NavigationManager
<h3>Room manager</h3>
<hr/>
@if (Rooms.Count == 0)
{
    <p>You are not in any rooms!</p>
    @* <p>Loading progress: @checkedRoomCount/@totalRoomCount</p> *@
}
else
{
    <details open>
        <summary>Room List</summary>
        @foreach (var room in Rooms)
        {
            <a style="color: unset; text-decoration: unset;" href="/RoomStateViewer/@room.Replace('.', '~')"><RoomListItem RoomId="@room" ShowOwnProfile="true"></RoomListItem></a>
        }
    </details>
    
}

<div style="margin-bottom: 4em;"></div>
<LogView></LogView>

@code {
    public List<string> Rooms { get; set; } = new();
    protected override async Task OnInitializedAsync()
    {
        if (!RuntimeCache.WasLoaded) 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!");
    }
}