AI-Studio/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor

96 lines
4.9 KiB
Plaintext
Raw Normal View History

@inherits MSGComponentBase
<MudDialog>
<TitleContent>
<MudText Typo="Typo.h4">
@T("Your attached files")
</MudText>
</TitleContent>
<DialogContent>
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
@T("Here you can see all attached files. Files that can no longer be found (deleted, renamed, or moved) are marked with a warning icon and a strikethrough name. You can remove any attachment using the trash can icon.")
</MudJustifiedText>
<MudDivider Class="mt-3 mb-3"/>
<div style="max-height: 50vh; overflow-y: auto; overflow-x: hidden; padding-right: 8px;">
@if (!this.DocumentPaths.Any())
{
<MudJustifiedText Typo="Typo.body1" Class="mt-3">
@T("There aren't any file attachments available right now.")
</MudJustifiedText>
}
@{
var currentFolder = string.Empty;
foreach (var filePath in this.DocumentPaths)
{
var folderPath = Path.GetDirectoryName(filePath);
if (folderPath != currentFolder)
{
currentFolder = folderPath;
<MudStack Row="true" AlignItems="AlignItems.Center" Class="mt-6 mb-3">
<MudIcon Icon="@Icons.Material.Filled.Folder" Class="mr-2" />
<MudText Typo="Typo.h6">
@folderPath:
</MudText>
</MudStack>
}
@if (File.Exists(filePath))
{
<MudStack Row Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center" Class="ms-3 mb-2">
<div style="min-width: 0; flex: 1; overflow: hidden;">
<MudTooltip Text="@T("Your attached file.")" Placement="Placement.Bottom">
<span class="d-inline-flex align-items-center" style="overflow: hidden; width: 100%;">
<MudIcon Icon="@Icons.Material.Filled.AttachFile" Class="mr-2" Style="flex-shrink: 0;"/>
<MudText Style="white-space: nowrap;">
@Path.GetFileName(filePath)
</MudText>
</span>
</MudTooltip>
</div>
<MudTooltip Text="@T("Remove this attachment.")" Placement="Placement.Bottom">
<MudIconButton Icon="@Icons.Material.Filled.Delete"
Color="Color.Error"
Class="ml-2"
Style="flex-shrink: 0;"
OnClick="@(() => this.DeleteAttachment(filePath))"/>
</MudTooltip>
</MudStack>
}
else
{
<MudStack Row Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center" Class="ms-3 mb-2">
<div style="min-width: 0; flex: 1; overflow: hidden;">
<MudTooltip Text="@T("The file was deleted, renamed, or moved.")" Placement="Placement.Bottom">
<span class="d-inline-flex align-items-center" style="overflow: hidden; width: 100%;">
<MudIcon Icon="@Icons.Material.Filled.Report" Color="Color.Error" Class="mr-2" Style="flex-shrink: 0;"/>
<MudText Style="white-space: nowrap;">
<s>@Path.GetFileName(filePath)</s>
</MudText>
</span>
</MudTooltip>
</div>
<MudTooltip Text="@T("Remove this attachment.")" Placement="Placement.Bottom">
<MudIconButton Icon="@Icons.Material.Filled.Delete"
Color="Color.Error"
Class="ml-2"
Style="flex-shrink: 0;"
OnClick="@(() => this.DeleteAttachment(filePath))"/>
</MudTooltip>
</MudStack>
}
}
}
</div>
</DialogContent>
<DialogActions>
<MudButton OnClick="@this.Close" Variant="Variant.Filled" Color="Color.Primary">
Close
</MudButton>
</DialogActions>
</MudDialog>