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.
 
 
 
 

133 lines
4.0 KiB

@page "/changelog"
@implements IDisposable;
@inject IGitService GitService;
@inherits BasePage
@inject IDataCollectionService DataCollectionService
@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.GitPatchModelId == 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/>
}
@code {
private IEnumerable<GitPatchModel> Patches => GitService.GitPatchModels;
private List<GitChangeModel> Changes => GitService.GitChangeModels;
private bool isViewImportant = true;
protected override void OnInitialized()
{
base.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();
}
}