mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-27 23:19:46 +00:00
Added changelog component
This commit is contained in:
parent
cac0ecc7e2
commit
df8f207e7f
23
app/MindWork AI Studio/Components/Blocks/Changelog.Logs.cs
Normal file
23
app/MindWork AI Studio/Components/Blocks/Changelog.Logs.cs
Normal file
@ -0,0 +1,23 @@
|
||||
namespace AIStudio.Components.Blocks;
|
||||
|
||||
public partial class Changelog
|
||||
{
|
||||
public readonly record struct Log(int Build, string Display, string Filename)
|
||||
{
|
||||
#region Overrides of ValueType
|
||||
|
||||
public override string ToString() => this.Display;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static readonly Log[] LOGS =
|
||||
[
|
||||
new (149, "v0.5.0, build 149 (2024-06-?? ??:?? UTC)", "v0.5.0.md"),
|
||||
new (138, "v0.4.0, build 138 (2024-05-26 13:26 UTC)", "v0.4.0.md"),
|
||||
new (120, "v0.3.0, build 120 (2024-05-18 21:57 UTC)", "v0.3.0.md"),
|
||||
new (90, "v0.2.0, build 90 (2024-05-04 10:50 UTC)", "v0.2.0.md"),
|
||||
new (45, "v0.1.0, build 45 (2024-04-20 21:27 UTC)", "v0.1.0.md"),
|
||||
|
||||
];
|
||||
}
|
9
app/MindWork AI Studio/Components/Blocks/Changelog.razor
Normal file
9
app/MindWork AI Studio/Components/Blocks/Changelog.razor
Normal file
@ -0,0 +1,9 @@
|
||||
@using AIStudio.Tools
|
||||
<MudSelect T="Log" @bind-Value="@this.SelectedLog" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Schedule" Margin="Margin.Dense" Label="Changelog" Class="mb-2 rounded-lg" Variant="Variant.Outlined" SelectedValuesChanged="() => this.ReadLogAsync()" OnKeyUp="() => this.ReadLogAsync()">
|
||||
@foreach (var log in LOGS)
|
||||
{
|
||||
<MudSelectItem Value="@log"/>
|
||||
}
|
||||
</MudSelect>
|
||||
|
||||
<MudMarkdown Value="@this.LogContent" OverrideHeaderTypo="@Markdown.OverrideHeaderTypo"/>
|
29
app/MindWork AI Studio/Components/Blocks/Changelog.razor.cs
Normal file
29
app/MindWork AI Studio/Components/Blocks/Changelog.razor.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Components.Blocks;
|
||||
|
||||
public partial class Changelog : ComponentBase
|
||||
{
|
||||
[Inject]
|
||||
private HttpClient HttpClient { get; set; } = null!;
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await this.ReadLogAsync();
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Log SelectedLog { get; set; } = LOGS.MaxBy(n => n.Build);
|
||||
|
||||
private string LogContent { get; set; } = string.Empty;
|
||||
|
||||
private async Task ReadLogAsync()
|
||||
{
|
||||
var response = await this.HttpClient.GetAsync($"changelog/{this.SelectedLog.Filename}");
|
||||
this.LogContent = await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user