fix(myqbz): visual homologation — app components, colors, scrollbar, resolveItems

Per the user's visual review. Replaces the reinvented MyQBZ controls with the
app's existing primitives and resolves the per-item data left unresolved.

Cross-cutting (all MyQBZ views):
- Removed the per-view "Back" header (the app uses the global < > nav).
- 32px L/R content padding so the ListScrollbar never rides over rows/cards.
- Homologated page padding + Typography tokens to Favorites/LocalLibrary.
- No more blue accent-filled pills / non-app colors.

Component homologation (deleted the reinvented locals + dead code):
- Grid/list + detail view-mode toggle -> the app ViewToggle (ToggleButton,
  surface-hover active, never accent). Builder ORDER-BY segmented de-blued too.
- Sort/filter -> QbzSelect (sm); search -> ExpandableSearch (sm); "+ New" ->
  NewActionBtn (surface-elevated circle, single centered glyph). Header "+ New"
  hidden when empty so the empty-state CTA is the only one (no duplicate).
- Deleted PrimaryCta / MyQbzSearch / ControlBtn / ViewSeg / ViewModeGroup /
  SortItem / ColMenuItem + the hand-rolled sort/filter popups + reset.

Data (resolveItems, was deferred):
- Quality column populated from the resolved tracks (QualityBadgeFull).
- New ui/primitives/SourceGlyph.slint: full-color Qobuz/Plex glyphs + a
  text-muted local hard-drive -- distinguishes Local vs Plex, no accent blob.
  Reused in the detail + builder rows.
- Type column shows the real release type (ALBUM/EP/SINGLE), not always ALBUM.
- Local/Plex album art now loads in the detail rows (split artwork dispatch).
- Collection grid card renders custom_artwork_path.
- Builder rows: 44px + a hairline so quality badges read separated.

Backend crates untouched. cargo check -p qbz-slint green.

cc
This commit is contained in:
vicrodh committed 2026-06-09 12:35:03 -06:00
1 parent 838085a492
commit 0b20a1a86a
12 files changed
+811 -1140

No files matched your search

+56 -239
View File
@@ -1,278 +1,112 @@
// Shared MyQBZ index widgets — the toolbar controls + grid card + list row,
// reused 1:1 by both MixtapesView and CollectionsView (the Svelte vocabulary
// is intentionally identical between the two index views). Every px / token
// here is verbatim from spec 10/11.
// Shared MyQBZ index widgets — the grid card + list row + the two small
// app-homologated toolbar wrappers (the grid/list ViewToggle and the "+ New"
// action button), reused 1:1 by both MixtapesView and CollectionsView.
//
// HOMOLOGATION: the toolbar controls are the app's own primitives. The
// reinvented PrimaryCta (blue accent-filled pill), MyQbzSearch (fixed-width
// always-open box), ControlBtn (bordered button) and ViewSeg/ViewModeGroup
// (accent-filled segment) were DELETED — the index views now use
// ExpandableSearch + QbzSelect directly and the two small wrappers below
// (copied verbatim from Favorites/LocalLibrary). No accent-filled action pill.
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { MixtapeCardItem } from "../state.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { ToggleButton } from "../primitives/ToggleButton.slint";
import { CollectionMosaic } from "CollectionMosaic.slint";
// --- Primary CTA ("+ New Mixtape" / "+ New Collection") -----------------
// Header instance shows a Plus icon AND the label (which already starts with
// "+ " — verbatim, not a bug). Empty-state instance is text-only.
export component PrimaryCta inherits Rectangle {
in property <string> label;
in property <bool> show-plus: true;
// --- "+ New" action button ----------------------------------------------
// The app's secondary header action idiom (LocalLibrary's gear CircleIconBtn):
// a 28×28 surface-elevated circle with a plus glyph — NEVER an accent fill.
// Replaces the deleted blue PrimaryCta.
export component NewActionBtn inherits Rectangle {
callback clicked();
height: 38px; // padding 10px*2 + ~18 line
width: row.preferred-width + 40px; // 20px horizontal padding each side
border-radius: 8px;
background: cta-ta.has-hover ? Theme.accent-hover : Theme.accent;
row := HorizontalLayout {
x: 20px;
height: 100%;
spacing: 8px;
alignment: center;
if root.show-plus: VerticalLayout {
alignment: center;
QbzIcon {
source: @image-url("../assets/icons/plus.svg");
width: 16px;
height: 16px;
tint: Theme.accent-text;
}
}
Text {
text: root.label;
color: Theme.accent-text;
font-size: 14px;
font-weight: Typography.semibold;
vertical-alignment: center;
}
}
cta-ta := TouchArea {
mouse-cursor: pointer;
clicked => { root.clicked(); }
}
}
// --- Search box ---------------------------------------------------------
export component MyQbzSearch inherits Rectangle {
in property <string> placeholder;
in-out property <string> query;
callback edited(string);
height: 32px;
min-width: 220px;
border-radius: 6px;
property <bool> has-query: root.query != "";
background: (input.has-focus || root.has-query) ? Theme.surface-main : Theme.surface-card;
border-width: 1px;
border-color: (input.has-focus || root.has-query) ? Theme.accent : Theme.surface-elevated;
HorizontalLayout {
padding-left: 10px;
padding-right: 10px;
spacing: 8px;
VerticalLayout {
alignment: center;
QbzIcon {
source: @image-url("../assets/icons/search.svg");
width: 14px;
height: 14px;
tint: Theme.text-muted;
}
}
Rectangle {
horizontal-stretch: 1;
clip: true;
input := TextInput {
width: 100%;
height: 100%;
vertical-alignment: center;
color: Theme.text-primary;
font-size: 13px;
text <=> root.query;
edited => { root.edited(self.text); }
}
if root.query == "": Text {
text: root.placeholder;
color: Theme.text-muted;
font-size: 13px;
vertical-alignment: center;
}
}
// Clear (X) — only when query non-empty.
if root.has-query: VerticalLayout {
alignment: center;
Rectangle {
width: 18px;
height: 18px;
border-radius: 9px;
background: clear-ta.has-hover ? Theme.surface-elevated : transparent;
QbzIcon {
source: @image-url("../assets/icons/x.svg");
width: 12px;
height: 12px;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: clear-ta.has-hover ? Theme.text-primary : Theme.text-muted;
}
clear-ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.query = "";
root.edited("");
}
}
}
}
}
}
// --- Generic control button (sort / filter / reset / view-seg base) -----
export component ControlBtn inherits Rectangle {
in property <image> icon;
in property <string> label; // "" -> icon-only
in property <string> indicator; // sort arrow "↑"/"↓" or ""
in property <bool> active: false;
in property <bool> subtle: false;
callback clicked();
height: 32px;
border-radius: 6px;
width: row.preferred-width + (root.subtle ? 16px : 20px);
background: btn-ta.has-hover ? Theme.surface-hover : Theme.surface-card;
border-width: 1px;
border-color: root.active ? Theme.accent : Theme.surface-elevated;
row := HorizontalLayout {
x: root.subtle ? 8px : 10px;
height: 100%;
spacing: 6px;
alignment: center;
VerticalLayout {
alignment: center;
QbzIcon {
source: root.icon;
width: 14px;
height: 14px;
tint: root.active
? Theme.accent
: (root.subtle ? Theme.text-muted : Theme.text-primary);
}
}
if root.label != "": Text {
text: root.label;
color: root.active ? Theme.accent : Theme.text-primary;
font-size: 13px;
vertical-alignment: center;
}
if root.indicator != "": Text {
text: root.indicator;
color: Theme.text-muted;
font-size: 11px;
vertical-alignment: center;
}
}
btn-ta := TouchArea {
mouse-cursor: pointer;
clicked => { root.clicked(); }
}
}
// --- Segmented list/grid view toggle ------------------------------------
// One segment of the toggle; defined before ViewModeGroup (no forward refs).
// Slint Rectangles have no per-side border, so the group draws ONE outer
// border + corner rounds and the segments fill it; a 1px divider sits between
// them (the `.seg` shared-border look from the PSD).
component ViewSeg inherits Rectangle {
in property <image> icon;
in property <bool> active: false;
callback clicked();
height: 30px; // 32px group - 2*1px outer border
width: 31px;
background: root.active
? Theme.accent
: (seg-ta.has-hover ? Theme.surface-hover : transparent);
width: 28px;
height: 28px;
border-radius: 14px;
background: ta.has-hover ? Theme.surface-hover : Theme.surface-elevated;
QbzIcon {
source: root.icon;
width: 14px;
height: 14px;
source: @image-url("../assets/icons/plus.svg");
width: 15px;
height: 15px;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: root.active ? Theme.accent-text : Theme.text-primary;
tint: Theme.text-primary;
}
seg-ta := TouchArea {
ta := TouchArea {
mouse-cursor: pointer;
clicked => { root.clicked(); }
}
}
// Two joined buttons (List | Grid) reading as one pill; active fills accent.
export component ViewModeGroup inherits Rectangle {
// --- Grid/list view toggle ----------------------------------------------
// Verbatim from FavoritesView/LocalLibraryView's `ViewToggle`: a 60×30
// surface-elevated rounded box holding two `ToggleButton { sm: true }`.
// ADR-008: small-radius rectangle, NOT a pill; active = surface-hover, never
// accent.
export component ViewToggle inherits Rectangle {
in property <string> view; // "grid" | "list"
callback set-view(string);
height: 32px;
width: 64px;
width: 60px;
height: 30px;
border-radius: 6px;
border-width: 1px;
border-color: Theme.surface-elevated;
background: Theme.surface-card;
background: Theme.surface-elevated;
clip: true;
HorizontalLayout {
spacing: 0px;
ViewSeg {
ToggleButton {
icon: @image-url("../assets/icons/list.svg");
active: root.view == "list";
sm: true;
clicked => { root.set-view("list"); }
}
// 1px divider between the segments.
Rectangle {
width: 1px;
background: Theme.surface-elevated;
}
ViewSeg {
ToggleButton {
icon: @image-url("../assets/icons/layout-grid.svg");
active: root.view == "grid";
sm: true;
clicked => { root.set-view("grid"); }
}
}
}
// --- Grid card ----------------------------------------------------------
// 208px column; 12px padding -> 184px mosaic. Eyebrow + 2-line name (reserve
// 2 lines so cards align) + album-count meta.
// 208px column; 12px padding -> 184px mosaic. Muted subtitle (Typography.legal,
// no accent eyebrow) + 2-line name (Typography.body) + album-count meta.
export component MyQbzCard inherits Rectangle {
in property <MixtapeCardItem> item;
callback clicked();
width: 208px;
height: 184px + 12px + 12px + 16px + 2 * 18px + 12px + 16px + 12px;
height: 184px + 12px + 12px + 18px + 2 * 20px + 18px + 12px;
border-radius: 8px;
background: card-ta.has-hover ? Theme.surface-hover : Theme.surface-card;
border-width: 1px;
border-color: card-ta.has-hover ? Theme.surface-hover : Theme.surface-elevated;
VerticalLayout {
padding: 12px;
spacing: 12px;
spacing: 8px;
alignment: start;
CollectionMosaic {
item: root.item;
size: 184px;
}
// card-label (eyebrow) — accent, uppercase, +4px top margin.
Rectangle { height: 4px; }
Text {
text: root.item.label;
color: Theme.accent;
font-size: 10px;
font-weight: Typography.semibold;
letter-spacing: 1.2px;
}
// card-name — 2-line clamp; reserve 2 lines (~36px at 14px/1.3).
Rectangle { height: 2px; }
// card-name — 2-line clamp (reserve 2 lines so cards align).
Text {
text: root.item.name;
color: Theme.text-primary;
font-size: 14px;
font-size: Typography.body;
font-weight: Typography.semibold;
wrap: word-wrap;
overflow: elide;
height: 36px;
height: 40px;
width: 100%;
}
// Muted subtitle: kind label + count (no uppercase accent eyebrow).
Text {
text: root.item.meta;
text: root.item.label + " · " + root.item.meta;
color: Theme.text-muted;
font-size: 12px;
font-size: Typography.legal;
}
}
card-ta := TouchArea {
@@ -308,34 +142,17 @@ export component MyQbzListRow inherits Rectangle {
Text {
text: root.item.name;
color: Theme.text-primary;
font-size: 14px;
font-size: Typography.body;
font-weight: Typography.semibold;
overflow: elide;
width: 100%;
}
HorizontalLayout {
spacing: 8px;
alignment: start;
Text {
text: root.item.label;
color: Theme.accent;
font-size: 10px;
font-weight: Typography.semibold;
letter-spacing: 1.2px;
vertical-alignment: center;
}
Text {
text: "·";
color: Theme.text-muted;
font-size: 12px;
vertical-alignment: center;
}
Text {
text: root.item.meta;
color: Theme.text-muted;
font-size: 12px;
vertical-alignment: center;
}
Text {
text: root.item.label + " · " + root.item.meta;
color: Theme.text-muted;
font-size: Typography.legal;
overflow: elide;
width: 100%;
}
}
}