feat(slint): discover home loading skeleton + paginated slim carousels

Three of the four Discover > Home quick-wins.

Loading skeleton (#1):
  - New HomeSkeleton replaces the spinner + "Loading your music…"
    text shown while the first fetch is in flight. Grey placeholder
    blocks shaped like two real carousels (title bar + a row of
    square art with two text lines), gently pulsing via a shared
    900ms Timer phase + animate opacity — no more artifact titles
    during load.

Recently Played Tracks + Popular albums (#3, #4):
  - New SlimCarousel: a paginated 4x3 slim-card grid (12 per page),
    capped at two pages, sliding one viewport width per page. The
    prev/next controls only appear when there is a second page
    (>12 items); 12 or fewer renders as a single static page with
    no arrows. Replaces the old non-paginated GridSection that grew
    into a tall wall of rows.
  - home.rs caps `recent` and `popular` to 24 items (two pages) so
    the carousel never has hidden overflow; the Popular/Recent
    artwork-job indices are unchanged.

GridSection is retained — the artist ReleaseGrid still uses it.

Note on #2 (Recently Played Albums "spurious AlbumCard"): there is
only one AlbumCard component (discover/AlbumCard.slint, used by 5
call sites incl. this carousel via Carousel) — no duplicate to
delete. The cards look bare because the local play-history store
keeps only id/title/artist/artwork (no quality/year/ribbon), not
because of a different component.

cc
This commit is contained in:
vicrodh committed 2026-05-20 21:58:36 -06:00
1 parent 1efa6fc745
commit 2dc6726c3b
4 files changed
+218 -22

No files matched your search

+7 -22
View File
@@ -10,10 +10,10 @@ import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { HomeState, HomeActions, NavState, ContentView } from "../state.slint";
import { Carousel } from "Carousel.slint";
import { GridSection } from "GridSection.slint";
import { SlimCarousel } from "SlimCarousel.slint";
import { HomeSkeleton } from "HomeSkeleton.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { NavButtons } from "../shell/NavButtons.slint";
import { LoadingSpinner } from "../primitives/LoadingSpinner.slint";
// Header + hint shown for a recently-played module while it has no data
// yet (the play history fills once the playback session records plays).
@@ -230,23 +230,7 @@ export component HomeView inherits Rectangle {
spacing: 40px;
alignment: start;
if HomeState.loading && HomeState.sections.length == 0: Rectangle {
height: 320px;
VerticalLayout {
alignment: center;
spacing: 18px;
HorizontalLayout {
alignment: center;
LoadingSpinner { size: 36px; }
}
Text {
text: @tr("Loading your music…");
color: Theme.text-muted;
font-size: 13px;
horizontal-alignment: center;
}
}
}
if HomeState.loading && HomeState.sections.length == 0: HomeSkeleton { }
for section in HomeState.sections: Carousel {
section: section;
@@ -283,9 +267,10 @@ export component HomeView inherits Rectangle {
hint: @tr("Albums you play will appear here.");
}
// Recently Played Tracks — always present, same pattern.
// Recently Played Tracks — paginated 4x3 carousel
// (12 per page, up to two pages).
if HomeState.active-tab == "home"
&& HomeState.recent.length > 0: GridSection {
&& HomeState.recent.length > 0: SlimCarousel {
title: @tr("Recently Played Tracks");
items: HomeState.recent;
item-clicked(id) => {
@@ -299,7 +284,7 @@ export component HomeView inherits Rectangle {
}
if HomeState.active-tab == "home"
&& HomeState.popular.length > 0: GridSection {
&& HomeState.popular.length > 0: SlimCarousel {
title: @tr("Popular albums");
items: HomeState.popular;
item-clicked(id) => {