feat(reco): wire the external-recommendations 4th Discover tab (Slint)

Adds "Recommendations" as a 4th Discover tab (alongside Home / Editor's Picks /
For You), rendering the qbz-external-reco engine output. NOT part of For You.

- ui: new ExternalRecoState global + ExternalRecoView (4 personalized carousels
  C1-C4 with length>0 self-hide gates + the editorial cold-start rows), 4th tab
  pill button in HomeView, mount on active-tab == "recommendations", skeleton
  gate. Export the global from app.slint.
- bin: external_reco controller — RecoCatalog over QbzCore, per-user resolution
  cache lifecycle, LocalHistory from reco_store (known artists + recent plays),
  scrobbler-username gate (is_authed), build + apply into ExternalRecoState
  (models built on the UI thread; slint::Image is !Send) + artwork jobs.
- bin: 6 ArtworkTarget variants + resolution arms; reco::recent_track_ids
  wrapper; home::select_tab + discover_prefs::push_descriptors treat the new tab
  like For You (own view, Home/Editor pushed empty); lazy-load hooks at the tab
  click + both Discover nav-restore sites.

cargo check -p qbz green. Last.fm reads still need the proxy allowedMethods
deploy (separate qbz-api-proxy repo) before they return data.

cc
This commit is contained in:
vicrodh committed 2026-06-27 03:12:05 -06:00
1 parent 408b3c8308
commit ec98245364
12 files changed
+588 -7

No files matched your search

@@ -0,0 +1,115 @@
// Discover > Recommendations — the 4th tab.
//
// External-recommendations engine (Last.fm + ListenBrainz -> Qobuz) carousels,
// plus the Qobuz-editorial cold-start fallback. Mirrors ForYouView: hardcoded
// arms, each with its own `length > 0` self-hide gate, reusing the shared
// Carousel / SlimCarousel / ArtistCarousel components. Data lives in
// ExternalRecoState (populated by crate::external_reco). At runtime exactly one
// regime is non-empty: personalized (C1-C4) OR editorial fallback.
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { ExternalRecoState } from "../state.slint";
import { Carousel } from "Carousel.slint";
import { SlimCarousel } from "SlimCarousel.slint";
import { ArtistCarousel } from "ArtistCarousel.slint";
import { HomeSkeleton } from "HomeSkeleton.slint";
export component ExternalRecoView inherits VerticalLayout {
callback open-album(string);
callback open-artist(string);
callback media-action(string, string, string);
callback play-track(string);
property <bool> any-content:
ExternalRecoState.similar-artists.length > 0
|| ExternalRecoState.similar-tracks.length > 0
|| ExternalRecoState.rediscover-tracks.length > 0
|| ExternalRecoState.deep-cut-tracks.length > 0
|| ExternalRecoState.top-albums.albums.length > 0
|| ExternalRecoState.top-artists.length > 0;
spacing: 40px;
alignment: start;
// Skeleton while the first load is in flight and nothing has painted yet.
if ExternalRecoState.loading && !root.any-content: HomeSkeleton { }
// C1 — Similar artists you haven't heard (artist carousel).
if ExternalRecoState.similar-artists.length > 0: ArtistCarousel {
title: @tr("Similar artists you haven't heard");
artists: ExternalRecoState.similar-artists;
artist-clicked(id) => {
root.open-artist(id);
}
media-action(kind, id, action) => {
root.media-action(kind, id, action);
}
}
// C2 — Similar tracks you haven't heard (track slim carousel).
if ExternalRecoState.similar-tracks.length > 0: SlimCarousel {
title: @tr("Similar tracks you haven't heard");
items: ExternalRecoState.similar-tracks;
item-clicked(id) => {
root.play-track(id);
}
}
// C3 — Listened but not recently (re-discovery track carousel).
if ExternalRecoState.rediscover-tracks.length > 0: SlimCarousel {
title: @tr("Listened, but not lately");
items: ExternalRecoState.rediscover-tracks;
item-clicked(id) => {
root.play-track(id);
}
}
// C4 — From artists you know but not scrobbled (deep cuts).
if ExternalRecoState.deep-cut-tracks.length > 0: SlimCarousel {
title: @tr("Deep cuts from artists you know");
items: ExternalRecoState.deep-cut-tracks;
item-clicked(id) => {
root.play-track(id);
}
}
// Cold-start fallback — Qobuz editorial top albums (album carousel).
if ExternalRecoState.top-albums.albums.length > 0: Carousel {
section: ExternalRecoState.top-albums;
album-clicked(id) => {
root.open-album(id);
}
media-action(kind, id, action) => {
root.media-action(kind, id, action);
}
}
// Cold-start fallback — Qobuz editorial top artists (artist carousel).
if ExternalRecoState.top-artists.length > 0: ArtistCarousel {
title: @tr("Popular artists on Qobuz");
artists: ExternalRecoState.top-artists;
artist-clicked(id) => {
root.open-artist(id);
}
media-action(kind, id, action) => {
root.media-action(kind, id, action);
}
}
// Empty state: nothing loaded and not loading (no source, no editorial).
if !root.any-content && !ExternalRecoState.loading: VerticalLayout {
spacing: 8px;
Text {
text: @tr("No recommendations yet");
color: Theme.text-primary;
font-size: 18px;
font-weight: Typography.semibold;
}
Text {
text: @tr("Connect Last.fm or ListenBrainz in Settings, or play more music, to get personalized recommendations.");
color: Theme.text-muted;
font-size: 13px;
}
}
}