Change update notice rendering

This commit is contained in:
Canon
2026-05-22 18:57:42 +08:00
parent a0f74eb6c0
commit 1375ff79b6
+15 -5
View File
@@ -9,12 +9,22 @@ public static class AppUpdateNoticeRenderer
public static void Render(UpdateCheckResult updateResult)
{
var label = updateResult.IsPrerelease ? "Pre-release available" : "Update available";
var updateCommand = GetUpdateCommand();
var content = new Rows(
new Markup(
$"[yellow bold]{label}: v{Markup.Escape(updateResult.LatestVersion)}[/] [Grey66](current: [/][Grey66 dim bold]{Markup.Escape(updateResult.CurrentVersion)}[/][Grey66])[/]"),
new Markup($"[Grey66]Close this app before updating and run:[/] [underline]{Markup.Escape(updateCommand)}[/]"),
new Markup($"[Grey66]Manual download:[/] [link]{Markup.Escape(updateResult.ReleaseUrl)}[/]"));
AnsiConsole.MarkupLine(
$"[yellow bold]{label}: v{updateResult.LatestVersion}[/] [grey](current: {updateResult.CurrentVersion})[/]");
AnsiConsole.MarkupLine("[grey]Close this app before updating.[/]");
AnsiConsole.MarkupLine($"[grey]Run: {GetUpdateCommand()}[/]");
AnsiConsole.MarkupLine($"[grey]Manual download: {updateResult.ReleaseUrl}[/]");
var panel = new Panel(content)
{
Border = BoxBorder.Square,
BorderStyle = new Style(Color.Grey, null, Decoration.Dim)
};
panel.Padding = new Padding(1, 0, 1, 0);
panel.Expand = false;
AnsiConsole.Write(panel);
}
private static string GetUpdateCommand()