// Immersive split Track Info panel — the INLINE credits panel mounted in the // SPLIT-right slot (ImmersiveState.split-panel == 1). 1:1 with Tauri's // TrackInfoPanel.svelte (recon data-panels.md §7): track title + album, the // Duration / Quality / ISRC / Label(link) metadata rows, the grouped CREDITS // section, and the copyright line. Split-only (no focus variant). // // Data is fed by crate::info_modals::load_track_info_inline via // TrackInfoActions.load-inline — it populates the SAME TrackInfoState the // floating modal reads, but never sets `open`, so the overlay modal does NOT // appear over the immersive view. // // CONTRAST: this panel renders OVER the dynamic album-art atmosphere backdrop, // whose brightness/hue VARY per album. The modal's shared MetaCell/CreditCell // label color (Theme.text-muted — a dark gray tuned for the dark surface-card) // disappears over a bright atmosphere, so this panel uses LOCAL cell variants // (MetaCellLight / CreditCellLight) with near-white labels/values that stay // legible on any background (does NOT rely solely on the split-right backing). // // Rendered white-on-dark over the atmosphere backdrop, matching the other // immersive split panels. Viewport dims are passed as props (no `parent` in the // root binding); no `opacity:` on the root; no `changed` watcher on layout // geometry (ADR-009 declaration order, reference_slint_* gotchas). import { TrackInfoState, TrackInfoActions, InfoCreditRow } from "../state.slint"; import { ListScrollbar } from "../primitives/ListScrollbar.slint"; // Local bright metadata cell: uppercase label (legible light tone over the // atmosphere, NOT the modal's dark text-muted) + a value supplied as a child. component MetaCellLight inherits VerticalLayout { in property label; spacing: 6px; Text { text: root.label; // Legible light label over a variable backdrop (was Theme.text-muted). color: #ffffffb3; font-size: 11px; font-weight: 600; letter-spacing: 0.6px; } @children } // Local bright credit cell: role label (legible light) + clickable performer // names. Clipped so a long name list can't bleed into the neighbouring column. component CreditCellLight inherits VerticalLayout { in property cell; callback name-clicked(string /* name */, string /* role-raw */); spacing: 6px; Text { text: root.cell.role; color: #ffffffb3; font-size: 11px; font-weight: 600; letter-spacing: 0.6px; } // Single wrapping Text (names pre-joined) so a long credit list wraps // instead of clipping — mirrors the TrackInfoModal CreditCell fix. Slint // has no flow layout, so per-name click is dropped in favour of wrapping. Text { text: root.cell.names-line; color: #ffffff; font-size: 14px; wrap: word-wrap; } } export component ImmersiveTrackInfoPanel inherits Rectangle { // Slot dimensions, supplied by the mount site (the split-right Rectangle). in property viewport-width: 480px; in property viewport-height: 600px; // When true (split placement) the content is height-capped + vertically // centered in the slot, mirroring Tauri's `centeredLayout`. in property centered: true; width: root.viewport-width; height: root.viewport-height; background: transparent; // Centered, height-capped content column (Tauri .centered-layout: // height clamp(340px, 62vh, 760px); max-height 80vh). VerticalLayout { alignment: root.centered ? center : start; Rectangle { height: root.centered ? Math.min(root.viewport-height, Math.clamp(340px, root.viewport-height * 0.62, 760px)) : root.viewport-height; // ---- Loading ----------------------------------------------- if TrackInfoState.loading && TrackInfoState.error == "": Text { text: @tr("Loading track info..."); color: #ffffffcc; font-size: 18px; horizontal-alignment: center; vertical-alignment: center; width: 100%; height: 100%; } // ---- Error ------------------------------------------------- if TrackInfoState.error != "": VerticalLayout { alignment: center; spacing: 8px; Text { text: @tr("Failed to load track info"); color: #ffffffe6; font-size: 18px; font-weight: 600; horizontal-alignment: center; } Text { text: TrackInfoState.error; color: #ffffff99; font-size: 13px; horizontal-alignment: center; wrap: word-wrap; } } // ---- Empty (no track / not yet loaded) --------------------- if !TrackInfoState.loading && TrackInfoState.error == "" && TrackInfoState.title == "": Text { text: @tr("No track selected"); color: #ffffffb3; font-size: 18px; horizontal-alignment: center; vertical-alignment: center; width: 100%; height: 100%; } // ---- Loaded ------------------------------------------------ if !TrackInfoState.loading && TrackInfoState.error == "" && TrackInfoState.title != "": Rectangle { clip: true; flick := Flickable { viewport-width: self.width; viewport-height: body.preferred-height; body := VerticalLayout { width: parent.width; padding-right: 14px; // Header: track title + album. VerticalLayout { spacing: 6px; padding-bottom: 28px; Text { text: TrackInfoState.title; color: #ffffff; font-size: 26px; font-weight: 700; wrap: word-wrap; } if TrackInfoState.album != "": Text { text: TrackInfoState.album; color: #ffffffcc; font-size: 17px; wrap: word-wrap; } } // Metadata rows: Duration, Quality, ISRC, Label(link). VerticalLayout { spacing: 24px; HorizontalLayout { spacing: 24px; MetaCellLight { horizontal-stretch: 1; label: @tr("Duration"); Text { text: TrackInfoState.duration; color: #ffffff; font-size: 14px; font-weight: 500; } } MetaCellLight { horizontal-stretch: 1; label: @tr("Quality"); Text { text: TrackInfoState.quality; color: #ffffff; font-size: 14px; font-weight: 500; } } if TrackInfoState.isrc != "": MetaCellLight { horizontal-stretch: 1; label: "ISRC"; Text { text: TrackInfoState.isrc; color: #ffffffe6; font-size: 13px; } } if TrackInfoState.isrc == "": Rectangle { horizontal-stretch: 1; } } if TrackInfoState.label != "": HorizontalLayout { spacing: 24px; MetaCellLight { horizontal-stretch: 1; label: @tr("Label"); label-link := TouchArea { width: label-text.preferred-width; height: label-text.preferred-height; mouse-cursor: TrackInfoState.label-id != "" ? pointer : default; clicked => { if (TrackInfoState.label-id != "") { TrackInfoActions.open-label(TrackInfoState.label-id); } } label-text := Text { text: TrackInfoState.label; color: (label-link.has-hover && TrackInfoState.label-id != "") ? #b794f6 : #ffffff; font-size: 14px; font-weight: 500; } } } Rectangle { horizontal-stretch: 1; } Rectangle { horizontal-stretch: 1; } } } // Grouped CREDITS (2-column), only when present. if TrackInfoState.credits.length > 0: Rectangle { height: 24px; } if TrackInfoState.credits.length > 0: Rectangle { height: 1px; background: #ffffff26; } if TrackInfoState.credits.length > 0: Rectangle { height: 24px; } if TrackInfoState.credits.length > 0: VerticalLayout { spacing: 18px; for pair in TrackInfoState.credits: HorizontalLayout { spacing: 24px; CreditCellLight { horizontal-stretch: 1; cell: pair.left; name-clicked(n, r) => { TrackInfoActions.open-musician(n, r); } } if pair.has-right: CreditCellLight { horizontal-stretch: 1; cell: pair.right; name-clicked(n, r) => { TrackInfoActions.open-musician(n, r); } } if !pair.has-right: Rectangle { horizontal-stretch: 1; } } } // Copyright. if TrackInfoState.copyright != "": Rectangle { height: 24px; } if TrackInfoState.copyright != "": Rectangle { height: 1px; background: #ffffff26; } if TrackInfoState.copyright != "": Rectangle { height: 24px; } if TrackInfoState.copyright != "": Text { text: TrackInfoState.copyright; color: #ffffff99; font-size: 12px; wrap: word-wrap; } } } ListScrollbar { x: parent.width - self.width; width: 14px; height: 100%; viewport-height: flick.viewport-height; visible-height: flick.height; viewport-y <=> flick.viewport-y; } } } } }