1
0
mirror of synced 2024-12-03 18:47:21 +01:00
TaikoLocalServer/TaikoWebUI/Pages/Dashboard.razor
2024-06-06 00:12:41 -04:00

52 lines
1.3 KiB
Plaintext

@page "/"
@inject HttpClient Http
@using Markdig
<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>
@code {
private string markdownContent = string.Empty;
private bool isLoading = true;
protected override async Task OnInitializedAsync()
{
var pipeline = new MarkdownPipelineBuilder()
.UseAdvancedExtensions()
.UseEmojiAndSmiley()
.Build();
try
{
var markdown = await Http.GetStringAsync("Dashboard.md");
if (!string.IsNullOrWhiteSpace(markdown))
{
markdownContent = Markdown.ToHtml(markdown, pipeline);
}
}
catch (HttpRequestException)
{
markdownContent = "Error loading dashboard content.";
}
isLoading = false;
}
}