diff --git a/app/MindWork AI Studio/Components/CommonDialogs/DialogOptions.cs b/app/MindWork AI Studio/Components/CommonDialogs/DialogOptions.cs new file mode 100644 index 00000000..02a0e8c5 --- /dev/null +++ b/app/MindWork AI Studio/Components/CommonDialogs/DialogOptions.cs @@ -0,0 +1,17 @@ +namespace AIStudio.Components.CommonDialogs; + +public static class DialogOptions +{ + public static readonly MudBlazor.DialogOptions FULLSCREEN = new() + { + CloseOnEscapeKey = true, + FullWidth = true, MaxWidth = MaxWidth.Medium, + }; + + public static readonly MudBlazor.DialogOptions FULLSCREEN_NO_HEADER = new() + { + NoHeader = true, + CloseOnEscapeKey = true, + FullWidth = true, MaxWidth = MaxWidth.Medium, + }; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Pages/Settings.razor.cs b/app/MindWork AI Studio/Components/Pages/Settings.razor.cs index ee23e07f..13b06844 100644 --- a/app/MindWork AI Studio/Components/Pages/Settings.razor.cs +++ b/app/MindWork AI Studio/Components/Pages/Settings.razor.cs @@ -3,6 +3,8 @@ using AIStudio.Provider; using AIStudio.Settings; using Microsoft.AspNetCore.Components; +using DialogOptions = AIStudio.Components.CommonDialogs.DialogOptions; + // ReSharper disable ClassNeverInstantiated.Global namespace AIStudio.Components.Pages; @@ -18,22 +20,6 @@ public partial class Settings : ComponentBase [Inject] public IJSRuntime JsRuntime { get; init; } = null!; - private static readonly DialogOptions DIALOG_OPTIONS = new() - { - CloseOnEscapeKey = true, - FullWidth = true, MaxWidth = MaxWidth.Medium, - }; - - #region Overrides of ComponentBase - - protected override async Task OnInitializedAsync() - { - await this.SettingsManager.LoadSettings(); - await base.OnInitializedAsync(); - } - - #endregion - #region Provider related private async Task AddProvider() @@ -43,7 +29,7 @@ public partial class Settings : ComponentBase { x => x.IsEditing, false }, }; - var dialogReference = await this.DialogService.ShowAsync("Add Provider", dialogParameters, DIALOG_OPTIONS); + var dialogReference = await this.DialogService.ShowAsync("Add Provider", dialogParameters, DialogOptions.FULLSCREEN); var dialogResult = await dialogReference.Result; if (dialogResult.Canceled) return; @@ -67,7 +53,7 @@ public partial class Settings : ComponentBase { x => x.IsEditing, true }, }; - var dialogReference = await this.DialogService.ShowAsync("Edit Provider", dialogParameters, DIALOG_OPTIONS); + var dialogReference = await this.DialogService.ShowAsync("Edit Provider", dialogParameters, DialogOptions.FULLSCREEN); var dialogResult = await dialogReference.Result; if (dialogResult.Canceled) return; @@ -90,7 +76,7 @@ public partial class Settings : ComponentBase { "Message", $"Are you sure you want to delete the provider '{provider.InstanceName}'?" }, }; - var dialogReference = await this.DialogService.ShowAsync("Delete Provider", dialogParameters, DIALOG_OPTIONS); + var dialogReference = await this.DialogService.ShowAsync("Delete Provider", dialogParameters, DialogOptions.FULLSCREEN); var dialogResult = await dialogReference.Result; if (dialogResult.Canceled) return;