about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-07-01 20:51:15 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-07-01 20:51:15 +0200
commit7978f08235ceca22eacae11a88a7703513238cb3 (patch)
tree6a7058f21f6040cc1e9396a85774bc16ea133c9e /MatrixRoomUtils.Web/Pages
parentTodays progress (diff)
downloadMatrixUtils-7978f08235ceca22eacae11a88a7703513238cb3.tar.xz
Deduplicate some api calls
Diffstat (limited to 'MatrixRoomUtils.Web/Pages')
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor2
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomState/RoomStateRoomList.razor32
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor3
-rw-r--r--MatrixRoomUtils.Web/Pages/Rooms/Index.razor5
4 files changed, 6 insertions, 36 deletions
diff --git a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
index b2d28f6..8b2ff0c 100644
--- a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
@@ -1,4 +1,4 @@
-@page "/RoomStateViewer/{RoomId}/Edit"
+@page "/Rooms/{RoomId}/State/Edit"
 @using System.Net.Http.Headers
 @using System.Text.Json
 @using MatrixRoomUtils.Core.Responses
diff --git a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateRoomList.razor b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateRoomList.razor
deleted file mode 100644
index 55c44d9..0000000
--- a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateRoomList.razor
+++ /dev/null
@@ -1,32 +0,0 @@
-@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!");
-    }
-
-}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor
index a0072ab..09b38f0 100644
--- a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor
@@ -1,4 +1,4 @@
-@page "/RoomStateViewer/{RoomId}"
+@page "/Rooms/{RoomId}/State/View"
 @using System.Net.Http.Headers
 @using System.Text.Json
 @using MatrixRoomUtils.Core.Responses
@@ -73,7 +73,6 @@
         await base.OnInitializedAsync();
         var hs = await MRUStorage.GetCurrentSessionOrNavigate();
         if (hs is null) return;
-        RoomId = RoomId.Replace('~', '.');
         await LoadStatesAsync();
         Console.WriteLine("Policy list editor initialized!");
     }
diff --git a/MatrixRoomUtils.Web/Pages/Rooms/Index.razor b/MatrixRoomUtils.Web/Pages/Rooms/Index.razor
index 20ddd0d..932748d 100644
--- a/MatrixRoomUtils.Web/Pages/Rooms/Index.razor
+++ b/MatrixRoomUtils.Web/Pages/Rooms/Index.razor
@@ -1,18 +1,21 @@
 @page "/Rooms"
+@using MatrixRoomUtils.Core.StateEventTypes
 <h3>Room list</h3>
 
 @if (Rooms is not null) {
-    <RoomList Rooms="Rooms"></RoomList>
+    <RoomList Rooms="Rooms" GlobalProfile="@GlobalProfile"></RoomList>
 }
 
 
 @code {
 
     private List<GenericRoom> Rooms { get; set; }
+    private ProfileResponse GlobalProfile { get; set; }
     
     protected override async Task OnInitializedAsync() {
         var hs = await MRUStorage.GetCurrentSessionOrNavigate();
         if (hs is null) return;
+        GlobalProfile = await hs.GetProfile(hs.WhoAmI.UserId);
         Rooms = await hs.GetJoinedRooms();
 
         await base.OnInitializedAsync();