- Album view: classical "work" section grouping (PR #536 port) — new Track.work model field + run-length per-work headers in AlbumView. - i18n: add Russian + Japanese locales (1365 msgids each); extend plural.rs (ru 3-form one/few/many, ja single-form) + tests; fix the language-selector reseed (main.rs set_languages + ui_prefs index maps). Seven languages total. - About modal: native port of the Tauri About (version, links, build info, one-paragraph acknowledgments, inline contributors with GitHub avatars, signature). Contributors credit hoyon (PR #536) and mxnix (PR #517, ru). - What's New modal: renders the GitHub release-tag description (markdown sections + TOC); release fetch + build.rs emits build date/commit. - Discover Recommendations: move Cache window + Refresh now into the Customize modal, gated to the reco tab; hide the section-config UI there; add an explainer paragraph. New strings translated to all six non-English locales. - About modal width +120px; splash screen gains the legal disclaimer footer. cc
233 lines
11 KiB
Plaintext
233 lines
11 KiB
Plaintext
// What's New modal — the native port of Tauri's WhatsNewModal.svelte.
|
|
//
|
|
// Opened from the header hamburger menu ("What's New"). crate::whats_new fetches
|
|
// the matching GitHub release on open, renders the markdown body into a flat
|
|
// block model (crate::whats_new::render_markdown) and fills WhatsNewState: a TOC
|
|
// of the level-0 section headings, then the body blocks (sections / bullets /
|
|
// paragraphs). The release-body render is the centerpiece.
|
|
//
|
|
// Layout mirrors LogViewerModal / QconnectDevModal: a dimmed backdrop that
|
|
// closes on click, a centered card that swallows clicks, a header (title + X), a
|
|
// scrolling body, and a footer Close button. Mounted in AppShell in declaration
|
|
// order (ADR-009); conditional-mounted on WhatsNewState.open (ADR-010). The TOC
|
|
// chips are bordered Radius.sm rows, not pills (ADR-008).
|
|
|
|
import { Theme } from "../foundation/semantic-colors.slint";
|
|
import { Typography } from "../foundation/typography.slint";
|
|
import { Radius } from "../foundation/radius.slint";
|
|
import { WhatsNewState, WhatsNewActions } from "../state.slint";
|
|
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
|
|
|
export component WhatsNewModal inherits Rectangle {
|
|
width: 100%;
|
|
height: 100%;
|
|
visible: WhatsNewState.open;
|
|
|
|
if WhatsNewState.open: Rectangle {
|
|
background: #000000bf;
|
|
TouchArea {
|
|
mouse-cursor: default;
|
|
clicked => {
|
|
WhatsNewActions.close();
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
width: Math.min(root.width - 80px, 820px);
|
|
height: Math.min(root.height - 80px, 700px);
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
border-radius: Radius.md;
|
|
background: Theme.surface-card;
|
|
border-width: 1px;
|
|
border-color: Theme.border-subtle;
|
|
drop-shadow-blur: 32px;
|
|
drop-shadow-color: #00000080;
|
|
// Swallow clicks so they don't reach the closing backdrop.
|
|
TouchArea { }
|
|
|
|
VerticalLayout {
|
|
padding: 24px;
|
|
spacing: 16px;
|
|
|
|
// ---- Header: title + close X.
|
|
HorizontalLayout {
|
|
spacing: 10px;
|
|
Text {
|
|
text: WhatsNewState.version == ""
|
|
? @tr("What's new")
|
|
: @tr("What's new in v{}", WhatsNewState.version)
|
|
+ (WhatsNewState.date == "" ? "" : " (" + WhatsNewState.date + ")");
|
|
color: Theme.text-primary;
|
|
font-size: Typography.heading;
|
|
font-weight: Typography.semibold;
|
|
horizontal-stretch: 1;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
}
|
|
close-x := TouchArea {
|
|
width: 28px;
|
|
height: 28px;
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
WhatsNewActions.close();
|
|
}
|
|
QbzIcon {
|
|
source: @image-url("../assets/icons/x.svg");
|
|
width: 17px;
|
|
height: 17px;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
tint: close-x.has-hover ? Theme.text-primary : Theme.text-muted;
|
|
}
|
|
}
|
|
}
|
|
|
|
// ---- Body region (stretches).
|
|
Rectangle {
|
|
vertical-stretch: 1;
|
|
|
|
// Loading state.
|
|
if WhatsNewState.loading: Text {
|
|
text: @tr("Loading…");
|
|
color: Theme.text-muted;
|
|
font-size: Typography.body;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
}
|
|
|
|
// Empty state — no release body available.
|
|
if !WhatsNewState.loading && !WhatsNewState.has-body: Text {
|
|
text: @tr("Release notes are not available.");
|
|
color: Theme.text-muted;
|
|
font-size: Typography.body;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
wrap: word-wrap;
|
|
width: Math.min(parent.width, 360px);
|
|
horizontal-alignment: center;
|
|
}
|
|
|
|
// Rendered release body.
|
|
if !WhatsNewState.loading && WhatsNewState.has-body: Flickable {
|
|
width: 100%;
|
|
height: 100%;
|
|
viewport-width: self.width;
|
|
viewport-height: wn-body.preferred-height;
|
|
|
|
wn-body := VerticalLayout {
|
|
width: parent.width;
|
|
spacing: 0px;
|
|
|
|
// TOC — level-0 section headings as a bordered index.
|
|
// Static (visual) index: Slint can't reliably scroll a
|
|
// Flickable to an arbitrary nested child, so the chips
|
|
// are an overview rather than jump links (documented
|
|
// deviation from the Tauri scroll-to TOC).
|
|
if WhatsNewState.toc.length > 0: VerticalLayout {
|
|
spacing: 6px;
|
|
// A wrapping flow row is unavailable in Slint; the
|
|
// section index is stacked compactly instead.
|
|
for entry in WhatsNewState.toc: HorizontalLayout {
|
|
alignment: start;
|
|
Rectangle {
|
|
height: 26px;
|
|
width: toc-label.preferred-width + 24px;
|
|
border-radius: Radius.sm;
|
|
border-width: 1px;
|
|
border-color: Theme.border-subtle;
|
|
background: Theme.surface-elevated;
|
|
toc-label := Text {
|
|
text: entry.label;
|
|
color: Theme.text-secondary;
|
|
font-size: 11px;
|
|
font-weight: Typography.medium;
|
|
x: 12px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
}
|
|
}
|
|
}
|
|
Rectangle { height: 8px; }
|
|
Rectangle {
|
|
height: 1px;
|
|
background: Theme.border-subtle;
|
|
}
|
|
Rectangle { height: 8px; }
|
|
}
|
|
|
|
// Body blocks. Each block is a HorizontalLayout placed
|
|
// DIRECTLY in the VerticalLayout so it stretches to the
|
|
// full width (a layout wrapped in a Rectangle would not
|
|
// auto-fill, breaking word-wrap). kind: 0 section |
|
|
// 1 bullet | 2 paragraph. Vertical rhythm comes from
|
|
// padding-top/bottom (sections get extra top space).
|
|
for block in WhatsNewState.blocks: HorizontalLayout {
|
|
padding-top: block.kind == 0 ? 16px : 0px;
|
|
padding-bottom: block.kind == 0 ? 6px : 7px;
|
|
// Bullet indentation: level 1 = first nesting.
|
|
padding-left: block.kind == 1
|
|
? (block.level * 16px)
|
|
: 0px;
|
|
spacing: 8px;
|
|
|
|
// Bullet glyph.
|
|
if block.kind == 1: Text {
|
|
text: block.level >= 2 ? "◦" : "•";
|
|
color: block.level >= 2 ? Theme.text-muted : Theme.text-secondary;
|
|
font-size: block.level >= 2 ? 11px : 12px;
|
|
}
|
|
|
|
Text {
|
|
text: block.text;
|
|
horizontal-stretch: 1;
|
|
wrap: word-wrap;
|
|
color: block.kind == 0
|
|
? Theme.text-primary
|
|
: block.kind == 1
|
|
? (block.level >= 2 ? Theme.text-muted : Theme.text-secondary)
|
|
: Theme.text-secondary;
|
|
font-size: block.kind == 0
|
|
? 14px
|
|
: block.kind == 1
|
|
? (block.level >= 2 ? 11px : 12px)
|
|
: 13px;
|
|
font-weight: block.kind == 0
|
|
? Typography.bold
|
|
: Typography.regular;
|
|
}
|
|
}
|
|
|
|
Rectangle { height: 8px; }
|
|
}
|
|
}
|
|
}
|
|
|
|
// ---- Footer: Close button.
|
|
HorizontalLayout {
|
|
alignment: end;
|
|
Rectangle {
|
|
height: 36px;
|
|
width: close-label.preferred-width + 36px;
|
|
border-radius: Radius.sm;
|
|
background: footer-ta.has-hover ? Theme.accent-hover : Theme.accent;
|
|
close-label := Text {
|
|
text: @tr("Close");
|
|
color: Theme.accent-text;
|
|
font-size: 14px;
|
|
font-weight: Typography.medium;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
}
|
|
footer-ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
WhatsNewActions.close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|