feat(update): show release notes + version-card layout in update notice
The update notice dialog now mirrors what GitHub publishes: side-by-side
Installed → Latest version cards (the new one accent-tinted to draw the
eye) and a scrollable release-notes panel under them. Light markdown
rendering covers `##` headings, bullet lists, and inline bold/code
markers — enough for the GitHub release body format we ship.
- update_check::check_for_update() returns UpdateInfo { version, body };
body is parsed from the releases API JSON with a tiny custom
string-field extractor (\n / \" / \u handling) so we keep the
serde_json-free dependency footprint.
- Window grows from 480x240 to 560x460 and becomes resizable to make
room for the notes scroller.
- Layout tightens: header bottom padding drops 14 → 6, notes heading
10, and the notes block is wrapped in a Fill-height container so it
claims every leftover pixel — no more dead space between heading and
footer.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
c98e9ebd76
commit
2357b39a1d
5 changed files with 255 additions and 53 deletions
|
|
@ -104,6 +104,10 @@ pub(super) struct H7CAD {
|
|||
/// Tag of the latest available release (without the leading "v"),
|
||||
/// e.g. `"0.3.0"`. `None` when up-to-date or check hasn't returned.
|
||||
update_notice_version: Option<String>,
|
||||
/// Release-notes body for the version above (GitHub release "body"
|
||||
/// markdown, as returned by the API). May be empty when the release
|
||||
/// shipped without notes.
|
||||
update_notice_body: Option<String>,
|
||||
/// In-memory clipboard: cloned entities waiting to be pasted.
|
||||
clipboard: Vec<acadrust::EntityType>,
|
||||
/// Centroid of the clipboard entities (XZ plane, Y-up).
|
||||
|
|
@ -542,7 +546,7 @@ pub enum Message {
|
|||
Noop,
|
||||
/// GitHub releases API returned a result. `Some(version)` means a
|
||||
/// newer release exists; we open the update-notice window.
|
||||
UpdateCheckResult(Option<String>),
|
||||
UpdateCheckResult(Option<crate::update_check::UpdateInfo>),
|
||||
/// User dismissed the update-notice window.
|
||||
UpdateNoticeClose,
|
||||
/// User clicked the "Open release page" button — opens the GitHub
|
||||
|
|
@ -739,6 +743,7 @@ impl H7CAD {
|
|||
about_window: None,
|
||||
update_notice_window: None,
|
||||
update_notice_version: None,
|
||||
update_notice_body: None,
|
||||
clipboard: Vec::new(),
|
||||
clipboard_centroid: glam::Vec3::ZERO,
|
||||
layout_context_menu: None,
|
||||
|
|
|
|||
|
|
@ -3688,16 +3688,20 @@ impl H7CAD {
|
|||
}
|
||||
}
|
||||
Message::UpdateCheckResult(latest) => {
|
||||
let Some(version) = latest else {
|
||||
let Some(info) = latest else {
|
||||
return Task::none();
|
||||
};
|
||||
self.update_notice_version = Some(version);
|
||||
self.update_notice_version = Some(info.version);
|
||||
self.update_notice_body = Some(info.body);
|
||||
if let Some(id) = self.update_notice_window {
|
||||
return window::gain_focus(id);
|
||||
}
|
||||
let (id, task) = window::open(window::Settings {
|
||||
size: iced::Size::new(480.0, 240.0),
|
||||
resizable: false,
|
||||
// Sized for the new release-notes panel — wide enough
|
||||
// for typical GitHub release headlines, tall enough for
|
||||
// a meaningful scroll preview without dwarfing the app.
|
||||
size: iced::Size::new(560.0, 460.0),
|
||||
resizable: true,
|
||||
..Default::default()
|
||||
});
|
||||
self.update_notice_window = Some(id);
|
||||
|
|
|
|||
|
|
@ -195,7 +195,8 @@ impl H7CAD {
|
|||
.update_notice_version
|
||||
.as_deref()
|
||||
.unwrap_or("?");
|
||||
return crate::ui::update_notice::view_window(latest);
|
||||
let body = self.update_notice_body.as_deref().unwrap_or("");
|
||||
return crate::ui::update_notice::view_window(latest, body);
|
||||
}
|
||||
if Some(window_id) == self.unsaved_dialog_window {
|
||||
let tab_name = match &self.pending_close {
|
||||
|
|
|
|||
Loading…
Reference in a new issue