blob: 73dc3342b5caee02b5d0ce15abd6c54df7a8c3e4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<LinkButton href="@($"/Rooms/{Space.RoomId}/Space")">Manage space</LinkButton>
<br/>
<details @ontoggle="SpaceChildrenOpened">
<summary>@Children.Count children</summary>
@if (_shouldRenderChildren) {
<p>Breadcrumb: @Breadcrumbs</p>
<div style="margin-left: 8px;">
<RoomList Rooms="Children"></RoomList>
</div>
}
</details>
@code {
[Parameter]
public GenericRoom Space { get; set; }
[Parameter, CascadingParameter]
public string? Breadcrumbs {
get => _breadcrumbs + Space.RoomId;
set => _breadcrumbs = value;
}
private List<GenericRoom> 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();
await foreach (var room in rooms) {
if(Breadcrumbs.Contains(room.RoomId)) continue;
Children.Add(room);
}
await base.OnInitializedAsync();
}
private bool _shouldRenderChildren = false;
private string? _breadcrumbs;
private async Task SpaceChildrenOpened() {
if (_shouldRenderChildren) return;
_shouldRenderChildren = true;
Console.WriteLine($"[RoomList] Rendering children of {Space.RoomId}");
}
}
|