about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/RoomManager.razor
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/RoomManager.razor')
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomManager.razor40
1 files changed, 40 insertions, 0 deletions
diff --git a/MatrixRoomUtils.Web/Pages/RoomManager.razor b/MatrixRoomUtils.Web/Pages/RoomManager.razor
new file mode 100644
index 0000000..deb6fd5
--- /dev/null
+++ b/MatrixRoomUtils.Web/Pages/RoomManager.razor
@@ -0,0 +1,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!");
+    }
+} 
\ No newline at end of file