Neighbourhood.omg.lol/Components/Pages/Now.razor
Gordon Pedersen 0c3836b0c8 Simplify and standardise a lot of the loading
I was overcomplicating everything trying to reduce the render lag.
Just simplify it a bit. It works.
2024-06-13 14:46:24 +10:00

37 lines
1.1 KiB
Text

@page "/now"
@inject IJSRuntime JS
@inject State State
<PageHeading title="Now.garden" icon="fa-duotone fa-seedling">
<Description>Feel free to stroll through the <a href="now.garden">now.garden</a> and take a look at what people are up to.</Description>
</PageHeading>
<div id="now-garden" class="responsive card-grid">
@if (garden != null) {
foreach (NowData now in garden) {
<article class="now">
<nav>
<a class="author" href="/person/@now.Address#now">
<i class="fa-duotone fa-seedling"></i> @now.Address
</a>
</nav>
<nav>
<small>@now.UpdatedRelative</small>
</nav>
</article>
}
}
<LoadingCard id="now-loading" icon="fa-duotone fa-seedling" class="now"></LoadingCard>
</div>
@code {
private List<NowData>? garden;
protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync();
if (garden == null || garden.Count == 0) garden = await State.GetNowGarden();
await InvokeAsync(StateHasChanged);
await JS.InvokeVoidAsync("removeElementById", "now-loading");
}
}