2022-09-11 18:28:12 +02:00
|
|
|
@page "/"
|
2024-06-06 05:19:14 +02:00
|
|
|
@using Markdig
|
2024-08-13 17:07:39 +02:00
|
|
|
@inject HttpClient Http
|
|
|
|
@inject BreadcrumbsStateContainer BreadcrumbsStateContainer
|
2022-09-05 23:42:13 +02:00
|
|
|
|
2024-06-06 05:19:14 +02:00
|
|
|
<MudGrid Class="my-8">
|
|
|
|
<MudItem xs="12">
|
|
|
|
<MudPaper Elevation="0" Outlined="true">
|
|
|
|
<div class="markdown-container">
|
|
|
|
@if (isLoading)
|
|
|
|
{
|
2024-08-13 17:07:39 +02:00
|
|
|
<MudProgressCircular/>
|
2024-06-06 05:19:14 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<div class="markdown-content">
|
|
|
|
@((MarkupString)markdownContent)
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</MudPaper>
|
|
|
|
</MudItem>
|
|
|
|
</MudGrid>
|
2022-09-05 23:42:13 +02:00
|
|
|
|
2024-06-06 05:19:14 +02:00
|
|
|
@code {
|
|
|
|
private string markdownContent = string.Empty;
|
|
|
|
private bool isLoading = true;
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
{
|
2024-06-06 05:53:33 +02:00
|
|
|
var pipeline = new MarkdownPipelineBuilder()
|
|
|
|
.UseAdvancedExtensions()
|
|
|
|
.UseEmojiAndSmiley()
|
|
|
|
.Build();
|
2024-06-06 05:19:14 +02:00
|
|
|
|
2024-06-06 06:12:41 +02:00
|
|
|
try
|
2024-06-06 05:19:14 +02:00
|
|
|
{
|
2024-06-06 06:12:41 +02: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 05:19:14 +02:00
|
|
|
}
|
2024-06-06 06:12:41 +02:00
|
|
|
|
2024-06-06 05:19:14 +02:00
|
|
|
isLoading = false;
|
2024-08-13 17:07:39 +02:00
|
|
|
|
|
|
|
BreadcrumbsStateContainer.breadcrumbs.Clear();
|
|
|
|
BreadcrumbsStateContainer.breadcrumbs.Add(new BreadcrumbItem(Localizer["Dashboard"], href: "/"));
|
|
|
|
BreadcrumbsStateContainer.NotifyStateChanged();
|
2024-06-06 05:19:14 +02:00
|
|
|
}
|
|
|
|
}
|