Refine Pandoc button color logic

This commit is contained in:
Thorsten Sommer 2025-05-30 18:35:31 +02:00
parent 9cacdf7141
commit ec0c783cfc
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 19 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<MudJustifiedText Typo="Typo.body1"> <MudJustifiedText Typo="Typo.body1">
@this.DetermineIntroText() @this.DetermineIntroText()
</MudJustifiedText> </MudJustifiedText>
<MudButton Color="Color.Default" Variant="Variant.Filled" OnClick="() => this.ShowPandocDialogAsync()"> <MudButton Color="@this.DetermineButtonColor()" Variant="Variant.Filled" OnClick="() => this.ShowPandocDialogAsync()">
@this.DetermineButtonText() @this.DetermineButtonText()
</MudButton> </MudButton>
</MudStack> </MudStack>

View File

@ -30,6 +30,24 @@ public partial class ManagePandocDependency : MSGComponentBase
#endregion #endregion
private Color DetermineButtonColor()
{
if (this.pandocInstallation == default)
return Color.Default;
switch (this.pandocInstallation)
{
case { CheckWasSuccessful: true, IsAvailable: true }:
return Color.Default;
case { CheckWasSuccessful: true, IsAvailable: false }:
return Color.Warning;
case { CheckWasSuccessful: false }:
return Color.Error;
}
}
private string DetermineButtonText() private string DetermineButtonText()
{ {
if(this.pandocInstallation == default) if(this.pandocInstallation == default)