diff options
Diffstat (limited to 'MatrixUtils.Web/Shared/RoomListComponents')
-rw-r--r-- | MatrixUtils.Web/Shared/RoomListComponents/RoomListCategory.razor | 11 | ||||
-rw-r--r-- | MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor | 17 |
2 files changed, 16 insertions, 12 deletions
diff --git a/MatrixUtils.Web/Shared/RoomListComponents/RoomListCategory.razor b/MatrixUtils.Web/Shared/RoomListComponents/RoomListCategory.razor index 3d0070f..4b24c18 100644 --- a/MatrixUtils.Web/Shared/RoomListComponents/RoomListCategory.razor +++ b/MatrixUtils.Web/Shared/RoomListComponents/RoomListCategory.razor @@ -16,6 +16,7 @@ <LinkButton href="@($"/Rooms/{room.Room.RoomId}/Timeline")">View timeline</LinkButton> <LinkButton href="@($"/Rooms/{room.Room.RoomId}/State/View")">View state</LinkButton> <LinkButton href="@($"/Rooms/{room.Room.RoomId}/State/Edit")">Edit state</LinkButton> + <LinkButton href="@($"/Tools/LeaveRoom?roomId={room.Room.RoomId}")" Color="#FF0000">Leave room</LinkButton> @if (room.CreationEventContent?.Type == "m.space") { <RoomListSpace Space="@room"></RoomListSpace> @@ -49,15 +50,5 @@ : RoomConstants.DangerousRoomVersions.Contains(roomVersionContent.RoomVersion) ? 2 : roomVersionContent.RoomVersion != RoomConstants.RecommendedRoomVersion ? 1 : 0; } - - public static string GetRoomTypeName(string roomType) { - return roomType switch { - null => "Room", - "m.space" => "Space", - "org.matrix.mjolnir.policy" => "Policy room", - - _ => roomType - }; - } } 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(); } |