RoomStateRoomList.razor (1101B)
1 @page "/RoomStateViewer" 2 @inject ILocalStorageService LocalStorage 3 @inject NavigationManager NavigationManager 4 <h3>Room state viewer - Room list</h3> 5 <hr/> 6 @if (Rooms.Count == 0) 7 { 8 <p>You are not in any rooms!</p> 9 @* <p>Loading progress: @checkedRoomCount/@totalRoomCount</p> *@ 10 } 11 else 12 { 13 @foreach (var room in Rooms) 14 { 15 <a style="color: unset; text-decoration: unset;" href="/RoomStateViewer/@room.Replace('.','~')"><RoomListItem RoomId="@room"></RoomListItem></a> 16 } 17 <div style="margin-bottom: 4em;"></div> 18 } 19 20 <LogView></LogView> 21 22 @code { 23 public List<string> Rooms { get; set; } = new(); 24 protected override async Task OnInitializedAsync() 25 { 26 await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage); 27 await base.OnInitializedAsync(); 28 if (RuntimeCache.CurrentHomeServer == null) 29 { 30 NavigationManager.NavigateTo("/Login"); 31 return; 32 } 33 Rooms = (await RuntimeCache.CurrentHomeServer.GetJoinedRooms()).Select(x=>x.RoomId).ToList(); 34 Console.WriteLine("Fetched joined rooms!"); 35 } 36 }