1
0
mirror of synced 2025-01-28 19:15:54 +01:00

52 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-09-12 00:28:12 +08:00
@page "/"
@inject HttpClient Http
@using Markdig
2022-09-05 17:42:13 -04:00
<MudText Typo="Typo.h4">@Localizer["Dashboard"]</MudText>
<MudGrid Class="my-8">
<MudItem xs="12">
<MudPaper Elevation="0" Outlined="true">
<div class="markdown-container">
@if (isLoading)
{
<MudCircularProgress />
}
else
{
<div class="markdown-content">
@((MarkupString)markdownContent)
</div>
}
</div>
</MudPaper>
</MudItem>
</MudGrid>
2022-09-05 17:42:13 -04:00
@code {
private string markdownContent = string.Empty;
private bool isLoading = true;
protected override async Task OnInitializedAsync()
{
2024-06-05 23:53:33 -04:00
var pipeline = new MarkdownPipelineBuilder()
.UseAdvancedExtensions()
.UseEmojiAndSmiley()
.Build();
2024-06-06 00:12:41 -04:00
try
{
2024-06-06 00:12:41 -04:00
var markdown = await Http.GetStringAsync("Dashboard.md");
if (!string.IsNullOrWhiteSpace(markdown))
{
markdownContent = Markdown.ToHtml(markdown, pipeline);
}
}
catch (HttpRequestException)
{
markdownContent = "Error loading dashboard content.";
}
2024-06-06 00:12:41 -04:00
isLoading = false;
}
}