Files
qbz/crates/qbz-slint/ui/favorites/FavoritesOfflineRail.slint
T
vicrodh ced6e64b40 style(slint): homologate recent surfaces to the control-alignment standard
Integrations buttons rebuilt to the settings standard (160x34
SecondaryButton, body/medium/text-secondary, enabled-dim) so every
connect/finish/disconnect lands on the settings right-edge line; Offline
status green standardized to the settings token (#3fae6a, not the player
chrome green) and Check now dims while checking; the create-modal offline
hint indents onto the label grid; the favorites-rail header moves to the
canonical section-heading scale flush with the cards.

The extracted standard (SettingRow trailing controls, fixed button
widths, GroupHeader idiom, modal footers, status-line tokens) is codified
rule-per-line with citations in
qbz-nix-docs/guides/native-ui/ui-control-alignment-standard.md.

cc
2026-06-10 09:05:05 -06:00

52 lines
2.1 KiB
Plaintext

// B9 — "playable favorites" rail, shown INSIDE the offline placeholder on
// the Favorites view only (the AppShell mounts it as the placeholder's
// children — ADR-010: both `if`s live at the AppShell mount site). Lists
// the favorite tracks that are still playable offline (offline-cache READY
// copies + library qobuz_download rows, intersected with the disk-seeded
// favorite set on the Rust side) as compact SlimCard rows; clicking a row
// plays the whole rail from there through the offline-capable queue path.
//
// Collapses to nothing while the list is empty, so the placeholder then
// reads exactly like the generic one.
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { OfflineFavoritesState, OfflineFavoritesActions } from "../state.slint";
import { SlimCard } from "../discover/SlimCard.slint";
import { ListView } from "std-widgets.slint";
export component FavoritesOfflineRail inherits VerticalLayout {
init => {
OfflineFavoritesActions.load();
}
property <int> count: OfflineFavoritesState.tracks.length;
if root.count > 0: Rectangle { height: 28px; }
if root.count > 0: HorizontalLayout {
alignment: center;
VerticalLayout {
spacing: 12px;
// Canonical section heading (Typography.section, semibold) flush
// with the cards' outer edge — same idiom as GridSection.
Text {
text: @tr("Available offline") + " (\{root.count})";
color: Theme.text-primary;
font-size: Typography.section;
font-weight: Typography.semibold;
}
ListView {
width: 480px;
// Up to five 60px rows visible; longer lists scroll inside.
height: Math.min(root.count, 5) * 60px;
for item in OfflineFavoritesState.tracks: SlimCard {
item: item;
clicked(id) => {
OfflineFavoritesActions.play(id);
}
}
}
}
}
}