@page "/person/{Address}" @inject State State @inject IJSRuntime JS @inject NavigationManager Nav

@Address

@Address
@if (FeatureFlags.Following) {
@if (State.IsFollowing(Address)) { } else { }
}
@(Address).omg.lol Status.lol Some.pics @if(now != null || IsMe){ /Now }
Open in browser
@if(bio == null || !string.IsNullOrEmpty(bio.ToString())) {
@if (bio == null) {

} else { @bio }
} @if(IsMe) { }
@if (IsMe) { }
@if(now != null || IsMe){
Open in browser @if (IsMe) { Edit }
}
@code { private string _address; [Parameter] public string Address { get => _address; set { _address = value; if (StatusList != null) StatusList.StatusFunc = async (refresh) => await State.GetStatuses(_address, refresh); if (PicList != null) PicList.PicsFunc = async (refresh) => await State.GetPics(_address, refresh); } } public string ProfileUrl { get => $"https://{Address}.omg.lol/"; } public string NowPageUrl { get => now?.Url ?? $"https://{Address}.omg.lol/now"; } public ExternalPageComponent? NowPage { get; set; } public ExternalPageComponent? ProfilePage { get; set; } private StatusList StatusList { get; set; } private PicList PicList { get; set; } private bool IsMe { get => Address == State.SelectedAddressName; } private MarkupString? bio; private NowData? now; protected override async Task OnInitializedAsync() { List? garden = await State.GetNowGarden(); now = garden?.FirstOrDefault(n => n.Address == Address); await InvokeAsync(StateHasChanged); string fragment = new Uri(Nav.Uri).Fragment; await JS.InvokeVoidAsync("ui", fragment); if (fragment.EndsWith("now")) await ReloadNow(); else if (fragment.EndsWith("profile")) await ReloadProfile(); bio = await State.GetBio(Address); State.PropertyChanged += StateChanged; } private async void StateChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(State.IsRefreshing) && State.IsRefreshing) { using (State.GetRefreshToken()){ await ReloadNow(); await ReloadProfile(); bio = await State.GetBio(Address); await InvokeAsync(StateHasChanged); } } } private async Task ReloadNow() { if(NowPage != null) { await NowPage.Reload(); await ResizeIframes(); } } private async Task ReloadProfile() { if (ProfilePage != null) { await ProfilePage.Reload(); await ResizeIframes(); } } private async Task ResizeIframes() { await JS.InvokeVoidAsync("iframeResize", new { license = "GPLv3" }); } }