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.
137 lines
4.1 KiB
137 lines
4.1 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.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 { |
|
|
|
#if NO_SQL |
|
public List<GitPatchModel> Patches => GitService.GitPatchModels; |
|
|
|
public List<GitChangeModel> Changes => GitService.GitChangeModels; |
|
#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() |
|
{ |
|
await GitService.Load(); |
|
} |
|
|
|
} |