@page "/feed" @implements IDisposable @inject IJSRuntime JS @inject State State @inject NavigationManager Nav A feed of all the statuses and pics of the people you follow. @if(!(State.Following?.Any() ?? false)) { It looks like you're not following anyone yet.

Check out the Directory (or other parts of the app) to find awesome people to follow.

} else {
Timeline Following
@if (feed != null){ foreach (FeedItem item in feed) { if (item.IsStatus) { } else if (item.IsPic) { } else if (item.IsPaste) { } } }
} @code { private IOrderedEnumerable? feed; protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); string fragment = new Uri(Nav.Uri).Fragment; await JS.InvokeVoidAsync("ui", fragment); if (feed == null || feed.Count() == 0) feed = await State.GetFeed(); State.PropertyChanged += StateChanged; State.CanRefresh = true; await InvokeAsync(StateHasChanged); await JS.InvokeVoidAsync("removeElementById", "feedLoading"); } private async void StateChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(State.IsRefreshing) && State.IsRefreshing) { using (State.GetRefreshToken()) { feed = await State.GetFeed(true); await InvokeAsync(StateHasChanged); } } } public async Task UnfollowClick(string address) { await State.Unfollow(address); feed = await State.GetFeed(forceRefresh: true); await InvokeAsync(StateHasChanged); } public void Dispose() { State.PropertyChanged -= StateChanged; State.CanRefresh = false; } }