// Now-playing bar SHELL — switches the bottom bar body on ShellState.npb-mode. // // This thin wrapper is the real "mode seam": it mounts the EXISTING PlayerBar // (which itself handles New = 0 and Classic = 1 internally) for modes 0/1, and // the new PlayerBarSmall (Mode C) for mode 2. Large (mode 3) will add a third // branch later; until then it falls through to PlayerBar (Default). // // AppShell mounts THIS instead of PlayerBar directly, forwarding the same // bindings; this component forwards them identically to whichever body is live. import { Layout } from "../foundation/layout.slint"; import { ShellState } from "../state.slint"; import { PlayerBar } from "PlayerBar.slint"; import { PlayerBarSmall } from "PlayerBarSmall.slint"; export component NowPlayingBar inherits Rectangle { callback open-album(string); callback open-artist(string); callback media-action(string, string, string); callback settings-bool(string, bool); // EXPLICIT mode-aware height on the wrapper itself. The bottom bar lives in // AppShell's outer VerticalLayout slot, which sizes a plain Rectangle child // to its CONTENT height — and a Rectangle does NOT auto-adopt a conditional // child's explicit height, so without this the row could collapse (the // layout-collapse footgun). Pinning the height here (mirrors the body's own // `height:`) makes the slot deterministic; the live body fills 100%. // Small (mode 2): a thin full-width top seekbar (3px) that doubles as the // divider between the content area and the bar, plus the controls row that // fills the rest — the whole bar is header-height tall (the large album art // defines the visual height, no extra band bump). height: ShellState.npb-mode == 2 ? Layout.header-height : Layout.player-bar-height; // Mode 2 (Small): the compact one-row bar. if ShellState.npb-mode == 2: PlayerBarSmall { width: 100%; height: 100%; 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); } settings-bool(k, v) => { root.settings-bool(k, v); } } // Modes 0/1 (New / Classic) — and any other mode as a safe fallback — // keep the existing full PlayerBar untouched. if ShellState.npb-mode != 2: PlayerBar { width: 100%; height: 100%; 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); } settings-bool(k, v) => { root.settings-bool(k, v); } } }