Ports Tauri's SpotlightLite — one favorite artist highlighted with a
hero and a content row. Backed by get_artist_page.
- Spotlight component: header (title + "Shine a light…" subtitle),
hero (round portrait + ARTIST label + name + play-top-tracks /
open-artist circle buttons), and a draggable Flickable row
mixing a TOP TRACKS card, a RADIO card, and the artist's albums.
- New RadioCard (port of RadioCardLite): a 180px tile with the seed
artwork centered on an elevated panel, a wordmark label over it,
and a title/subtitle below; hover reveals play. (The Tauri
palette-derived panel colour is approximated with a neutral
elevated panel.)
- foryou::load_spotlight rotates among the top-5 favorites by
wall-clock seconds, fetches get_artist_page, and extracts up to 6
albums (album > live > ep-single > compilation, deduped) plus
whether the artist has top tracks. ForYouState gains the
spotlight-* fields; two new artwork targets feed the portrait +
album covers.
- Wiring: ForYouView renders Spotlight after Artists to Follow.
play-top-tracks routes to the existing artist play-top action;
"start radio" has no artist-radio backend yet so it falls back to
playing top tracks (logged).
Remaining For You: Radio Stations section (old card design), Qobuz
Mixes row, and the reco-DB sections (More from library, Rediscover).
cc
111 lines
3.4 KiB
Plaintext
111 lines
3.4 KiB
Plaintext
// 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 { Spotlight } from "Spotlight.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);
|
|
callback play-top-tracks(string);
|
|
callback start-radio(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);
|
|
}
|
|
}
|
|
|
|
// 6. Spotlight.
|
|
if ForYouState.spotlight-visible: Spotlight {
|
|
open-artist(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
open-album(id) => {
|
|
root.open-album(id);
|
|
}
|
|
play-top-tracks(id) => {
|
|
root.play-top-tracks(id);
|
|
}
|
|
start-radio(id) => {
|
|
root.start-radio(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
}
|