feat(kiosk): lightweight KioskDiscover with simple cards

Replace the heavy reused HomeView on the kiosk home route with a Pi-light
Discover: KioskCard (square art + quality badge + title + artist, tap-to-
open, no hover/context-menu chrome) in horizontal shelves, reading the SAME
DiscoverState model so the artwork pipeline pushes covers in with no request
hook. Tab pill (Home/Editor's Picks/For You). First of the mockup-matching
lightweight views; also guards single-key hotkeys while typing in the kiosk
search field. Validated via slintcheck.

cc
This commit is contained in:
vicrodh committed 2026-07-10 18:39:24 -06:00
1 parent 01311db29c
commit ce2db8cb54
3 files changed
+215 -3

No files matched your search

+83
View File
@@ -0,0 +1,83 @@
// KioskCard — the lightweight album card for the kiosk browse shelves
// (2.0.2 frente #3, Axis B). Deliberately SIMPLER than the desktop AlbumCard:
// square art + a quality badge + title + artist, tap-to-open. No hover-reveal
// actions, no context menu, no source/ribbon chrome — that weight is what made
// the reused desktop views too heavy for a Pi. Binds `album` reactively (the
// artwork pipeline pushes covers into the shared model in place, so a plain
// `Image.source: album.artwork` picks them up without any request hook).
import { Theme } from "../foundation/semantic-colors.slint";
import { Radius } from "../foundation/radius.slint";
import { AlbumCardItem } from "../state.slint";
export component KioskCard inherits Rectangle {
in property <AlbumCardItem> album;
in property <length> art-size: 128px;
in property <bool> round: false;
callback clicked(string);
width: root.art-size;
VerticalLayout {
alignment: start;
spacing: 7px;
art := Rectangle {
width: root.art-size;
height: root.art-size;
border-radius: root.round ? root.art-size / 2 : Radius.sm;
background: Theme.surface-elevated;
clip: true;
Image {
width: 100%;
height: 100%;
source: root.album.artwork;
image-fit: cover;
}
// Quality badge — bottom-left, only for hi-res / lossless.
if root.album.quality-tier != "": Rectangle {
x: 6px;
y: art.height - self.height - 6px;
height: 19px;
background: #04070cd9;
border-radius: 4px;
HorizontalLayout {
padding-left: 6px;
padding-right: 6px;
Text {
text: root.album.quality-tier == "hires" ? "Hi-Res" : "CD";
color: root.album.quality-tier == "hires" ? #e6b24d : Theme.text-secondary;
font-size: 10px;
font-weight: 700;
vertical-alignment: center;
}
}
}
}
Text {
text: root.album.title;
color: Theme.text-primary;
font-size: 14px;
font-weight: 600;
overflow: elide;
wrap: no-wrap;
horizontal-alignment: root.round ? center : left;
}
Text {
text: root.album.artist;
color: Theme.text-muted;
font-size: 13px;
overflow: elide;
wrap: no-wrap;
horizontal-alignment: root.round ? center : left;
}
}
ta := TouchArea {
clicked => {
root.clicked(root.album.id);
}
}
}
+123
View File
@@ -0,0 +1,123 @@
// KioskDiscover — lightweight Discover/Home for the kiosk (2.0.2 frente #3).
//
// Reads the SAME DiscoverState the desktop HomeView reads (no data copy, so the
// artwork pipeline's in-place cover pushes flow through), but renders simple
// horizontal shelves of KioskCards instead of the heavy Carousel/AlbumCard
// stack — lighter for a Pi. v1 covers the album-carousel rows (newReleases,
// qobuzissimes, editorPicks, pressAwards, idealDiscography, mostStreamed); the
// non-album rows (playlists, mixes, slim rails) are skipped for now.
import { Theme } from "../foundation/semantic-colors.slint";
import { Radius } from "../foundation/radius.slint";
import { DiscoverState, HomeState, HomeActions } from "../state.slint";
import { KioskCard } from "KioskCard.slint";
component TabPill inherits Rectangle {
in property <string> label;
in property <bool> active;
callback clicked;
horizontal-stretch: 0;
height: 40px;
border-radius: Radius.sm;
background: root.active ? Theme.accent : ta.has-hover ? Theme.alpha-6 : transparent;
HorizontalLayout {
padding-left: 16px;
padding-right: 16px;
Text {
text: root.label;
color: root.active ? Theme.accent-text : Theme.text-secondary;
font-size: 15px;
font-weight: 600;
vertical-alignment: center;
}
}
ta := TouchArea {
clicked => {
root.clicked();
}
}
}
export component KioskDiscover inherits Rectangle {
callback album-clicked(string);
callback open-artist(string);
callback media-action(string, string, string);
callback discover-view-all(string, string);
Flickable {
viewport-width: self.width;
viewport-height: page.preferred-height;
page := VerticalLayout {
padding: 16px;
spacing: 22px;
// Tab pill — Home / Editor's Picks / For You.
HorizontalLayout {
spacing: 6px;
alignment: start;
Rectangle {
width: pills.preferred-width;
height: 50px;
border-radius: Radius.md;
background: Theme.surface-card;
border-width: 1px;
border-color: Theme.border-subtle;
pills := HorizontalLayout {
padding: 5px;
spacing: 4px;
TabPill {
label: @tr("Home");
active: DiscoverState.active-tab == "home";
clicked => { HomeActions.select-tab("home"); }
}
TabPill {
label: @tr("Editor's Picks");
active: DiscoverState.active-tab == "editorPicks";
clicked => { HomeActions.select-tab("editorPicks"); }
}
TabPill {
label: @tr("For You");
active: DiscoverState.active-tab == "forYou";
clicked => { HomeActions.select-tab("forYou"); }
}
}
}
}
// Album shelves for the active tab. Only rows carrying album data
// render (length > 0); playlist/mix/slim rows are skipped in v1.
for desc in (DiscoverState.active-tab == "editorPicks"
? DiscoverState.editor-sections
: DiscoverState.active-tab == "forYou"
? DiscoverState.foryou-sections
: DiscoverState.home-sections): VerticalLayout {
if desc.section.albums.length > 0: VerticalLayout {
spacing: 12px;
Text {
text: desc.section.title;
color: Theme.text-primary;
font-size: 18px;
font-weight: 600;
}
Flickable {
height: 182px;
viewport-width: strip.preferred-width;
viewport-height: self.height;
strip := HorizontalLayout {
spacing: 14px;
alignment: start;
for album in desc.section.albums: KioskCard {
album: album;
clicked(id) => {
root.album-clicked(id);
}
}
}
}
}
}
}
}
}
+9 -3
View File
@@ -19,10 +19,10 @@ import { LineEdit } from "std-widgets.slint";
import { Theme } from "../foundation/semantic-colors.slint";
import { Layout } from "../foundation/layout.slint";
import { Radius } from "../foundation/radius.slint";
import { NavState, ContentView, OfflineState, PlaylistState, PurchaseDetailState, SearchActions } from "../state.slint";
import { NavState, ContentView, OfflineState, PlaylistState, PurchaseDetailState, SearchActions, UiFocusState } from "../state.slint";
import { PlayerBarSmall } from "PlayerBarSmall.slint";
import { NavRail } from "NavRail.slint";
import { HomeView } from "../discover/HomeView.slint";
import { KioskDiscover } from "KioskDiscover.slint";
import { DiscoverBrowseView } from "../discover/DiscoverBrowseView.slint";
import { RecentAlbumsView } from "../discover/RecentAlbumsView.slint";
import { AlbumPageView } from "../album/AlbumPageView.slint";
@@ -137,6 +137,12 @@ export component KioskShell inherits Rectangle {
search-field := LineEdit {
horizontal-stretch: 1;
placeholder-text: @tr("Search");
// Suppress the global single-key hotkeys while typing (the
// desktop search box drives the same guard); without this,
// letters fire hotkeys instead of reaching the field.
changed has-focus => {
UiFocusState.text-input-focused = self.has-focus;
}
accepted(text) => {
SearchActions.submit(text);
NavState.view = ContentView.search;
@@ -175,7 +181,7 @@ export component KioskShell inherits Rectangle {
FavoritesOfflineRail { }
}
if NavState.view == ContentView.home && !OfflineState.offline: HomeView {
if NavState.view == ContentView.home && !OfflineState.offline: KioskDiscover {
album-clicked(id) => {
root.open-album(id);
}