fix(foryou): radio excludes local/Plex, Plex/local artwork, radio nav buttons

- Radio Stations seed only Qobuz-sourced recent albums; local/Plex albums
  carry ids the Qobuz /radio/album endpoint can't resolve, so they no longer
  generate radio tiles (they still appear in Recently Played Albums).
- Recently Played albums/tracks route artwork by scheme (spawn_search_loads):
  http -> Qobuz CDN, /library/ or /photo/ -> Plex thumb, else local file. The
  plain HTTP loader left Plex/local covers blank.
- Radio Stations carousel extracted to a RadioCarousel component with prev/next
  nav buttons (drag preserved), mirroring SlimCarousel.

cc
This commit is contained in:
vicrodh committed 2026-06-27 23:15:45 -06:00
1 parent c3b921efff
commit b5fd478b7b
3 files changed
+138 -36

No files matched your search

+7 -35
View File
@@ -23,7 +23,7 @@ import { SlimCarousel } from "SlimCarousel.slint";
import { ArtistCarousel } from "ArtistCarousel.slint";
import { Spotlight } from "Spotlight.slint";
import { QobuzMixesRow } from "QobuzMixesRow.slint";
import { RadioCard } from "RadioCard.slint";
import { RadioCarousel } from "RadioCarousel.slint";
import { HomeSkeleton } from "HomeSkeleton.slint";
export component ForYouView inherits VerticalLayout {
@@ -77,40 +77,12 @@ export component ForYouView inherits VerticalLayout {
}
}
// radioStations — album-seeded radio tiles (bespoke Flickable body).
if desc.id == "radioStations" && ForYouState.radio-stations.length > 0: VerticalLayout {
spacing: 12px;
Text {
text: @tr("Radio Stations");
color: Theme.text-primary;
font-size: 18px;
font-weight: Typography.semibold;
}
Rectangle {
height: 234px;
clip: true;
radio-flick := Flickable {
width: 100%;
height: parent.height;
viewport-width: ForYouState.radio-stations.length * (200px + 32px);
viewport-height: self.height;
HorizontalLayout {
spacing: 32px;
alignment: start;
for st in ForYouState.radio-stations: RadioCard {
seed-title: st.title;
seed-subtitle: st.artist;
label: @tr("RADIO");
artwork: st.artwork;
clicked => {
root.start-radio-album(st.album-id);
}
play => {
root.start-radio-album(st.album-id);
}
}
}
}
// radioStations — album-seeded radio tiles (paged carousel w/ nav buttons).
if desc.id == "radioStations" && ForYouState.radio-stations.length > 0: RadioCarousel {
title: @tr("Radio Stations");
stations: ForYouState.radio-stations;
start-radio-album(id) => {
root.start-radio-album(id);
}
}
@@ -0,0 +1,117 @@
// Radio Stations carousel for Discover > For You — album-seeded radio tiles in a
// paged horizontal Flickable with prev/next nav buttons (drag still works). The
// nav buttons mirror SlimCarousel; the body uses RadioCard (the bespoke radio
// tile) instead of slim/album cards. Replaces the previous bespoke Flickable
// block in ForYouView, which had no navigation buttons.
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { RadioStationItem } from "../state.slint";
import { RadioCard } from "RadioCard.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
component NavButton inherits Rectangle {
in property <image> icon;
in property <bool> enabled: true;
callback clicked();
width: 28px;
height: 28px;
border-radius: 14px;
opacity: root.enabled ? 1.0 : 0.4;
background: ta.has-hover && root.enabled
? Theme.surface-hover
: Theme.surface-elevated;
QbzIcon {
source: root.icon;
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.enabled ? Theme.text-primary : Theme.text-muted;
}
ta := TouchArea {
enabled: root.enabled;
mouse-cursor: root.enabled ? pointer : default;
clicked => {
root.clicked();
}
}
}
export component RadioCarousel inherits VerticalLayout {
in property <string> title;
in property <[RadioStationItem]> stations;
callback start-radio-album(string);
// 200px card + 32px inter-card spacing (matches the HorizontalLayout below).
property <length> card-pitch: 232px;
property <length> total-width: root.stations.length * root.card-pitch;
property <length> max-scroll: Math.max(0px, root.total-width - flick.width);
spacing: 12px;
// Header: title + (conditional) page controls — only when the row overflows.
HorizontalLayout {
Text {
text: root.title;
color: Theme.text-primary;
font-size: 18px;
font-weight: Typography.semibold;
vertical-alignment: center;
horizontal-stretch: 1;
}
if root.max-scroll > 0px: HorizontalLayout {
spacing: 4px;
VerticalLayout {
alignment: center;
NavButton {
icon: @image-url("../assets/icons/chevron-left.svg");
enabled: flick.viewport-x < -1px;
clicked => {
flick.viewport-x = Math.min(0px, flick.viewport-x + flick.width);
}
}
}
VerticalLayout {
alignment: center;
NavButton {
icon: @image-url("../assets/icons/chevron-right.svg");
enabled: flick.viewport-x > -root.max-scroll + 1px;
clicked => {
flick.viewport-x = Math.max(-root.max-scroll, flick.viewport-x - flick.width);
}
}
}
}
}
Rectangle {
height: 234px;
clip: true;
flick := Flickable {
width: 100%;
height: parent.height;
viewport-width: root.total-width;
viewport-height: self.height;
HorizontalLayout {
spacing: 32px;
alignment: start;
for st in root.stations: RadioCard {
seed-title: st.title;
seed-subtitle: st.artist;
label: @tr("RADIO");
artwork: st.artwork;
clicked => {
root.start-radio-album(st.album-id);
}
play => {
root.start-radio-album(st.album-id);
}
}
}
}
}
}