2024-05-30 01:06:08 +00:00
|
|
|
@page "/person/{Address}"
|
2024-05-31 01:27:01 +00:00
|
|
|
<div class="row center-align">
|
|
|
|
<h3><i class="fa-solid fa-fw fa-at"></i>@Address</h3>
|
|
|
|
</div>
|
|
|
|
<div class="row center-align">
|
|
|
|
<img class="profile avatar" src="https://profiles.cache.lol/@Address/picture" alt="@Address" />
|
|
|
|
</div>
|
2024-05-30 01:06:08 +00:00
|
|
|
|
2024-05-31 01:27:01 +00:00
|
|
|
<div id="bio" class="center-align max">
|
|
|
|
@if (bio == null)
|
|
|
|
{
|
|
|
|
<p><em>Getting Bio...</em></p>
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
@bio
|
|
|
|
}
|
|
|
|
</div>
|
2024-05-30 01:06:08 +00:00
|
|
|
|
2024-06-05 12:41:08 +00:00
|
|
|
<div class="responsive">
|
|
|
|
<div class="tabs">
|
|
|
|
<a data-ui="#statuses" class="active">
|
|
|
|
<i class="fa-solid fa-message-smile"></i>
|
|
|
|
<span>Status.lol</span>
|
|
|
|
</a>
|
|
|
|
<a data-ui="#pics">
|
|
|
|
<i class="fa-solid fa-images"></i>
|
|
|
|
<span>Some.pics</span>
|
|
|
|
</a>
|
2024-05-30 01:06:08 +00:00
|
|
|
</div>
|
2024-06-05 12:41:08 +00:00
|
|
|
<div id="statuses" class="page padding active">
|
|
|
|
<StatusList StatusFunc="@GetStatuses"></StatusList>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="pics" class="page padding">
|
|
|
|
<PicList PicsFunc="@GetPics"></PicList>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-05-30 01:06:08 +00:00
|
|
|
|
|
|
|
@code {
|
|
|
|
[Parameter]
|
|
|
|
public string Address { get; set; }
|
|
|
|
|
2024-06-05 12:41:08 +00:00
|
|
|
private Status[] statuses;
|
2024-05-31 01:27:01 +00:00
|
|
|
private MarkupString? bio;
|
2024-05-30 01:06:08 +00:00
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync() {
|
|
|
|
RestService api = new RestService();
|
2024-05-31 01:27:01 +00:00
|
|
|
await GetBioAsync(api);
|
|
|
|
}
|
|
|
|
|
|
|
|
private async Task GetBioAsync(RestService api) {
|
2024-05-30 01:06:08 +00:00
|
|
|
bio = await api.StatuslogBio(Address);
|
|
|
|
}
|
2024-06-05 12:41:08 +00:00
|
|
|
|
|
|
|
public async ValueTask<ItemsProviderResult<Status>> GetStatuses(ItemsProviderRequest request) {
|
|
|
|
// TODO: request.cancellationToken
|
|
|
|
RestService api = new RestService();
|
|
|
|
statuses = (await api.Statuslog(Address)).ToArray() ?? new Status[0];
|
|
|
|
var numStatuses = Math.Min(request.Count, statuses.Length - request.StartIndex);
|
|
|
|
return new ItemsProviderResult<Status>(statuses.Skip(request.StartIndex).Take(numStatuses), statuses.Length);
|
|
|
|
}
|
|
|
|
|
|
|
|
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(Address);
|
|
|
|
var numPics = Math.Min(request.Count, pics.Count - request.StartIndex);
|
|
|
|
|
|
|
|
return new ItemsProviderResult<Pic>(pics.Skip(request.StartIndex).Take(numPics), pics.Count);
|
|
|
|
}
|
2024-05-30 01:06:08 +00:00
|
|
|
}
|