2025-05-25 11:27:22 +00:00
|
|
|
using AIStudio.Dialogs.Settings;
|
2024-09-08 19:01:51 +00:00
|
|
|
using AIStudio.Settings;
|
2025-05-24 10:27:00 +00:00
|
|
|
using AIStudio.Tools.PluginSystem;
|
2024-09-08 19:01:51 +00:00
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
2025-05-25 11:27:22 +00:00
|
|
|
using DialogOptions = AIStudio.Dialogs.DialogOptions;
|
|
|
|
|
2024-09-08 19:01:51 +00:00
|
|
|
namespace AIStudio.Components;
|
|
|
|
|
2025-04-27 07:06:05 +00:00
|
|
|
public partial class ProfileSelection : MSGComponentBase
|
2024-09-08 19:01:51 +00:00
|
|
|
{
|
2025-05-24 17:11:28 +00:00
|
|
|
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ProfileSelection).Namespace, nameof(ProfileSelection));
|
2025-05-24 10:27:00 +00:00
|
|
|
|
2024-09-08 19:01:51 +00:00
|
|
|
[Parameter]
|
|
|
|
public Profile CurrentProfile { get; set; } = Profile.NO_PROFILE;
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
public EventCallback<Profile> CurrentProfileChanged { get; set; }
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
public string MarginLeft { get; set; } = "ml-3";
|
2025-02-15 14:41:12 +00:00
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
public string MarginRight { get; set; } = string.Empty;
|
2024-09-08 19:01:51 +00:00
|
|
|
|
2025-05-24 10:27:00 +00:00
|
|
|
[Parameter]
|
|
|
|
public bool Disabled { get; set; }
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
public string DisabledText { get; set; } = string.Empty;
|
2025-05-25 11:27:22 +00:00
|
|
|
|
|
|
|
[Inject]
|
|
|
|
private IDialogService DialogService { get; init; } = null!;
|
2025-05-24 10:27:00 +00:00
|
|
|
|
|
|
|
private readonly string defaultToolTipText = TB("You can switch between your profiles here");
|
|
|
|
|
|
|
|
private string ToolTipText => this.Disabled ? this.DisabledText : this.defaultToolTipText;
|
|
|
|
|
2025-02-15 14:41:12 +00:00
|
|
|
private string MarginClass => $"{this.MarginLeft} {this.MarginRight}";
|
2024-09-08 19:01:51 +00:00
|
|
|
|
|
|
|
private async Task SelectionChanged(Profile profile)
|
|
|
|
{
|
|
|
|
this.CurrentProfile = profile;
|
|
|
|
await this.CurrentProfileChanged.InvokeAsync(profile);
|
|
|
|
}
|
2025-05-25 11:27:22 +00:00
|
|
|
|
|
|
|
private async Task OpenSettingsDialog()
|
|
|
|
{
|
|
|
|
var dialogParameters = new DialogParameters();
|
|
|
|
await this.DialogService.ShowAsync<SettingsDialogProfiles>(T("Open Profile Options"), dialogParameters, DialogOptions.FULLSCREEN);
|
|
|
|
}
|
2024-09-08 19:01:51 +00:00
|
|
|
}
|