about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/RoomListComponents
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Shared/RoomListComponents')
-rw-r--r--MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor18
-rw-r--r--MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListSpace.razor18
2 files changed, 21 insertions, 15 deletions
diff --git a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor
index e860321..4be3c1f 100644
--- a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor
+++ b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor
@@ -1,12 +1,16 @@
 @using MatrixRoomUtils.Core.StateEventTypes
+@using MatrixRoomUtils.Core.StateEventTypes.Spec
 <details>
     <summary>@roomType (@rooms.Count)</summary>
     @foreach (var room in rooms) {
         <div class="room-list-item">
-            <RoomListItem Room="@room" ShowOwnProfile="@(roomType == "Room")"></RoomListItem>
-            <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{room.RoomId}/Timeline")">View timeline</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton>
-            <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{room.RoomId}/State/View")">View state</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton>
-            <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{room.RoomId}/State/Edit")">Edit state</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton>
+            <RoomListItem RoomInfo="@room" ShowOwnProfile="@(roomType == "Room")"></RoomListItem>
+            @if (room.StateEvents.Any(x => x.Type == "m.room.create")) {
+                
+            }
+            <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{room.Room.RoomId}/Timeline")">View timeline</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton>
+            <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{room.Room.RoomId}/State/View")">View state</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton>
+            <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{room.Room.RoomId}/State/Edit")">Edit state</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton>
             
             @if (roomType == "Space") {
                 <RoomListSpace Space="@room"></RoomListSpace>
@@ -19,12 +23,12 @@
 @code {
 
     [Parameter]
-    public KeyValuePair<string, List<GenericRoom>> Category { get; set; }
+    public KeyValuePair<string, List<RoomInfo>> Category { get; set; }
     
     [Parameter]
-    public ProfileResponse? GlobalProfile { get; set; }
+    public ProfileResponseEventData? GlobalProfile { get; set; }
 
     private string roomType => Category.Key;
-    private List<GenericRoom> rooms => Category.Value;
+    private List<RoomInfo> rooms => Category.Value;
     
 }
\ No newline at end of file
diff --git a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListSpace.razor b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
index 73dc334..5153658 100644
--- a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
+++ b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
@@ -1,4 +1,4 @@
-<LinkButton href="@($"/Rooms/{Space.RoomId}/Space")">Manage space</LinkButton>
+<LinkButton href="@($"/Rooms/{Space.Room.RoomId}/Space")">Manage space</LinkButton>
 
 <br/>
 <details @ontoggle="SpaceChildrenOpened">
@@ -14,23 +14,25 @@
 @code {
 
     [Parameter]
-    public GenericRoom Space { get; set; }
+    public RoomInfo Space { get; set; }
 
     [Parameter, CascadingParameter]
     public string? Breadcrumbs {
-        get => _breadcrumbs + Space.RoomId;
+        get => _breadcrumbs + Space.Room.RoomId;
         set => _breadcrumbs = value;
     }
 
-    private List<GenericRoom> Children { get; set; } = new();
+    private List<RoomInfo> Children { get; set; } = new();
 
     protected override async Task OnInitializedAsync() {
         if (Breadcrumbs == null) throw new ArgumentNullException(nameof(Breadcrumbs));
         await Task.Delay(Random.Shared.Next(1000, 10000));
-        var rooms = Space.AsSpace.GetRoomsAsync();
+        var rooms = Space.Room.AsSpace.GetRoomsAsync();
         await foreach (var room in rooms) {
-            if(Breadcrumbs.Contains(room.RoomId)) continue;
-            Children.Add(room);
+            if (Breadcrumbs.Contains(room.RoomId)) continue;
+            Children.Add(new() {
+                Room = room
+            });
         }
         await base.OnInitializedAsync();
     }
@@ -41,7 +43,7 @@
     private async Task SpaceChildrenOpened() {
         if (_shouldRenderChildren) return;
         _shouldRenderChildren = true;
-        Console.WriteLine($"[RoomList] Rendering children of {Space.RoomId}");
+        Console.WriteLine($"[RoomList] Rendering children of {Space.Room.RoomId}");
     }
 
 }
\ No newline at end of file