Content sat directly over the variable album atmosphere and washed out. Add a semi-opaque dark backing behind the split-right panel (and a lighter plate behind the split-left metadata) so any panel reads on any cover. Track Info: replace the dark-gray modal labels with bright local variants (labels #ffffffb3, values near-white). Queue: fix the misaligned clear button (content-sized, 34px baseline, flush trailing edge), de-pill the sub-tabs (underline active), brighten rows. Suggestions: hairline rims and badge backing discs, brighter text. Header: unify the glass capsule idiom across the mode trigger, search placeholder and controls; polish the two-level dropdown (caps group headers, spacing). Split gutters/gaps tuned. cc
546 lines
24 KiB
Plaintext
546 lines
24 KiB
Plaintext
// Immersive Queue panel (Checkpoint B) — ONE component used in BOTH the
|
|
// focus full-screen placement (ImmersiveState.mode == 5) and the split centered
|
|
// placement (ImmersiveState.split-panel == 3), mirroring Tauri's single
|
|
// QueuePanel.svelte (data-panels.md §4 Queue + §5 History).
|
|
//
|
|
// Two sub-tabs ("Queue" / "History") bound to QueueState.tab via
|
|
// QueueState.set-tab(...). The Queue tab shows a highlighted NOW PLAYING card
|
|
// plus a scrolling UP NEXT list of the upcoming entries; the History tab shows
|
|
// the most-recent-first history list. Rows reuse QueueSidebar's QueueRow visual
|
|
// structure (40x40-ish cover, title/artist, duration, hover-reveal play button).
|
|
// Playback logic is NOT duplicated — rows only fire QueueState callbacks.
|
|
//
|
|
// SLINT GOTCHAS honored:
|
|
// - viewport dims are passed in as props; `parent` is NEVER read in the root
|
|
// binding (Slint recursion trap).
|
|
// - `opacity:` is NEVER set on the root (it corrupts absolute positioning);
|
|
// inner content is dimmed instead. Chrome fade lives on the parent.
|
|
// - no `changed`-watching of layout geometry; no z-index (declaration order is
|
|
// the stacking order, ADR-009).
|
|
// - scrolling uses Flickable + the shared ListScrollbar idiom (codebase
|
|
// convention, see MiniQueueSurface) — NOT a bare native ScrollView.
|
|
|
|
import { NowPlayingState, QueueState, QueueItem } from "../state.slint";
|
|
import { ListScrollbar } from "../primitives/ListScrollbar.slint";
|
|
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
|
|
|
// Explicit "E" badge — immersive (white-on-glass) variant of the queue badge.
|
|
component ImmExplicitBadge inherits Rectangle {
|
|
width: 16px;
|
|
height: 16px;
|
|
border-radius: 3px;
|
|
background: #ffffff29;
|
|
Text {
|
|
text: "E";
|
|
color: #ffffffd9;
|
|
font-size: 9px;
|
|
font-weight: 600;
|
|
horizontal-alignment: center;
|
|
vertical-alignment: center;
|
|
x: 0; y: 0;
|
|
width: parent.width;
|
|
height: parent.height;
|
|
}
|
|
}
|
|
|
|
// One Queue / History sub-tab — plain TEXT only, NO pill background (ADR-008).
|
|
// Mirrors the QueueSidebar QueueTab brightness idiom (active = brightest,
|
|
// inactive dims and brightens on hover), recolored white-on-glass for the
|
|
// immersive backdrop. An active tab is marked by a 2px underline accent rather
|
|
// than a filled rectangle, keeping it pill-free while still reading as "active".
|
|
component SubTab inherits Rectangle {
|
|
in property <string> label;
|
|
in property <int> count: 0;
|
|
in property <bool> active: false;
|
|
callback clicked();
|
|
|
|
// Content-sized: hugs the label so tabs sit close together, no pill chrome.
|
|
width: tab-row.preferred-width;
|
|
height: 34px;
|
|
background: transparent;
|
|
|
|
tab-row := HorizontalLayout {
|
|
spacing: 5px;
|
|
alignment: center;
|
|
Text {
|
|
text: root.label;
|
|
color: root.active ? #ffffff : (ta.has-hover ? #ffffffe6 : #ffffff99);
|
|
font-size: 18px;
|
|
font-weight: root.active ? 700 : 500;
|
|
vertical-alignment: center;
|
|
animate color { duration: 150ms; }
|
|
}
|
|
if root.count > 0: Text {
|
|
text: "(" + root.count + ")";
|
|
color: root.active ? #ffffffb3 : #ffffff66;
|
|
font-size: 15px;
|
|
font-weight: 500;
|
|
vertical-alignment: center;
|
|
animate color { duration: 150ms; }
|
|
}
|
|
}
|
|
|
|
// Active underline — 2px accent flush to the bottom of the label row.
|
|
Rectangle {
|
|
x: 0;
|
|
y: parent.height - self.height;
|
|
width: parent.width;
|
|
height: 2px;
|
|
border-radius: 1px;
|
|
background: root.active ? #ffffff : (ta.has-hover ? #ffffff33 : transparent);
|
|
animate background { duration: 150ms; }
|
|
}
|
|
|
|
ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
}
|
|
|
|
// Section header — small, uppercase, tracked-out label (NOW PLAYING / UP NEXT).
|
|
// Hoisted to a component so both sections share identical typography + color.
|
|
component SectionLabel inherits Text {
|
|
color: #ffffffb3;
|
|
font-size: 13px;
|
|
font-weight: 700;
|
|
letter-spacing: 1.2px;
|
|
}
|
|
|
|
// One UP NEXT / History row. 40x40 cover, title/artist, duration, and a
|
|
// hover-revealed circular play button. Fires `play()` on click OR play-button —
|
|
// the parent maps it to the right QueueState callback. Reuses QueueRow's visual
|
|
// structure (data-panels.md §4 `.track-item` 40px art + ellipsis title).
|
|
component ImmQueueRow inherits Rectangle {
|
|
in property <QueueItem> item;
|
|
in property <bool> current: false; // NOW PLAYING highlight
|
|
callback play();
|
|
|
|
height: 56px;
|
|
border-radius: 10px;
|
|
// `.track-item.current` (data-panels §4): the now-playing row gets a brighter
|
|
// fill + 1px hairline so it reads as the anchor over ANY album atmosphere.
|
|
// Plain rows are transparent and lift to a soft --alpha-10 on hover.
|
|
background: root.current
|
|
? #ffffff24
|
|
: (ta.has-hover ? #ffffff1a : transparent);
|
|
border-width: root.current ? 1px : 0px;
|
|
border-color: #ffffff3d;
|
|
animate background { duration: 150ms; }
|
|
|
|
ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { root.play(); }
|
|
}
|
|
|
|
HorizontalLayout {
|
|
padding-left: 10px;
|
|
padding-right: 8px;
|
|
spacing: 12px;
|
|
|
|
// 40x40 cover. A 1px inset hairline keeps the artwork edge crisp against
|
|
// both bright and dark atmospheres.
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Rectangle {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 5px;
|
|
background: #ffffff14;
|
|
border-width: 1px;
|
|
border-color: #ffffff1f;
|
|
clip: true;
|
|
if root.item.artwork.width > 0: Image {
|
|
source: root.item.artwork;
|
|
width: 100%;
|
|
height: 100%;
|
|
image-fit: cover;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Title + artist.
|
|
VerticalLayout {
|
|
horizontal-stretch: 1;
|
|
alignment: center;
|
|
spacing: 3px;
|
|
HorizontalLayout {
|
|
spacing: 6px;
|
|
Text {
|
|
text: root.item.title;
|
|
// Now-playing title at full white + heavier weight; queue rows
|
|
// a hair softer so the current row clearly leads.
|
|
color: #ffffff;
|
|
font-size: 17px;
|
|
font-weight: root.current ? 600 : 500;
|
|
overflow: elide;
|
|
}
|
|
if root.item.explicit: VerticalLayout {
|
|
alignment: center;
|
|
ImmExplicitBadge {}
|
|
}
|
|
}
|
|
Text {
|
|
text: root.item.artist;
|
|
// Lifted from a faint gray to a legible light secondary so the
|
|
// artist stays readable over a bright cover atmosphere.
|
|
color: #ffffffb3;
|
|
font-size: 15px;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
|
|
// Duration + play affordance share one trailing slot. A plain Rectangle
|
|
// (NOT a layout) so the absolutely-positioned children honor their x/y —
|
|
// a VerticalLayout would re-flow them and drop the overlap. The duration
|
|
// fades on hover and the circular play button fades in over the same
|
|
// slot, so revealing it never shifts the row.
|
|
trailing-slot := Rectangle {
|
|
width: 36px;
|
|
Text {
|
|
x: 0;
|
|
width: parent.width;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
text: root.item.duration;
|
|
color: #ffffff99;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
horizontal-alignment: right;
|
|
opacity: (!root.current && ta.has-hover) ? 0.0 : 1.0;
|
|
animate opacity { duration: 150ms; }
|
|
}
|
|
// Hover-revealed circular play button (30px). Hidden for the current
|
|
// (now-playing) row, which is not re-playable.
|
|
if !root.current: play-btn := Rectangle {
|
|
x: parent.width - self.width;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
width: 30px;
|
|
height: 30px;
|
|
border-radius: 15px;
|
|
background: pta.has-hover ? #ffffff59 : #ffffff33;
|
|
opacity: ta.has-hover || pta.has-hover ? 1.0 : 0.0;
|
|
animate opacity { duration: 150ms; }
|
|
animate background { duration: 120ms; }
|
|
QbzIcon {
|
|
source: @image-url("../assets/icons/play-fill.svg");
|
|
width: 13px;
|
|
height: 13px;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px + 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
tint: #ffffff;
|
|
}
|
|
pta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { root.play(); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export component ImmersiveQueuePanel inherits Rectangle {
|
|
in property <length> viewport-width: 1280px;
|
|
in property <length> viewport-height: 720px;
|
|
// true in the split (centered) placement, false in focus full-screen.
|
|
in property <bool> centered: false;
|
|
|
|
background: transparent;
|
|
|
|
// Content width: in focus full-screen we cap to a comfortable reading
|
|
// column and center it; in split we already live in the right half, so we
|
|
// fill it. (data-panels §4 `.centered-layout` width:100%.)
|
|
property <length> content-width: root.centered
|
|
? root.viewport-width
|
|
: Math.min(root.viewport-width - 96px, 720px);
|
|
|
|
// The upcoming entries are the slice of `coverflow-tracks` AFTER the
|
|
// now-playing index. Their COUNT (page/search-independent) drives the tab
|
|
// badge + section header. Floored at 0.
|
|
property <int> upcoming-count:
|
|
Math.max(0, QueueState.coverflow-tracks.length - QueueState.coverflow-index - 1);
|
|
|
|
// Centered content column.
|
|
HorizontalLayout {
|
|
alignment: center;
|
|
VerticalLayout {
|
|
width: root.content-width;
|
|
padding-top: 56px; // clear the top ModeBar chrome
|
|
padding-bottom: 132px; // clear the floating player chrome
|
|
padding-left: root.centered ? 0px : 8px;
|
|
padding-right: root.centered ? 0px : 8px;
|
|
spacing: 16px;
|
|
|
|
// --- Sub-tab header (Queue / History) ---------------------------
|
|
// Tabs LEFT, clear-queue action flush at the TRAILING edge (alignment
|
|
// standard: actions always right, content-sized, on one baseline).
|
|
// A fixed 34px row height puts the tab labels and the Clear button on
|
|
// a single horizontal line — the previous version let the unsized
|
|
// button balloon to fill the spacer and sat off the tab baseline.
|
|
HorizontalLayout {
|
|
height: 34px;
|
|
spacing: 18px;
|
|
alignment: start;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
SubTab {
|
|
label: @tr("Queue");
|
|
count: root.upcoming-count;
|
|
active: QueueState.tab == 0;
|
|
clicked => { QueueState.set-tab(0); }
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
SubTab {
|
|
label: @tr("History");
|
|
count: QueueState.history.length;
|
|
active: QueueState.tab == 1;
|
|
clicked => { QueueState.set-tab(1); }
|
|
}
|
|
}
|
|
Rectangle { horizontal-stretch: 1; }
|
|
// Clear-queue button — Queue tab only, when there is something
|
|
// upcoming (data-panels §4 `.clear-btn`). Content-sized (hugs its
|
|
// icon + label via the inner layout's preferred-width) and
|
|
// vertically centered on the tab baseline, pinned right by the
|
|
// stretch spacer above. NO pill — a soft bordered rectangle
|
|
// (ADR-008).
|
|
if QueueState.tab == 0 && root.upcoming-count > 0: VerticalLayout {
|
|
alignment: center;
|
|
clear-btn := Rectangle {
|
|
width: clear-row.preferred-width;
|
|
height: 32px;
|
|
border-radius: 8px;
|
|
background: cta.has-hover ? #ffffff29 : #ffffff14;
|
|
border-width: 1px;
|
|
border-color: cta.has-hover ? #ffffff40 : #ffffff26;
|
|
animate background, border-color { duration: 150ms; }
|
|
clear-row := HorizontalLayout {
|
|
padding-left: 12px;
|
|
padding-right: 12px;
|
|
spacing: 7px;
|
|
alignment: center;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
QbzIcon {
|
|
source: @image-url("../assets/icons/trash-2.svg");
|
|
width: 14px;
|
|
height: 14px;
|
|
tint: cta.has-hover ? #ffffff : #ffffffcc;
|
|
}
|
|
}
|
|
Text {
|
|
text: @tr("Clear");
|
|
color: cta.has-hover ? #ffffff : #ffffffcc;
|
|
font-size: 15px;
|
|
font-weight: 500;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
cta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => { QueueState.clear-queue(); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Header underline (data-panels §4 `.panel-header` border-bottom).
|
|
Rectangle {
|
|
height: 1px;
|
|
background: #ffffff21;
|
|
}
|
|
|
|
// --- Body -------------------------------------------------------
|
|
Rectangle {
|
|
vertical-stretch: 1;
|
|
|
|
// ===== QUEUE tab =====
|
|
if QueueState.tab == 0: Rectangle {
|
|
// NOW PLAYING card + UP NEXT list, OR empty state.
|
|
if QueueState.has-current || root.upcoming-count > 0: VerticalLayout {
|
|
spacing: 16px;
|
|
|
|
// NOW PLAYING section.
|
|
if QueueState.has-current: VerticalLayout {
|
|
spacing: 10px;
|
|
SectionLabel {
|
|
text: @tr("NOW PLAYING");
|
|
}
|
|
ImmQueueRow {
|
|
item: QueueState.now-playing;
|
|
current: true;
|
|
}
|
|
}
|
|
|
|
// UP NEXT section.
|
|
if root.upcoming-count > 0: VerticalLayout {
|
|
vertical-stretch: 1;
|
|
spacing: 10px;
|
|
HorizontalLayout {
|
|
spacing: 8px;
|
|
SectionLabel {
|
|
text: @tr("UP NEXT");
|
|
vertical-alignment: center;
|
|
}
|
|
SectionLabel {
|
|
text: "· " + root.upcoming-count;
|
|
color: #ffffff80;
|
|
font-weight: 500;
|
|
letter-spacing: 0.4px;
|
|
vertical-alignment: center;
|
|
}
|
|
Rectangle { horizontal-stretch: 1; }
|
|
}
|
|
Rectangle {
|
|
vertical-stretch: 1;
|
|
up-flick := Flickable {
|
|
width: 100%;
|
|
height: 100%;
|
|
viewport-width: self.width;
|
|
viewport-height: up-list.preferred-height;
|
|
up-list := VerticalLayout {
|
|
width: parent.width;
|
|
// Trailing gutter so rows never tuck under
|
|
// the overlaid scrollbar (14px gutter).
|
|
padding-right: 16px;
|
|
// spacing 0 — the inter-row gap is baked
|
|
// into each VISIBLE wrapper's height (60 =
|
|
// 56 row + 4 gap), with the row anchored to
|
|
// the bottom. History entries (idx <=
|
|
// coverflow-index) collapse to 0px AND
|
|
// contribute no spacing, so a long history
|
|
// adds NO phantom top space.
|
|
spacing: 0px;
|
|
// Iterate the flat whole-queue model and
|
|
// render only the entries AFTER the
|
|
// now-playing index. Flat index `idx`
|
|
// maps to the queue-wide upcoming index
|
|
// `idx - coverflow-index - 1`
|
|
// (data-panels §4 actualIndex math; see
|
|
// QueueState.play-coverflow-upcoming).
|
|
for item[idx] in QueueState.coverflow-tracks: Rectangle {
|
|
height: idx > QueueState.coverflow-index ? 60px : 0px;
|
|
if idx > QueueState.coverflow-index: ImmQueueRow {
|
|
x: 0;
|
|
y: parent.height - self.height;
|
|
width: parent.width;
|
|
height: 56px;
|
|
item: item;
|
|
play => {
|
|
QueueState.play-coverflow-upcoming(
|
|
idx - QueueState.coverflow-index - 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ListScrollbar {
|
|
x: parent.width - self.width;
|
|
y: 0;
|
|
height: parent.height;
|
|
viewport-height: up-flick.viewport-height;
|
|
visible-height: up-flick.height;
|
|
viewport-y <=> up-flick.viewport-y;
|
|
auto-hide: true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Empty state — nothing playing and nothing upcoming.
|
|
if !QueueState.has-current && root.upcoming-count == 0: VerticalLayout {
|
|
alignment: center;
|
|
spacing: 8px;
|
|
Text {
|
|
text: @tr("Your queue is empty");
|
|
color: #ffffffcc;
|
|
font-size: 19px;
|
|
font-weight: 600;
|
|
horizontal-alignment: center;
|
|
}
|
|
Text {
|
|
text: @tr("Play an album or track to get started");
|
|
color: #ffffff80;
|
|
font-size: 15px;
|
|
horizontal-alignment: center;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
}
|
|
|
|
// ===== HISTORY tab =====
|
|
if QueueState.tab == 1: Rectangle {
|
|
if QueueState.history.length > 0: VerticalLayout {
|
|
spacing: 10px;
|
|
// Section header — parity with QueueSidebar "RECENTLY
|
|
// PLAYED".
|
|
HorizontalLayout {
|
|
spacing: 8px;
|
|
SectionLabel {
|
|
text: @tr("RECENTLY PLAYED");
|
|
vertical-alignment: center;
|
|
}
|
|
SectionLabel {
|
|
text: "· " + QueueState.history.length;
|
|
color: #ffffff80;
|
|
font-weight: 500;
|
|
letter-spacing: 0.4px;
|
|
vertical-alignment: center;
|
|
}
|
|
Rectangle { horizontal-stretch: 1; }
|
|
}
|
|
Rectangle {
|
|
vertical-stretch: 1;
|
|
hist-flick := Flickable {
|
|
width: 100%;
|
|
height: 100%;
|
|
viewport-width: self.width;
|
|
viewport-height: hist-list.preferred-height;
|
|
hist-list := VerticalLayout {
|
|
width: parent.width;
|
|
spacing: 4px;
|
|
// Trailing gutter so rows clear the scrollbar.
|
|
padding-right: 16px;
|
|
// QueueState.history is already most-recent-first
|
|
// (matches QueueSidebar), and play-history(idx)
|
|
// indexes it directly — no coverflow math here.
|
|
for item[idx] in QueueState.history: ImmQueueRow {
|
|
item: item;
|
|
play => { QueueState.play-history(idx); }
|
|
}
|
|
}
|
|
}
|
|
ListScrollbar {
|
|
x: parent.width - self.width;
|
|
y: 0;
|
|
height: parent.height;
|
|
viewport-height: hist-flick.viewport-height;
|
|
visible-height: hist-flick.height;
|
|
viewport-y <=> hist-flick.viewport-y;
|
|
auto-hide: true;
|
|
}
|
|
}
|
|
}
|
|
if QueueState.history.length == 0: VerticalLayout {
|
|
alignment: center;
|
|
spacing: 8px;
|
|
Text {
|
|
text: @tr("Nothing played yet");
|
|
color: #ffffffcc;
|
|
font-size: 19px;
|
|
font-weight: 600;
|
|
horizontal-alignment: center;
|
|
}
|
|
Text {
|
|
text: @tr("Tracks you play will appear here");
|
|
color: #ffffff80;
|
|
font-size: 15px;
|
|
horizontal-alignment: center;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|