2024-06-11 00:36:48 +00:00
|
|
|
@page "/now"
|
2024-06-18 01:44:18 +00:00
|
|
|
@implements IDisposable
|
2024-06-13 04:46:24 +00:00
|
|
|
@inject IJSRuntime JS
|
2024-06-11 00:36:48 +00:00
|
|
|
@inject State State
|
2024-06-18 01:44:18 +00:00
|
|
|
|
|
|
|
<RefreshButton></RefreshButton>
|
|
|
|
|
2024-06-13 04:46:24 +00:00
|
|
|
<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>
|
2024-06-11 00:36:48 +00:00
|
|
|
|
|
|
|
<div id="now-garden" class="responsive card-grid">
|
2024-06-13 04:46:24 +00:00
|
|
|
|
|
|
|
@if (garden != null) {
|
|
|
|
foreach (NowData now in garden) {
|
2024-06-11 00:36:48 +00:00
|
|
|
<article class="now">
|
|
|
|
<nav>
|
|
|
|
<a class="author" href="/person/@now.Address#now">
|
2024-06-13 06:35:40 +00:00
|
|
|
<h6><i class="fa-duotone fa-seedling"></i> @now.Address</h6>
|
2024-06-11 00:36:48 +00:00
|
|
|
</a>
|
|
|
|
</nav>
|
|
|
|
<nav>
|
|
|
|
<small>@now.UpdatedRelative</small>
|
|
|
|
</nav>
|
|
|
|
</article>
|
2024-06-13 04:46:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
<LoadingCard id="now-loading" icon="fa-duotone fa-seedling" class="now"></LoadingCard>
|
|
|
|
|
2024-06-11 00:36:48 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
@code {
|
2024-06-13 04:46:24 +00:00
|
|
|
private List<NowData>? garden;
|
2024-06-11 00:36:48 +00:00
|
|
|
|
2024-06-13 04:46:24 +00:00
|
|
|
protected override async Task OnInitializedAsync() {
|
|
|
|
await base.OnInitializedAsync();
|
|
|
|
if (garden == null || garden.Count == 0) garden = await State.GetNowGarden();
|
2024-06-18 01:44:18 +00:00
|
|
|
State.PropertyChanged += StateChanged;
|
|
|
|
State.CanRefresh = true;
|
2024-06-13 04:46:24 +00:00
|
|
|
await InvokeAsync(StateHasChanged);
|
|
|
|
await JS.InvokeVoidAsync("removeElementById", "now-loading");
|
|
|
|
}
|
2024-06-18 01:44:18 +00:00
|
|
|
|
|
|
|
private async void StateChanged(object? sender, PropertyChangedEventArgs e) {
|
|
|
|
if (e.PropertyName == nameof(State.IsRefreshing) && State.IsRefreshing) {
|
|
|
|
garden = await State.GetNowGarden(true);
|
|
|
|
State.IsRefreshing = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose() {
|
|
|
|
State.PropertyChanged -= StateChanged;
|
|
|
|
State.CanRefresh = false;
|
|
|
|
}
|
2024-06-11 00:36:48 +00:00
|
|
|
}
|