diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor b/app/MindWork AI Studio/Components/AttachDocuments.razor index 37e5deea..e3d92385 100644 --- a/app/MindWork AI Studio/Components/AttachDocuments.razor +++ b/app/MindWork AI Studio/Components/AttachDocuments.razor @@ -8,15 +8,18 @@ } @if (fileInfos.Any()) { - - - + + + + + } else { diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs index 7d5aab76..533e6bef 100644 --- a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs +++ b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs @@ -1,4 +1,5 @@ using AIStudio.Dialogs; +using AIStudio.Tools.PluginSystem; using AIStudio.Tools.Rust; using AIStudio.Tools.Services; @@ -10,12 +11,24 @@ using DialogOptions = Dialogs.DialogOptions; public partial class AttachDocuments : MSGComponentBase { + private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ProfileSelection).Namespace, nameof(ProfileSelection)); + [Parameter] public string Name { get; set; } = string.Empty; + [Parameter] + public bool Disabled { get; set; } + + [Parameter] + public string DisabledText { get; set; } = string.Empty; + + private readonly string defaultToolTipText = TB("You can edit your files here"); + [Parameter] public HashSet DocumentPaths { get; set; } = []; + private string ToolTipText => this.Disabled ? this.DisabledText : this.defaultToolTipText; + [Parameter] public EventCallback> DocumentPathsChanged { get; set; } @@ -111,6 +124,18 @@ public partial class AttachDocuments : MSGComponentBase await this.DocumentPathsChanged.InvokeAsync(this.DocumentPaths); await this.OnChange(this.DocumentPaths); } + + private async Task OpenAttachmentsDialog() + { + var dialogParameters = new DialogParameters + { + { "DocumentPaths", this.DocumentPaths } + }; + var dialogReference = await this.DialogService.ShowAsync("Your Files", dialogParameters, DialogOptions.FULLSCREEN); + var dialogResult = await dialogReference.Result; + if (dialogResult is null || dialogResult.Canceled) + return; + } private async Task IsFileExtensionValid(string selectedFile) { diff --git a/app/MindWork AI Studio/Components/AttachmentsDialog.razor b/app/MindWork AI Studio/Components/AttachmentsDialog.razor new file mode 100644 index 00000000..d2cbc0c8 --- /dev/null +++ b/app/MindWork AI Studio/Components/AttachmentsDialog.razor @@ -0,0 +1,19 @@ +@inherits MSGComponentBase + + + + Your attached files + + + @foreach (var filePath in this.DocumentPaths) + { + + + } + + + Cancel + + \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/AttachmentsDialog.razor.cs b/app/MindWork AI Studio/Components/AttachmentsDialog.razor.cs new file mode 100644 index 00000000..a16ee904 --- /dev/null +++ b/app/MindWork AI Studio/Components/AttachmentsDialog.razor.cs @@ -0,0 +1,15 @@ +using Microsoft.AspNetCore.Components; + +namespace AIStudio.Components; + +public partial class AttachmentsDialog : MSGComponentBase +{ + [CascadingParameter] + private IMudDialogInstance MudDialog { get; set; } = null!; + + [Parameter] + public HashSet DocumentPaths { get; set; } = new(); + + private void Cancel() => this.MudDialog.Cancel(); + +} \ No newline at end of file