5c4aaf91df
This commit introduces the Note and NoteHistory entities, along with their respective configurations for Entity Framework Core. The AppDbContext has been updated to include DbSet properties for both entities. A new INotesService interface and its implementation, NotesService, have been created to handle CRUD operations for notes, including history tracking. Additionally, several Blazor components have been added for note management, including dialogs for editing notes and viewing note history. The UI has been enhanced to support markdown content rendering and improved user interaction for note creation and editing. These changes contribute to a comprehensive note-taking feature within the application.
67 lines
1.9 KiB
Plaintext
67 lines
1.9 KiB
Plaintext
@using Core.Entities
|
|
@using WebApp.Services
|
|
@using MudBlazor
|
|
|
|
<MudDialog>
|
|
<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();
|
|
}
|
|
}
|