@page "/changelog" @implements IDisposable; @inject IGitService gitService; @layout PageLayout @if (gitService.IsLoaded()) { Change Log @foreach (var patch in Patches.OrderBy(x => x.Date).Reverse()) { @if (!patch.Important.Equals("True") && isViewImportant) { continue; } var daysAgo = Math.Floor(DateTime.Now.Subtract(patch.Date).TotalDays);
@patch.Name
@if (daysAgo == 0) { Today } else if (daysAgo < 8) { @daysAgo days ago } else { @patch.Date.ToString("dd/MM/yyyy") }
@foreach (var change in Changes.FindAll(e => e.GitPatchModelId == patch.Id)) { @if (!change.Important.Equals("True") && isViewImportant) { continue; }
- @change.Name @if (change.Commit != CommitType.None) { (@change.Commit) } : @((MarkupString)change.Description)
}
}
} else { } @code { private IEnumerable Patches => gitService.GitPatchModels; private List Changes => gitService.GitChangeModels; private bool isViewImportant = true; protected override void OnInitialized() { gitService.Subscribe(HasChanged); } void IDisposable.Dispose() { gitService.Unsubscribe(HasChanged); } void OnChangeClicked(ChangeEventArgs changeEventArgs) { isViewImportant = (bool)changeEventArgs.Value!; StateHasChanged(); } void HasChanged() { StateHasChanged(); } protected override async Task OnInitializedAsync() { await gitService.Load(); } }