mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-08-21 03:52:57 +00:00
Refactor PandocDialog to simplify state management
This commit is contained in:
parent
1330519334
commit
a6703f108d
@ -128,7 +128,7 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
<MudItem Class="px-8 py-2" Style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;">
|
<MudItem Class="px-8 py-2" Style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;">
|
||||||
@if (this.showSkeleton)
|
@if (this.pandocInstallation == default)
|
||||||
{
|
{
|
||||||
<MudSkeleton SkeletonType="SkeletonType.Circle" Animation="Animation.Pulse" Class="mb-4" Style="width: 4em; height: 4em;"/>
|
<MudSkeleton SkeletonType="SkeletonType.Circle" Animation="Animation.Pulse" Class="mb-4" Style="width: 4em; height: 4em;"/>
|
||||||
<MudSkeleton SkeletonType="SkeletonType.Rectangle" Animation="Animation.Pulse" Width="230px" Height="35px"/>
|
<MudSkeleton SkeletonType="SkeletonType.Rectangle" Animation="Animation.Pulse" Width="230px" Height="35px"/>
|
||||||
|
@ -33,8 +33,7 @@ public partial class PandocDialog : ComponentBase
|
|||||||
private static readonly string LICENCE_URI = "https://raw.githubusercontent.com/jgm/pandoc/refs/heads/main/COPYING.md";
|
private static readonly string LICENCE_URI = "https://raw.githubusercontent.com/jgm/pandoc/refs/heads/main/COPYING.md";
|
||||||
private static string LATEST_PANDOC_VERSION = string.Empty;
|
private static string LATEST_PANDOC_VERSION = string.Empty;
|
||||||
|
|
||||||
private bool isPandocAvailable;
|
private PandocInstallation pandocInstallation;
|
||||||
private bool showSkeleton;
|
|
||||||
private bool showInstallPage;
|
private bool showInstallPage;
|
||||||
private string? licenseText;
|
private string? licenseText;
|
||||||
private bool isLoadingLicence;
|
private bool isLoadingLicence;
|
||||||
@ -49,7 +48,6 @@ public partial class PandocDialog : ComponentBase
|
|||||||
{
|
{
|
||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
|
|
||||||
this.showSkeleton = true;
|
|
||||||
LATEST_PANDOC_VERSION = await Pandoc.FetchLatestVersionAsync();
|
LATEST_PANDOC_VERSION = await Pandoc.FetchLatestVersionAsync();
|
||||||
await this.CheckPandocAvailabilityAsync();
|
await this.CheckPandocAvailabilityAsync();
|
||||||
}
|
}
|
||||||
@ -60,10 +58,7 @@ public partial class PandocDialog : ComponentBase
|
|||||||
|
|
||||||
private async Task CheckPandocAvailabilityAsync()
|
private async Task CheckPandocAvailabilityAsync()
|
||||||
{
|
{
|
||||||
var pandocInstallation = await Pandoc.CheckAvailabilityAsync(this.RustService);
|
this.pandocInstallation = await Pandoc.CheckAvailabilityAsync(this.RustService);
|
||||||
this.isPandocAvailable = pandocInstallation.IsAvailable;
|
|
||||||
this.showSkeleton = false;
|
|
||||||
|
|
||||||
await this.InvokeAsync(this.StateHasChanged);
|
await this.InvokeAsync(this.StateHasChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user