67 lines
2.0 KiB
Plaintext
67 lines
2.0 KiB
Plaintext
@using Core.Entities
|
|
@using WebApp.Services
|
|
@using MudBlazor
|
|
|
|
<MudDialog Class="@MarkdownHelper.GetNoteColorClass(_history.NoteId)">
|
|
<DialogContent>
|
|
<MudStack Spacing="3">
|
|
<MudText Typo="Typo.h6">@_history.Title</MudText>
|
|
<MudText Typo="Typo.body2" Color="Color.Secondary">
|
|
Modified: @_history.ModifiedAt.ToString("g") by @(_history.ModifiedBy ?? "Unknown")
|
|
</MudText>
|
|
<MudChip T="string" Size="Size.Small" Color="@GetChangeTypeColor(_history.ChangeType)">
|
|
@_history.ChangeType
|
|
</MudChip>
|
|
<MudDivider />
|
|
@if (!string.IsNullOrWhiteSpace(_history.Content))
|
|
{
|
|
<MudPaper Elevation="0" Class="pa-3" Style="background-color: var(--mud-palette-background-grey);">
|
|
<div class="markdown-content">
|
|
@((MarkupString)MarkdownHelper.ToHtml(_history.Content))
|
|
</div>
|
|
</MudPaper>
|
|
}
|
|
else
|
|
{
|
|
<MudText Typo="Typo.body2" Color="Color.Secondary" Align="Align.Center" Class="my-4">
|
|
No content in this version.
|
|
</MudText>
|
|
}
|
|
</MudStack>
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<MudButton OnClick="Close">Close</MudButton>
|
|
</DialogActions>
|
|
</MudDialog>
|
|
|
|
@code {
|
|
[CascadingParameter]
|
|
IMudDialogInstance MudDialog { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public NoteHistory History { get; set; } = null!;
|
|
|
|
private NoteHistory _history = null!;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
_history = History;
|
|
}
|
|
|
|
private Color GetChangeTypeColor(string changeType)
|
|
{
|
|
return changeType switch
|
|
{
|
|
"Created" => Color.Success,
|
|
"Updated" => Color.Info,
|
|
"Deleted" => Color.Error,
|
|
_ => Color.Default
|
|
};
|
|
}
|
|
|
|
private void Close()
|
|
{
|
|
MudDialog.Close();
|
|
}
|
|
}
|