feat(slint): dedicated For You view with artist sections

Replaces the ad-hoc For You (a single album set crammed into
HomeState.sections) with a dedicated, ordered ForYouView/ForYouState
so the tab can mix album, track, and artist carousels — closer to
Tauri's For You. Lazy-loaded once on first open.

Sections (all reuse existing cards, no new card components):
  - Release Watch (album Carousel) — get_release_watch.
  - Recently Played Tracks (SlimCarousel) — local play-history.
  - Recently Played Albums (album Carousel) — local play-history.
  - Your Top Artists (ArtistCarousel) — the user's favorite artists
    via get_favorites.
  - Artists to Follow (ArtistCarousel) — similar artists seeded from
    a few favorites via get_similar_artists, excluding ones already
    followed (Follow chip shown).

Plumbing:
  - crate::foryou controller (load/apply/artwork). Five ForYou
    artwork targets feed the dedicated models.
  - select_tab("forYou") clears HomeState.sections (the home-content
    `for` renders nothing) and the For You content comes from
    ForYouView; HomeView routes the For You tab to ForYouView and
    gains an open-artist callback (wired through AppShell).
  - ensure_for_you_loaded lazy-loads on tab open (pill, header
    dropdown, and back/forward history).
  - home.rs no longer builds a For You section set (removed the
    redundant release-watch/favorites fetch on every home load).

Still to come (next increments): Qobuz Mixes row, Radio Stations
(old card design), Spotlight hero, and the reco-DB sections (More
from library, Rediscover) — those need backend the MVP lacks or the
mix detail views.

cc
This commit is contained in:
vicrodh committed 2026-05-21 00:33:11 -06:00
1 parent 066890a7dd
commit 85ecf79a2d
9 files changed
+556 -113

No files matched your search

@@ -0,0 +1,88 @@
// Discover > For You — dedicated, ordered layout for the For You tab.
// Unlike Home / Editor's Picks (uniform album carousels from
// HomeState.sections), For You mixes album carousels, a track
// carousel, and artist carousels, so it renders from ForYouState.
// Sections hide themselves when empty.
//
// Reuses the shared cards/carousels — no new card components here.
// Qobuz Mixes, Radio Stations, Spotlight, and the reco-DB sections
// (More from library, Rediscover) are later increments.
import { Theme } from "../foundation/semantic-colors.slint";
import { ForYouState } from "../state.slint";
import { Carousel } from "Carousel.slint";
import { SlimCarousel } from "SlimCarousel.slint";
import { ArtistCarousel } from "ArtistCarousel.slint";
import { LoadingSpinner } from "../primitives/LoadingSpinner.slint";
export component ForYouView inherits VerticalLayout {
callback open-album(string);
callback open-artist(string);
callback media-action(string, string, string);
callback play-track(string);
spacing: 40px;
alignment: start;
if ForYouState.loading
&& ForYouState.release-watch.albums.length == 0
&& ForYouState.top-artists.length == 0: HorizontalLayout {
alignment: center;
LoadingSpinner { size: 36px; }
}
// 1. Release Watch.
if ForYouState.release-watch.albums.length > 0: Carousel {
section: ForYouState.release-watch;
album-clicked(id) => {
root.open-album(id);
}
media-action(kind, id, action) => {
root.media-action(kind, id, action);
}
}
// 2. Recently Played Tracks.
if ForYouState.recent-tracks.length > 0: SlimCarousel {
title: @tr("Recently Played Tracks");
items: ForYouState.recent-tracks;
item-clicked(id) => {
root.play-track(id);
}
}
// 3. Recently Played Albums.
if ForYouState.recent-albums.albums.length > 0: Carousel {
section: ForYouState.recent-albums;
album-clicked(id) => {
root.open-album(id);
}
media-action(kind, id, action) => {
root.media-action(kind, id, action);
}
}
// 4. Your Top Artists.
if ForYouState.top-artists.length > 0: ArtistCarousel {
title: @tr("Your Top Artists");
artists: ForYouState.top-artists;
artist-clicked(id) => {
root.open-artist(id);
}
media-action(kind, id, action) => {
root.media-action(kind, id, action);
}
}
// 5. Artists to Follow.
if ForYouState.artists-to-follow.length > 0: ArtistCarousel {
title: @tr("Artists to Follow");
artists: ForYouState.artists-to-follow;
artist-clicked(id) => {
root.open-artist(id);
}
media-action(kind, id, action) => {
root.media-action(kind, id, action);
}
}
}