AI-Studio/app/MindWork AI Studio/Components/SourcesList.razor

39 lines
1.7 KiB
Plaintext
Raw Normal View History

@inherits MSGComponentBase
@* The class is what the Markdown renderer wraps its own output in, so the headings and the list
keep the look they had while this list was Markdown. *@
<div @ref="this.listElement" class="mud-markdown-body">
@foreach (var group in this.groups)
{
@* A level-two heading was shown as h5 while this list was Markdown, because that is what
Markdown.DefaultConfig overrides it to. The heading keeps that size here. *@
<MudText Typo="Typo.h5">
@group.Heading
</MudText>
<ul>
@foreach (var entry in group.Entries)
{
<li>
@($"[{entry.Number}] ")
@if (entry.Document is { } document)
{
<MudTooltip Text="@T("Opens this document in the program your system uses for it")" Placement="Placement.Top">
<MudLink Typo="Typo.body1" OnClick="@(() => this.OpenDocument(document))">
@entry.Title
</MudLink>
</MudTooltip>
<MudTooltip Text="@T("Show this file in the file manager of your system")" Placement="Placement.Top">
<MudIconButton Icon="@Icons.Material.Filled.FolderOpen" Size="Size.Small" OnClick="@(() => this.ShowInFileManager(document))"/>
</MudTooltip>
}
else
{
<MudLink Href="@entry.Link" Target="_blank" Typo="Typo.body1">
@entry.Title
</MudLink>
}
</li>
}
</ul>
}
</div>