Fan website of IMMORTAL: Gates of Pyre.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

127 lines
3.9 KiB

@page "/changelog"
@implements IDisposable;
@inject IGitService GitService;
@layout PageLayout
@if (GitService.IsLoaded()) {
<LayoutMediumContentComponent>
<WebsiteTitleComponent>Change Log</WebsiteTitleComponent>
<PaperComponent>
<FormLayoutComponent>
<FormCheckboxComponent Label="Show Important"
Info="Only show important patches. Like database updates to the latest game patch."
Value="@isViewImportant"
OnChange="OnChangeClicked">
</FormCheckboxComponent>
</FormLayoutComponent>
</PaperComponent>
<PaperComponent>
@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);
<div class="patchContainer">
<div style="display: flex; justify-content: space-between;">
<div style="font-size: 1.2rem; font-weight: bolder; margin-bottom:4px;">
@patch.Name
</div>
<div>
@if (daysAgo == 0) {
<i>Today</i>
}
else if (daysAgo < 8) {
<i>@daysAgo days ago</i>
}
else {
<i>@patch.Date.ToString("dd/MM/yyyy")</i>
}
</div>
</div>
<div>
@foreach (var change in Changes.FindAll(e => e.PatchModelId == patch.Id)) {
@if (!change.Important.Equals("True") && isViewImportant) {
continue;
}
<div style="display: flex; justify-content: space-between; ">
<div>
<div>
<b>
<span>- @change.Name </span>
@if (change.Commit != CommitType.None) {
<span>(@change.Commit)</span>
}
<span>: </span>
</b> @((MarkupString)change.Description)
</div>
</div>
</div>
}
</div>
</div>
}
</PaperComponent>
</LayoutMediumContentComponent>
}
else {
<LoadingComponent></LoadingComponent>
}
@code {
#if NO_SQL
public List<PatchModel> Patches => GitService.PatchModels;
public List<ChangeModel> Changes => GitService.ChangeModels;
#else
[Inject]
DatabaseContext Database { get; set; }
[Parameter]
public DbSet<PatchModel> Patches { get; set; }
[Parameter]
public DbSet<ChangeModel> Changes { get; set; }
#endif
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;
}
void HasChanged() {
StateHasChanged();
}
protected override async Task OnInitializedAsync() {
#if NO_SQL
GitService.Load();
#else
GitService.Load(Database);
#endif
}
}