AI-Studio/app/MindWork AI Studio/Components/ProfileSelection.razor.cs

40 lines
1.2 KiB
C#
Raw Normal View History

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;
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";
[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;
private readonly string defaultToolTipText = TB("You can switch between your profiles here");
private string ToolTipText => this.Disabled ? this.DisabledText : this.defaultToolTipText;
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);
}
}