AI-Studio/app/MindWork AI Studio/Components/LockableButton.razor.cs
nilskruthoff 8a9e6aeb87
Some checks are pending
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (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,updater, appimage) (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,app,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,updater, appimage) (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 export and import of plugin archives (#885)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
2026-08-06 10:42:20 +02:00

67 lines
1.8 KiB
C#

using Microsoft.AspNetCore.Components;
namespace AIStudio.Components;
public partial class LockableButton : ConfigurationBaseCore
{
[Parameter]
public string Icon { get; set; } = Icons.Material.Filled.Info;
[Parameter]
public Func<Task> OnClickAsync { get; set; } = () => Task.CompletedTask;
[Parameter]
public Action OnClick { get; set; } = () => { };
[Parameter]
public string Text { get; set; } = string.Empty;
[Parameter]
public string Class { get; set; } = string.Empty;
/// <summary>
/// An optional tooltip for the button. It is not shown while the button is locked,
/// because the lock icon explains the situation in that case.
/// </summary>
[Parameter]
public string Tooltip { get; set; } = string.Empty;
/// <summary>
/// The visual variant of the button.
/// </summary>
[Parameter]
public Variant ButtonVariant { get; set; } = Variant.Filled;
/// <summary>
/// The color of the button.
/// </summary>
[Parameter]
public Color ButtonColor { get; set; } = Color.Primary;
/// <summary>
/// Should the default bottom margin be removed? Useful when the button is placed in a
/// toolbar instead of a settings panel.
/// </summary>
[Parameter]
public bool NoMargin { get; set; }
#region Overrides of ConfigurationBase
/// <inheritdoc />
protected override bool Stretch => false;
protected override string GetClassForBase => this.Class;
protected override string MarginClass => this.NoMargin ? string.Empty : base.MarginClass;
#endregion
private async Task ClickAsync()
{
if (this.IsLocked() || this.Disabled())
return;
await this.OnClickAsync();
this.OnClick();
}
}