about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/RoomManager.razor
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-04 20:34:16 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-04 20:34:16 +0200
commit383f7b633471dedf515907cb8a8752bc5885ae64 (patch)
tree793225216c9c38be1533e1960166b7b3dd472890 /MatrixRoomUtils.Web/Pages/RoomManager.razor
parentDark theme, fancier room list (diff)
downloadMatrixUtils-383f7b633471dedf515907cb8a8752bc5885ae64.tar.xz
Add room manager, profile caching
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