Neighbourhood.omg.lol/Components/Pages/Pics.razor

25 lines
745 B
Text

@page "/pics"
<div class="row center-align">
<h3>
Some.pics
</h3>
</div>
<div class="row center-align">
<p>Sit back, relax, and look at <a href="https://some.pics/">some.pics</a></p>
</div>
<div id="pics" class="responsive">
<PicList PicsFunc="@GetPics"></PicList>
</div>
@code {
private List<Pic> pics;
private async ValueTask<ItemsProviderResult<Pic>> GetPics(ItemsProviderRequest request) {
// TODO: request.cancellationToken
RestService api = new RestService();
if(pics == null || pics.Count == 0) pics = await api.SomePics();
var numPics = Math.Min(request.Count, pics.Count - request.StartIndex);
return new ItemsProviderResult<Pic>(pics.Skip(request.StartIndex).Take(numPics), pics.Count);
}
}