feat(slint): album view detail parity

Bring the album view closer to 1:1 with the Tauri original.

- Track list: favorite and offline-cache columns, and the context-menu
  button now always shows in the muted column color (it brightens on
  hover) instead of being hidden until hover
- Toolbar above the track list: a QualityBadgeFull port of the Tauri
  QualityBadgeStatic (icon + tier + exact bit-depth/sample-rate), plus
  a track search box
- Editorial album description, truncated, with a Read more link that
  opens the full text in a modal
- Label/awards sidebar: drop the resting card background; awards use
  the Tauri laurels SVG
- Control buttons on both album and artist views are ghost circles
  (translucent fill, faint ring) instead of solid fills

cc
This commit is contained in:
vicrodh committed 2026-05-18 19:25:33 -06:00
1 parent 9af170db66
commit b51ec1509e
7 files changed
+358 -20

No files matched your search

+47
View File
@@ -22,6 +22,10 @@ pub struct AlbumData {
/// Pre-formatted "year • label • genre • N tracks • duration".
pub info_line: String,
pub quality_tier: String,
/// "24-bit / 96 kHz" — the quality-badge detail line.
pub quality_detail: String,
/// Editorial description / review (HTML stripped). May be empty.
pub description: String,
pub artwork_url: String,
/// Record label name, for the sidebar (empty when unknown).
pub label: String,
@@ -83,6 +87,12 @@ fn map_album(album: Album) -> AlbumData {
let info_line = parts.join(" • ");
let quality_tier = tier(album.maximum_bit_depth).to_string();
let quality_detail = quality_detail(album.maximum_bit_depth, album.maximum_sampling_rate);
let description = album
.description
.as_deref()
.map(strip_html)
.unwrap_or_default();
let artwork_url = album.image.best().cloned().unwrap_or_default();
let label = album
.label
@@ -112,6 +122,8 @@ fn map_album(album: Album) -> AlbumData {
artist_id,
info_line,
quality_tier,
quality_detail,
description,
artwork_url,
label,
awards,
@@ -119,6 +131,39 @@ fn map_album(album: Album) -> AlbumData {
}
}
/// "24-bit / 96 kHz" — the quality-badge detail string.
fn quality_detail(bit_depth: Option<u32>, sample_rate: Option<f64>) -> String {
let hi_res = matches!(bit_depth, Some(depth) if depth >= 24);
let depth = bit_depth.unwrap_or(if hi_res { 24 } else { 16 });
let rate = sample_rate.unwrap_or(if hi_res { 96.0 } else { 44.1 });
let rate = if rate.fract().abs() < f64::EPSILON {
format!("{}", rate as i64)
} else {
format!("{rate}")
};
format!("{depth}-bit / {rate} kHz")
}
/// Crude HTML strip for Qobuz album descriptions (tags + a few entities).
fn strip_html(input: &str) -> String {
let mut out = String::new();
let mut in_tag = false;
for ch in input.chars() {
match ch {
'<' => in_tag = true,
'>' => in_tag = false,
_ if !in_tag => out.push(ch),
_ => {}
}
}
out.replace("&amp;", "&")
.replace("&#39;", "'")
.replace("&quot;", "\"")
.replace("&nbsp;", " ")
.trim()
.to_string()
}
fn map_track(track: Track) -> TrackData {
let mut title = track.title;
if let Some(version) = track.version.as_ref().filter(|v| !v.is_empty()) {
@@ -186,6 +231,8 @@ pub fn apply_album(window: &AppWindow, data: AlbumData) {
state.set_artist_id(data.artist_id.into());
state.set_info_line(data.info_line.into());
state.set_quality_tier(data.quality_tier.into());
state.set_quality_detail(data.quality_detail.into());
state.set_description(data.description.into());
state.set_label(data.label.into());
state.set_awards(ModelRc::new(VecModel::from(awards)));
state.set_tracks(ModelRc::new(VecModel::from(tracks)));
+216 -14
View File
@@ -13,6 +13,7 @@ import { AlbumState, AlbumTrackItem, NavState, ContentView } from "../state.slin
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { ContextMenu } from "../primitives/ContextMenu.slint";
import { ContextMenuItem } from "../primitives/ContextMenuItem.slint";
import { QualityBadgeFull } from "../primitives/QualityBadgeFull.slint";
component CircleAction inherits Rectangle {
in property <image> icon;
@@ -23,17 +24,19 @@ component CircleAction inherits Rectangle {
width: root.diameter;
height: root.diameter;
border-radius: root.diameter / 2;
background: root.primary
? (ta.has-hover ? Theme.accent-hover : Theme.accent)
: (ta.has-hover ? Theme.surface-hover : Theme.surface-elevated);
// Ghost circle — translucent fill with a faint ring, never a solid
// accent fill (mirrors the Tauri transport controls).
background: ta.has-hover ? Theme.surface-hover : transparent;
border-width: 1px;
border-color: ta.has-hover ? Theme.text-disabled : Theme.border-subtle;
QbzIcon {
source: root.icon;
width: 17px;
height: 17px;
width: root.primary ? 19px : 17px;
height: root.primary ? 19px : 17px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: root.primary ? Theme.accent-text : Theme.text-secondary;
tint: ta.has-hover ? Theme.text-primary : Theme.text-secondary;
}
ta := TouchArea {
@@ -134,17 +137,39 @@ component TrackRow inherits Rectangle {
vertical-alignment: center;
}
// More button — a 32px square hit area, vertically centered.
// Visible while the row OR the button itself is hovered (the
// button steals has-hover from the row, so the states are ORed).
// Favorite column (visual).
Rectangle {
width: 28px;
QbzIcon {
source: @image-url("../assets/icons/heart.svg");
width: 16px;
height: 16px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: Theme.text-muted;
}
}
// Offline-cache column (visual).
Rectangle {
width: 28px;
QbzIcon {
source: @image-url("../assets/icons/cloud-download.svg");
width: 16px;
height: 16px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: Theme.text-muted;
}
}
// Context-menu button — always visible in the muted column color,
// a 32px square hit area that brightens on hover.
VerticalLayout {
alignment: center;
Rectangle {
width: 32px;
height: 32px;
border-radius: Radius.sm;
opacity: (ta.has-hover || more-ta.has-hover) ? 1.0 : 0.0;
animate opacity { duration: 120ms; }
background: more-ta.has-hover ? Theme.surface-elevated : transparent;
QbzIcon {
source: @image-url("../assets/icons/ellipsis.svg");
@@ -152,7 +177,7 @@ component TrackRow inherits Rectangle {
height: 16px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: more-ta.has-hover ? Theme.text-primary : Theme.text-secondary;
tint: more-ta.has-hover ? Theme.text-primary : Theme.text-muted;
}
more-ta := TouchArea {
mouse-cursor: pointer;
@@ -205,7 +230,7 @@ component SidebarCard inherits Rectangle {
height: 56px;
border-radius: Radius.sm;
background: ta.has-hover ? Theme.surface-hover : Theme.surface-card;
background: ta.has-hover ? Theme.surface-hover : transparent;
HorizontalLayout {
padding: 8px;
@@ -259,6 +284,9 @@ export component AlbumPageView inherits Rectangle {
callback open-artist(string);
callback media-action(string, string, string);
// Whether the full-description modal is open.
property <bool> show-description: false;
background: Theme.surface-main;
Flickable {
@@ -273,6 +301,7 @@ export component AlbumPageView inherits Rectangle {
height: 340px;
background: @linear-gradient(180deg,
AlbumState.header-color 0%,
AlbumState.header-color 16%,
transparent 100%);
}
@@ -377,6 +406,37 @@ export component AlbumPageView inherits Rectangle {
font-size: Typography.body;
overflow: elide;
}
// Editorial description — truncated, with a Read more
// link that opens the full text in a modal.
if AlbumState.description != "": Rectangle { height: 10px; }
if AlbumState.description != "": Text {
text: AlbumState.description;
color: Theme.text-secondary;
font-size: Typography.legal;
wrap: word-wrap;
height: 34px;
overflow: elide;
}
if AlbumState.description != "": read-more := TouchArea {
width: read-more-row.preferred-width;
height: 22px;
mouse-cursor: pointer;
clicked => {
root.show-description = true;
}
read-more-row := HorizontalLayout {
Text {
text: @tr("Read more");
color: read-more.has-hover
? Theme.accent-hover
: Theme.accent;
font-size: Typography.legal;
vertical-alignment: center;
}
}
}
Rectangle { height: 20px; }
HorizontalLayout {
alignment: start;
@@ -453,6 +513,52 @@ export component AlbumPageView inherits Rectangle {
font-size: Typography.body;
}
// Toolbar — album quality badge and track search.
HorizontalLayout {
height: 52px;
spacing: 16px;
VerticalLayout {
alignment: center;
QualityBadgeFull {
tier: AlbumState.quality-tier;
detail: AlbumState.quality-detail;
}
}
Rectangle { horizontal-stretch: 1; }
VerticalLayout {
alignment: center;
Rectangle {
width: 280px;
height: 34px;
border-radius: 6px;
border-width: 1px;
border-color: Theme.border-subtle;
background: Theme.surface-elevated;
HorizontalLayout {
padding-left: 10px;
padding-right: 10px;
spacing: 7px;
VerticalLayout {
alignment: center;
QbzIcon {
source: @image-url("../assets/icons/search.svg");
width: 14px;
height: 14px;
tint: Theme.text-muted;
}
}
Text {
text: @tr("Search tracks...");
color: Theme.text-muted;
font-size: 13px;
vertical-alignment: center;
horizontal-stretch: 1;
}
}
}
}
}
// Column header.
HorizontalLayout {
height: 40px;
@@ -493,6 +599,29 @@ export component AlbumPageView inherits Rectangle {
horizontal-alignment: center;
vertical-alignment: center;
}
// Favorite / offline-cache column headers.
Rectangle {
width: 28px;
QbzIcon {
source: @image-url("../assets/icons/heart.svg");
width: 14px;
height: 14px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: Theme.text-muted;
}
}
Rectangle {
width: 28px;
QbzIcon {
source: @image-url("../assets/icons/cloud-download.svg");
width: 14px;
height: 14px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: Theme.text-muted;
}
}
// Aligns with the per-row more-button slot.
Rectangle { width: 32px; }
}
@@ -526,7 +655,7 @@ export component AlbumPageView inherits Rectangle {
spacing: 8px;
SidebarHeading { text: @tr("AWARDS"); }
for award in AlbumState.awards: SidebarCard {
icon: @image-url("../assets/icons/award.svg");
icon: @image-url("../assets/laurels.svg");
name: award;
avatar-bg: @linear-gradient(135deg, #b45309 0%, #eab308 100%);
}
@@ -535,4 +664,77 @@ export component AlbumPageView inherits Rectangle {
}
}
}
// --- Full-description modal --------------------------------------------
if root.show-description: Rectangle {
background: #000000bf;
// Scrim — a click anywhere outside the panel dismisses.
TouchArea {
mouse-cursor: default;
clicked => {
root.show-description = false;
}
}
Rectangle {
width: Math.min(root.width - 80px, 560px);
height: Math.min(root.height - 120px, 460px);
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
border-radius: Radius.md;
background: Theme.surface-card;
border-width: 1px;
border-color: Theme.border-subtle;
drop-shadow-blur: 32px;
drop-shadow-color: Theme.card-shadow;
// Swallow clicks so they do not reach the scrim.
TouchArea { }
VerticalLayout {
padding: 24px;
spacing: 14px;
HorizontalLayout {
Text {
text: @tr("About this album");
color: Theme.text-primary;
font-size: Typography.heading;
font-weight: Typography.semibold;
horizontal-stretch: 1;
vertical-alignment: center;
}
close-x := TouchArea {
width: 28px;
height: 28px;
mouse-cursor: pointer;
clicked => {
root.show-description = false;
}
QbzIcon {
source: @image-url("../assets/icons/x.svg");
width: 18px;
height: 18px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: close-x.has-hover ? Theme.text-primary : Theme.text-muted;
}
}
}
Flickable {
viewport-width: self.width;
viewport-height: desc-text.preferred-height;
desc-text := Text {
width: parent.width;
text: AlbumState.description;
color: Theme.text-secondary;
font-size: Typography.body;
wrap: word-wrap;
}
}
}
}
}
}
@@ -23,17 +23,19 @@ component CircleAction inherits Rectangle {
width: root.diameter;
height: root.diameter;
border-radius: root.diameter / 2;
background: root.primary
? (ta.has-hover ? Theme.accent-hover : Theme.accent)
: (ta.has-hover ? Theme.surface-hover : Theme.surface-elevated);
// Ghost circle — translucent fill with a faint ring, never a solid
// accent fill (mirrors the Tauri transport controls).
background: ta.has-hover ? Theme.surface-hover : transparent;
border-width: 1px;
border-color: ta.has-hover ? Theme.text-disabled : Theme.border-subtle;
QbzIcon {
source: root.icon;
width: 17px;
height: 17px;
width: root.primary ? 19px : 17px;
height: root.primary ? 19px : 17px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: root.primary ? Theme.accent-text : Theme.text-secondary;
tint: ta.has-hover ? Theme.text-primary : Theme.text-secondary;
}
ta := TouchArea {
@@ -184,6 +186,7 @@ export component ArtistPageView inherits Rectangle {
height: 340px;
background: @linear-gradient(180deg,
ArtistState.header-color 0%,
ArtistState.header-color 16%,
transparent 100%);
}
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 13v8l-4-4" />
<path d="m12 21 4-4" />
<path d="M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284" />
</svg>

After

Width:  |  Height:  |  Size: 317 B

+2
View File
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#000000" d="M234.7 18.05c-21 .2-38.8 2.5-62 10.2-4.1 2-8.2 4.1-12.2 6.2.8 5.26 3.2 10.77 5.5 14.7-4.9 4.2-9.6 8.4-14.1 12.8-3.7-5.5-6.6-11.4-8.3-17.4-14.2 9.2-27.7 19.6-40.1 31.4 1.9 9.5 9.2 18.21 15.2 24.15-3.7 5.2-7.2 10.4-10.5 15.7-8.22-7.2-15.12-15.5-19.32-24.65C74.97 108.1 61.92 126 53.08 142.3c5.29 13 19.01 22.7 29.8 28.4-2 6.1-3.7 12.2-5.1 18.4-13.5-6.4-26.3-15.7-34.5-26.6-8.7 20.1-14.7 40.7-18.2 61.4 9.63 15.5 30.57 22.9 46 25.9.1 6.4.4 12.8.9 19.2-17.79-2.7-37.26-9.6-49.9-20.4-1.6 22.3-.5 44.5 3.4 66.2 15.25 13.7 41.14 15.3 58.6 13.7 2 6.1 4.1 12.2 6.5 18.1-18.61 4.5-43.29 1.1-59.3-6.2 6.6 23.7 16.4 46.4 29.2 67.4 19.33 8.6 44.52 3.6 61.72-2.5 3.7 5.3 7.6 10.5 11.6 15.5-17.8 9.5-39.9 11.5-57.52 10.1 12.3 16.3 26.62 31.2 42.72 44.4 4.9 1.1 10.5 1.1 16.7.3 11.7-1.7 25.2-7 37.9-14.7 16.7 13.5 34.9 24.7 54.1 33.1l7.5-17.2c-16-6.9-31.3-16.2-45.6-27.3 13.3-10.9 24.3-24 30.2-36.5 4.7-9.7 6.3-18.4 4.5-26.3-10.7-5.7-20.6-12.5-29.5-20.3-7.8 20.8-26.4 36.1-43.5 46-4-4.9-7.9-9.9-11.6-15 16.8-9.8 39.9-27.5 39.1-47.1-8.9-10.3-16.6-21.8-22.9-34.1-12 14-30.7 22.5-46.5 26.7-2.4-5.8-4.6-11.6-6.6-17.6 16.8-5.2 37.9-13 44.1-29.7-4.3-11.5-7.5-23.6-9.7-36-13.8 8.4-32 11.1-46.32 10.9-.6-6.2-1-12.4-1.2-18.7 15.52-.6 33.92-2.5 44.92-14.3-.8-12.6-.5-25.5.9-38.5-13.4 2.8-29 .3-40.42-3.2 1.3-6 2.9-12.1 4.8-18.1 12.82 3.2 27.12 6.7 38.82.8 2.7-13.6 6.7-27.3 12-40.8-9.9-1.8-20.2-6.3-27.7-10.7 3.3-5.3 6.8-10.5 10.5-15.7 8.1 4.2 16.3 8.8 25.2 8.4 5.7-11.6 12.3-22.65 19.5-32.75-5.1-2.7-10-6.4-14.4-10.6 4.4-4.3 9.1-8.5 13.9-12.7 3.8 3.54 8 6.18 12.3 8.2 15.9-18.6 35.9-36.23 49-53.8zm38.4 0c15.4 20.75 33.8 35.63 48.9 53.7 4.6-1.76 9.1-5.23 12.3-8.1 4.9 4.2 9.5 8.4 13.9 12.7-4.4 4.2-9.2 7.9-14.4 10.6 7.3 10.1 13.9 21.05 19.6 32.65 9-.1 18.4-4.4 25.2-8.4 3.7 5.2 7.2 10.4 10.4 15.7-8.8 5.9-18.2 9.6-27.6 10.7 5.3 13.5 9.3 27.2 12 40.8 12.3 5.4 27.3 2.7 38.7-.8 1.9 6 3.5 12.1 4.9 18.1-14.2 3.4-27.3 6.2-40.4 3.3 1.4 12.9 1.6 25.8.8 38.5 11.4 12.3 30.2 14.4 44.9 14.2-.2 6.3-.5 12.5-1.2 18.7-17.1-.5-32.8-2.5-46.3-10.9-2.1 12.4-5.3 24.5-9.6 36.1 8.2 17.4 27.8 25.3 44.1 29.6-2 6-4.2 11.8-6.6 17.6-18.5-5.6-34.9-13-46.6-26.7-6.3 12.4-13.9 23.8-22.9 34.1 1.5 22.4 22.4 37.8 39.2 47.1-3.7 5.1-7.6 10.1-11.6 15-19-11.8-36.6-25.8-43.5-46-9 7.8-18.8 14.6-29.6 20.3-1.8 7.9-.1 16.6 4.5 26.3 6 12.5 17 25.6 30.3 36.5-14.3 11.1-29.6 20.4-45.6 27.3l7.4 17.2c19.3-8.4 37.4-19.6 54.1-33.2 12.7 7.8 26.2 13.1 38 14.8 6.2.8 11.8.8 16.7-.3 16.1-13.2 30.4-28.1 42.7-44.4-18 1.7-37.9-2.3-56.5-9.7-.3-.1-.7-.3-1.1-.4 4.1-5 7.9-10.2 11.7-15.5 18.2 7.8 43.7 11.7 61.6 2.5 12.8-21 22.6-43.7 29.2-67.4-.4.2-.8.4-1.2.5-20.5 6.4-40.1 7.6-58.1 5.7 2.4-5.9 4.5-12 6.5-18 19.1 1.7 45.2.1 58.6-13.8 3.9-21.7 5.1-43.9 3.4-66.2-14.4 10.7-34.9 17.9-49.9 20.4.5-6.4.9-12.8 1-19.2 16.8-4.8 37.9-10 45.9-25.9-3.5-20.7-9.5-41.3-18.2-61.4-9.4 11.6-23.1 21-34.4 26.5-1.5-6.1-3.2-12.2-5.2-18.3 12-7.4 25.1-15.3 29.9-28.4-10.1-18.7-22.2-35.8-35.9-51.05-4.2 9.05-11.1 17.45-19.2 24.65-3.3-5.3-6.8-10.5-10.6-15.7 6.2-7.17 14.2-14.71 15.2-24.15-12.4-11.8-25.8-22.2-40-31.4-1.8 6-4.7 11.9-8.3 17.4-4.5-4.4-9.2-8.6-14.1-12.8 2.7-4.82 4.7-9.62 5.4-14.7-4-2.1-8.1-4.2-12.2-6.2-24.7-8.2-43.3-10.3-66.2-10.2z"/></svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

+2
View File
@@ -0,0 +1,2 @@
<?xml version="1.0" standalone="no"?>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" fill="#000000" width="128" height="128" viewBox="0 0 32 32" id="icon"><defs><style>.cls-1{fill:none;}</style></defs><title>MP3</title><path d="M28,9H22v2h6v4H24v2h4v4H22v2h6a2,2,0,0,0,2-2V11A2,2,0,0,0,28,9Z"/><path d="M14,23H12V9h6a2,2,0,0,1,2,2v5a2,2,0,0,1-2,2H14Zm0-7h4V11H14Z"/><polygon points="8 9 6.49 14 6 15.98 5.54 14 4 9 2 9 2 23 4 23 4 15 3.84 13 4.42 15 6 19.63 7.58 15 8.16 13 8 15 8 23 10 23 10 9 8 9"/><rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" class="cls-1" width="32" height="32"/></svg>

After

Width:  |  Height:  |  Size: 659 B

@@ -0,0 +1,77 @@
// Full quality badge — a faithful port of the Tauri QualityBadgeStatic
// (full mode): a contained pill with the format icon, the tier label, and
// the exact bit-depth / sample-rate line.
//
// Intentionally not a creative reinterpretation — the Tauri layout is the
// contract. Used wherever a track list or detail view advertises its
// stored quality.
import { Theme } from "../foundation/semantic-colors.slint";
import { QbzIcon } from "QbzIcon.slint";
export component QualityBadgeFull inherits Rectangle {
// "hires" | "cd" | "mp3" | "".
in property <string> tier;
// Exact quality, e.g. "24-bit / 96 kHz".
in property <string> detail;
property <string> tier-label: root.tier == "hires"
? "HI-RES"
: (root.tier == "mp3" ? "MP3" : "CD");
visible: root.tier != "";
height: 36px;
width: Math.max(content.preferred-width, 136px);
border-radius: 4px;
background: Theme.surface-hover;
border-width: 1px;
border-color: Theme.border-subtle;
content := HorizontalLayout {
padding-left: 10px;
padding-right: 10px;
spacing: 6px;
// Format icon. The Hi-Res brand mark keeps its own colors; the
// CD / MP3 marks render in muted grey.
VerticalLayout {
alignment: center;
if root.tier == "hires": Image {
source: @image-url("../assets/hi-res.svg");
width: 24px;
height: 24px;
image-fit: contain;
}
if root.tier == "cd": QbzIcon {
source: @image-url("../assets/cd.svg");
width: 16px;
height: 16px;
tint: #b0b0b0;
}
if root.tier == "mp3": QbzIcon {
source: @image-url("../assets/mp3.svg");
width: 16px;
height: 16px;
tint: #b0b0b0;
}
}
VerticalLayout {
alignment: center;
spacing: 1px;
Text {
text: root.tier-label;
color: #b0b0b0;
font-size: 8px;
font-weight: 100;
letter-spacing: 0.5px;
}
Text {
text: root.detail;
color: #999999;
font-size: 9px;
font-weight: 100;
}
}
}
}