about summary refs log tree commit diff
path: root/MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor')
-rw-r--r--MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor17
1 files changed, 15 insertions, 2 deletions
diff --git a/MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor b/MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
index 895d642..9c481e3 100644
--- a/MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
+++ b/MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
@@ -1,15 +1,23 @@
 @using System.Collections.ObjectModel
 @using MatrixUtils.Abstractions
-<MatrixUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{Space.Room.RoomId}/Space")">Manage space</MatrixUtils.Web.Shared.SimpleComponents.LinkButton>
+<LinkButton href="@($"/Rooms/{Space.Room.RoomId}/Space")">Manage space</LinkButton>
 
 <br/>
 <details @ontoggle="SpaceChildrenOpened">
     <summary>@Children.Count children</summary>
     @if (_shouldRenderChildren) {
         <p>Breadcrumb: @Breadcrumbs</p>
+        <p>Joined:</p>
         <div style="margin-left: 8px;">
             <RoomList Rooms="Children"></RoomList>
         </div>
+        <p>Unjoined:</p>
+        @foreach (var room in Unjoined) {
+            <p>@room.Room.RoomId</p>
+        }
+        @* <div style="margin-left: 8px;"> *@
+        @*     <RoomList Rooms="Children"></RoomList> *@
+        @* </div> *@
     }
 </details>
 
@@ -28,11 +36,14 @@
     }
 
     private ObservableCollection<RoomInfo> Children { get; set; } = new();
+    private Collection<RoomInfo> Unjoined { 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.Room.AsSpace.GetChildrenAsync();
+        var hs = await RMUStorage.GetCurrentSessionOrNavigate();
+        var joinedRooms = await hs.GetJoinedRooms();
         await foreach (var room in rooms) {
             if (Breadcrumbs.Contains(room.RoomId)) continue;
             var roomInfo = KnownRooms.FirstOrDefault(x => x.Room.RoomId == room.RoomId);
@@ -42,7 +53,9 @@
                 };
                 KnownRooms.Add(roomInfo);
             }
-            Children.Add(roomInfo);
+            if(joinedRooms.Any(x=>x.RoomId == room.RoomId))
+                Children.Add(roomInfo);
+            else Unjoined.Add(roomInfo);
         }
         await base.OnInitializedAsync();
     }