Files
qbz/crates/qbz-slint/ui/offline/OfflinePlaceholder.slint
T
vicrodh 81587f4d17 feat(slint): playlist snapshot (names+membership) and offline favorites rail
Qobuz playlist snapshot, captured opportunistically with zero new API
traffic: every online sidebar/manager list load upserts id+name+owner+
track_count for the user's playlists; opening a playlist detail online
full-replaces its membership track ids (refusing playlists never listed,
so viewed public playlists don't land). Offline consumers: synthesized
sidebar/manager entries resolve the persisted name (killing the cold-start
'Playlist (N local)' fallback when a snapshot exists), and the mixed-
playlist offline detail now renders the snapshot tracks that are playable
(snapshot intersect cached intersect grace) from the offline-cache index -
snapshot block first in snapshot order, sidecar local/plex block after.
D11 availability widens: a playlist with zero sidecar rows but cached
snapshot tracks now shows offline. 4 repo tests.

Offline favorites rail: the Favorites placeholder gains an 'Available
offline (N)' block - disk-cached favorite ids intersected with the
offline-cache READY index and LocalLibrary qobuz_download copies, compact
rows with the offline cover chain, click plays the rail as a queue through
the cache tier. Shared OfflinePlaceholder gains an @children slot; only
the Favorites mount injects the rail.

Single commit: the two features interleave in main.rs/state wiring and
ship together to keep every commit compiling.

cc
2026-06-10 02:27:54 -06:00

72 lines
2.8 KiB
Plaintext

// Offline placeholder — mounted INSTEAD of the Qobuz-only content views
// while the app is offline (ADR-010 conditional mount at the AppShell
// routing seam, broader than Tauri's three gated view families). The body
// copy distinguishes real offline (no connectivity) from induced offline
// (the Settings toggle); induced adds an "Open Settings" shortcut straight
// to Settings > Offline so the user can flip the mode back off.
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { SecondaryButton } from "../primitives/SecondaryButton.slint";
import { OfflineState, NavState, SettingsState } from "../state.slint";
export component OfflinePlaceholder inherits Rectangle {
background: Theme.surface-main;
// 2 = induced offline (OfflineState.mode semantics: 0 online / 1 real / 2 induced).
property <bool> induced: OfflineState.mode == 2;
VerticalLayout {
alignment: center;
HorizontalLayout {
alignment: center;
QbzIcon {
source: @image-url("../assets/icons/cloud-off.svg");
width: 56px;
height: 56px;
tint: Theme.text-muted;
}
}
Rectangle { height: 18px; }
Text {
text: @tr("You're offline");
color: Theme.text-primary;
font-size: Typography.heading;
font-weight: Typography.semibold;
horizontal-alignment: center;
}
Rectangle { height: 8px; }
HorizontalLayout {
alignment: center;
Text {
max-width: 420px;
text: root.induced
? @tr("Offline mode is enabled. Disable it in Settings to use Qobuz.")
: @tr("No internet connection. Your local library and downloads keep working.");
color: Theme.text-secondary;
font-size: Typography.body;
horizontal-alignment: center;
wrap: word-wrap;
}
}
if root.induced: Rectangle { height: 20px; }
if root.induced: HorizontalLayout {
alignment: center;
SecondaryButton {
label: @tr("Open Settings");
clicked => {
// Settings > Offline is section index 3 (SettingsView nav).
SettingsState.section = 3;
NavState.request-settings();
}
}
}
// Optional extra content under the placeholder copy. Empty on the
// generic mounts; the Favorites mount injects the B9 "playable
// favorites" rail here (see AppShell + FavoritesOfflineRail).
@children
}
}