From 6032791be460a812eed94e894d6abc7b8c248bb6 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Fri, 10 Jul 2026 21:38:57 -0600 Subject: [PATCH] feat(kiosk): Now Playing centerpiece + NPB miniplayer/immersive consistency KioskNowPlaying: a 50/50 full screen (big cover + title/artist + AudioStamp + SeekBar + the reused 7-control TransportControls on the left, the Up-Next queue on the right), reading NowPlayingState/QueueState and calling QueueState.panel-opened() on init. New ContentView.now-playing route; the NavRail Now Playing tile navigates there instead of opening immersive. Also hide the Miniplayer + Immersive items from the NPB view menu while in the kiosk profile (todos o ninguno) so it is not a second-window/overlay mix. Validated via slintcheck. cc --- crates/qbz-ui/ui/shell/KioskNowPlaying.slint | 196 +++++++++++++++++++ crates/qbz-ui/ui/shell/KioskShell.slint | 14 +- crates/qbz-ui/ui/shell/NavRail.slint | 2 +- crates/qbz-ui/ui/shell/PlayerBarSmall.slint | 4 +- crates/qbz-ui/ui/state.slint | 2 +- 5 files changed, 213 insertions(+), 5 deletions(-) create mode 100644 crates/qbz-ui/ui/shell/KioskNowPlaying.slint diff --git a/crates/qbz-ui/ui/shell/KioskNowPlaying.slint b/crates/qbz-ui/ui/shell/KioskNowPlaying.slint new file mode 100644 index 000000000..e041abdde --- /dev/null +++ b/crates/qbz-ui/ui/shell/KioskNowPlaying.slint @@ -0,0 +1,196 @@ +// KioskNowPlaying — the kiosk Now Playing centerpiece (2.0.2 frente #3). +// +// A 50/50 full screen: the current track (big cover + title/artist + AudioStamp +// + SeekBar + the 7-control TransportControls) on the left, the Up-Next queue on +// the right. Reuses the real transport/seek/stamp components and reads the same +// NowPlayingState/QueueState the desktop uses (all covers push-only). Must call +// QueueState.panel-opened() on init so the paginated queue slice is fresh. +import { Theme } from "../foundation/semantic-colors.slint"; +import { Radius } from "../foundation/radius.slint"; +import { NowPlayingState, QueueState } from "../state.slint"; +import { SeekBar } from "SeekBar.slint"; +import { TransportControls } from "TransportControls.slint"; +import { AudioStamp } from "AudioStamp.slint"; + +export component KioskNowPlaying inherits Rectangle { + callback open-album(string); + callback open-artist(string); + callback media-action(string, string, string); + + init => { + QueueState.panel-opened(); + } + + HorizontalLayout { + spacing: 0px; + + // LEFT — the current track. + Rectangle { + horizontal-stretch: 1; + VerticalLayout { + padding: 26px; + spacing: 16px; + alignment: center; + + HorizontalLayout { + alignment: center; + Rectangle { + width: 240px; + height: 240px; + border-radius: Radius.lg; + background: Theme.surface-elevated; + clip: true; + if NowPlayingState.artwork-large.width > 0: Image { + width: 100%; + height: 100%; + source: NowPlayingState.artwork-large; + image-fit: cover; + } + } + } + + Text { + text: NowPlayingState.title; + color: Theme.text-primary; + font-size: 24px; + font-weight: 700; + horizontal-alignment: center; + wrap: word-wrap; + } + artist-row := Rectangle { + height: 24px; + HorizontalLayout { + alignment: center; + Text { + text: NowPlayingState.artist; + color: Theme.text-secondary; + font-size: 16px; + vertical-alignment: center; + } + } + art-ta := TouchArea { + clicked => { + root.open-artist(NowPlayingState.artist-id); + } + } + } + + HorizontalLayout { + alignment: center; + AudioStamp { } + } + + SeekBar { + show-times: true; + progress: NowPlayingState.progress; + cache: NowPlayingState.cache; + seekable-max: NowPlayingState.seekable-max; + elapsed: NowPlayingState.elapsed; + remaining: NowPlayingState.remaining; + duration-secs: NowPlayingState.duration-secs; + seek(fraction) => { + NowPlayingState.seek(fraction); + } + } + + HorizontalLayout { + alignment: center; + TransportControls { + play-circle: true; + classic-actions: true; + media-action(k, i, a) => { + root.media-action(k, i, a); + } + } + } + } + } + + Rectangle { + width: 1px; + background: Theme.border-subtle; + } + + // RIGHT — the Up-Next queue. + Rectangle { + width: (parent.width - 1px) * 0.42; + background: Theme.surface-card; + VerticalLayout { + padding: 18px; + spacing: 10px; + Text { + text: @tr("Up Next"); + color: Theme.text-muted; + font-size: 12px; + font-weight: 700; + letter-spacing: 1.4px; + } + Flickable { + viewport-width: self.width; + viewport-height: qlist.preferred-height; + qlist := VerticalLayout { + spacing: 2px; + for item[i] in QueueState.upcoming-page: qrow-rect := Rectangle { + height: 58px; + border-radius: Radius.sm; + background: qrow.has-hover ? Theme.alpha-6 : transparent; + HorizontalLayout { + padding-left: 8px; + padding-right: 12px; + spacing: 12px; + Rectangle { + width: 44px; + Rectangle { + width: 44px; + height: 44px; + y: (parent.height - self.height) / 2; + border-radius: 5px; + background: Theme.surface-elevated; + clip: true; + if item.artwork.width > 0: Image { + width: 100%; + height: 100%; + source: item.artwork; + image-fit: cover; + } + } + } + VerticalLayout { + horizontal-stretch: 1; + alignment: center; + spacing: 2px; + Text { + text: item.title; + color: Theme.text-primary; + font-size: 14px; + font-weight: 500; + overflow: elide; + wrap: no-wrap; + } + Text { + text: item.artist; + color: Theme.text-muted; + font-size: 12.5px; + overflow: elide; + wrap: no-wrap; + } + } + Text { + text: item.duration; + color: Theme.text-muted; + font-size: 12.5px; + vertical-alignment: center; + } + } + qrow := TouchArea { + clicked => { + QueueState.play-upcoming(i); + } + } + } + } + } + } + } + } +} diff --git a/crates/qbz-ui/ui/shell/KioskShell.slint b/crates/qbz-ui/ui/shell/KioskShell.slint index a175dabe5..b11afc022 100644 --- a/crates/qbz-ui/ui/shell/KioskShell.slint +++ b/crates/qbz-ui/ui/shell/KioskShell.slint @@ -28,6 +28,7 @@ import { RecentAlbumsView } from "../discover/RecentAlbumsView.slint"; import { KioskAlbum } from "KioskAlbum.slint"; import { LocalAlbumView } from "../album/LocalAlbumView.slint"; import { KioskArtist } from "KioskArtist.slint"; +import { KioskNowPlaying } from "KioskNowPlaying.slint"; import { ArtistReleasesView } from "../artist/ArtistReleasesView.slint"; import { MusicianPageView } from "../musician/MusicianPageView.slint"; import { LabelReleasesView } from "../label/LabelReleasesView.slint"; @@ -404,6 +405,17 @@ export component KioskShell inherits Rectangle { root.media-action(kind, id, action); } } + if NavState.view == ContentView.now-playing: KioskNowPlaying { + open-album(id) => { + root.open-album(id); + } + open-artist(id) => { + root.open-artist(id); + } + media-action(kind, id, action) => { + root.media-action(kind, id, action); + } + } } } } @@ -446,7 +458,7 @@ export component KioskShell inherits Rectangle { NavState.view = ContentView.search; } playing => { - root.media-action("npb-view", "", "immersive"); + NavState.view = ContentView.now-playing; } visualizer => { root.media-action("npb-view", "", "immersive"); diff --git a/crates/qbz-ui/ui/shell/NavRail.slint b/crates/qbz-ui/ui/shell/NavRail.slint index 08a65877f..7d929a4d1 100644 --- a/crates/qbz-ui/ui/shell/NavRail.slint +++ b/crates/qbz-ui/ui/shell/NavRail.slint @@ -147,7 +147,7 @@ export component NavRail inherits Rectangle { height: root.th; icon: @image-url("../assets/icons/play-fill.svg"); label: @tr("Now Playing"); - active: ImmersiveState.open; + active: NavState.view == ContentView.now-playing; clicked => { root.playing(); } diff --git a/crates/qbz-ui/ui/shell/PlayerBarSmall.slint b/crates/qbz-ui/ui/shell/PlayerBarSmall.slint index 24d16de1a..393808c3d 100644 --- a/crates/qbz-ui/ui/shell/PlayerBarSmall.slint +++ b/crates/qbz-ui/ui/shell/PlayerBarSmall.slint @@ -788,14 +788,14 @@ export component PlayerBarSmall inherits Rectangle { background: Theme.border-subtle; } } - ContextMenuItem { + if !ShellState.kiosk-profile: ContextMenuItem { icon: @image-url("../assets/icons/picture-in-picture-2.svg"); label: @tr("Miniplayer"); clicked => { root.media-action("npb-view", "", "miniplayer"); } } - ContextMenuItem { + if !ShellState.kiosk-profile: ContextMenuItem { icon: @image-url("../assets/icons/maximize-2.svg"); label: @tr("Immersive"); clicked => { diff --git a/crates/qbz-ui/ui/state.slint b/crates/qbz-ui/ui/state.slint index fc7def949..d49756553 100644 --- a/crates/qbz-ui/ui/state.slint +++ b/crates/qbz-ui/ui/state.slint @@ -979,7 +979,7 @@ export global DragActions { } // Which content view the shell shows. -export enum ContentView { home, album, artist, artist-releases, settings, search, musician, label, label-releases, award, award-albums, location, favorites, mix, playlist, discover-browse, recent-albums, playlist-manager, offline-manager, blacklist-manager, local-library, local-album, mixtapes, collections, mixtape-detail, discography-builder, purchases, purchase-album } +export enum ContentView { home, album, artist, artist-releases, settings, search, musician, label, label-releases, award, award-albums, location, favorites, mix, playlist, discover-browse, recent-albums, playlist-manager, offline-manager, blacklist-manager, local-library, local-album, mixtapes, collections, mixtape-detail, discography-builder, purchases, purchase-album, now-playing } // In-app toast (transient notification). Mirrors Tauri's toastStore: // a single toast at a time (a new one replaces the current), auto-hidden