AI-Studio/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantButton.cs
nilskruthoff f6a128f2e4
Some checks are pending
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,deb,updater, appimage,deb) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,deb,updater, appimage,deb) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Added assistant plugins (#659)
2026-04-09 10:01:24 +02:00

92 lines
3.5 KiB
C#

using Lua;
namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
public sealed class AssistantButton : NamedAssistantComponentBase
{
public override AssistantComponentType Type => AssistantComponentType.BUTTON;
public override Dictionary<string, object> Props { get; set; } = new();
public override List<IAssistantComponent> Children { get; set; } = new();
public string Text
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Text));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Text), value);
}
public bool IsIconButton
{
get => AssistantComponentPropHelper.ReadBool(this.Props, nameof(this.IsIconButton));
set => AssistantComponentPropHelper.WriteBool(this.Props, nameof(this.IsIconButton), value);
}
public LuaFunction? Action
{
get => this.Props.TryGetValue(nameof(this.Action), out var value) && value is LuaFunction action ? action : null;
set => AssistantComponentPropHelper.WriteObject(this.Props, nameof(this.Action), value);
}
public string Variant
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Variant));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Variant), value);
}
public string Color
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Color));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Color), value);
}
public bool IsFullWidth
{
get => AssistantComponentPropHelper.ReadBool(this.Props, nameof(this.IsFullWidth));
set => AssistantComponentPropHelper.WriteBool(this.Props, nameof(this.IsFullWidth), value);
}
public string StartIcon
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.StartIcon));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.StartIcon), value);
}
public string EndIcon
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.EndIcon));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.EndIcon), value);
}
public string IconColor
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.IconColor));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.IconColor), value);
}
public string IconSize
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.IconSize));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.IconSize), value);
}
public string Size
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Size));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Size), value);
}
public string Class
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Class));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Class), value);
}
public string Style
{
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Style));
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Style), value);
}
public Variant GetButtonVariant() => Enum.TryParse<Variant>(this.Variant, out var variant) ? variant : MudBlazor.Variant.Filled;
}