Add profiles (#132)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2024-09-08 21:01:51 +02:00
1 parent 00f45f8998
commit d7c124926b
32 files changed
+659 -36

No files matched your search

@@ -0,0 +1,16 @@
namespace AIStudio.Components;
public class MudJustifiedText : MudText
{
#region Overrides of ComponentBase
protected override async Task OnInitializedAsync()
{
this.Align = Align.Justify;
this.Style = "hyphens: auto; word-break: auto-phrase;";
await base.OnInitializedAsync();
}
#endregion
}
@@ -2,7 +2,7 @@
@foreach(var item in this.Items)
{
<MudListItem T="string" Icon="@this.Icon" Style="display: flex; align-items: flex-start;">
<MudText Typo="Typo.body1" Style="text-align: justify; hyphens: auto;"><b>@item.Header:</b> @item.Text</MudText>
<MudText Typo="Typo.body1" Align="Align.Justify" Style="hyphens: auto; word-break: auto-phrase;"><b>@item.Header:</b> @item.Text</MudText>
</MudListItem>
}
</MudList>
@@ -0,0 +1,10 @@
<MudTooltip Text="You can switch between your profiles here">
<MudMenu StartIcon="@Icons.Material.Filled.Person4" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@this.CurrentProfile.Name" Variant="Variant.Filled" Color="Color.Default" Class="@this.MarginClass">
@foreach (var profile in this.SettingsManager.ConfigurationData.Profiles.GetAllProfiles())
{
<MudMenuItem OnClick="() => this.SelectionChanged(profile)">
@profile.Name
</MudMenuItem>
}
</MudMenu>
</MudTooltip>
@@ -0,0 +1,28 @@
using AIStudio.Settings;
using Microsoft.AspNetCore.Components;
namespace AIStudio.Components;
public partial class ProfileSelection : ComponentBase
{
[Parameter]
public Profile CurrentProfile { get; set; } = Profile.NO_PROFILE;
[Parameter]
public EventCallback<Profile> CurrentProfileChanged { get; set; }
[Parameter]
public string MarginLeft { get; set; } = "ml-3";
[Inject]
private SettingsManager SettingsManager { get; init; } = null!;
private string MarginClass => $"{this.MarginLeft}";
private async Task SelectionChanged(Profile profile)
{
this.CurrentProfile = profile;
await this.CurrentProfileChanged.InvokeAsync(profile);
}
}