diff --git a/app/MindWork AI Studio/Components/Blocks/Changelog.Logs.cs b/app/MindWork AI Studio/Components/Blocks/Changelog.Logs.cs new file mode 100644 index 00000000..7a941cad --- /dev/null +++ b/app/MindWork AI Studio/Components/Blocks/Changelog.Logs.cs @@ -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"), + + ]; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Blocks/Changelog.razor b/app/MindWork AI Studio/Components/Blocks/Changelog.razor new file mode 100644 index 00000000..1c75ce9f --- /dev/null +++ b/app/MindWork AI Studio/Components/Blocks/Changelog.razor @@ -0,0 +1,9 @@ +@using AIStudio.Tools + + @foreach (var log in LOGS) + { + + } + + + \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Blocks/Changelog.razor.cs b/app/MindWork AI Studio/Components/Blocks/Changelog.razor.cs new file mode 100644 index 00000000..97631b7e --- /dev/null +++ b/app/MindWork AI Studio/Components/Blocks/Changelog.razor.cs @@ -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(); + } +} \ No newline at end of file