Discover sections now use a Carousel: a clipped, sliding track of album cards with prev/next page controls, paginated by slice like the Svelte DiscoverySection. With no ScrollView the row height is exactly the card height — the horizontal scrollbar no longer injects vertical space, so the earlier internal-scroll problem is resolved structurally rather than patched. per-page is derived from the viewport width and self-corrects on resize. Replaces SectionRow. cc
79 lines
2.3 KiB
Plaintext
79 lines
2.3 KiB
Plaintext
// Discover — Home view: greeting, tab pill, and the discover sections.
|
|
//
|
|
// Section data is supplied by the Rust home controller through the
|
|
// HomeState global. The Editor's Picks / For You tabs are visual only
|
|
// for now; switching their data is a later increment.
|
|
|
|
import { Theme } from "../foundation/semantic-colors.slint";
|
|
import { Typography } from "../foundation/typography.slint";
|
|
import { HomeState } from "../state.slint";
|
|
import { Carousel } from "Carousel.slint";
|
|
import { ScrollView } from "std-widgets.slint";
|
|
|
|
component Tab inherits Rectangle {
|
|
in property <string> label;
|
|
in property <bool> active: false;
|
|
callback clicked();
|
|
|
|
border-radius: 4px;
|
|
background: root.active ? Theme.surface-main
|
|
: ta.has-hover ? Theme.surface-hover : transparent;
|
|
|
|
HorizontalLayout {
|
|
padding-left: 14px;
|
|
padding-right: 14px;
|
|
padding-top: 6px;
|
|
padding-bottom: 6px;
|
|
Text {
|
|
text: root.label;
|
|
color: root.active ? Theme.text-primary : Theme.text-muted;
|
|
font-size: 13px;
|
|
font-weight: Typography.medium;
|
|
}
|
|
}
|
|
|
|
ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
root.clicked();
|
|
}
|
|
}
|
|
}
|
|
|
|
export component HomeView inherits Rectangle {
|
|
background: Theme.surface-main;
|
|
|
|
ScrollView {
|
|
VerticalLayout {
|
|
padding: 32px;
|
|
spacing: 28px;
|
|
alignment: start;
|
|
|
|
HorizontalLayout {
|
|
alignment: start;
|
|
Rectangle {
|
|
background: Theme.surface-elevated;
|
|
border-radius: 6px;
|
|
HorizontalLayout {
|
|
padding: 3px;
|
|
spacing: 4px;
|
|
Tab { label: @tr("Home"); active: true; }
|
|
Tab { label: @tr("Editor's Picks"); }
|
|
Tab { label: @tr("For You"); }
|
|
}
|
|
}
|
|
}
|
|
|
|
if HomeState.loading && HomeState.sections.length == 0: Text {
|
|
text: @tr("Loading your music...");
|
|
color: Theme.text-muted;
|
|
font-size: 14px;
|
|
}
|
|
|
|
for section in HomeState.sections: Carousel {
|
|
section: section;
|
|
}
|
|
}
|
|
}
|
|
}
|