feat(library): genre sliders, artist links, and navigation utils
- music landing: diverse per-genre album sliders (online counts / offline wide-probe fallback) and home-screen library shortcuts - add ArtistLinks component and shared navigation/genreDiversity utils - player/playback-mode refinements across Rust and frontend
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
// TRACES: UR-010 | DR-037
|
||||
|
||||
import { writable, derived } from "svelte/store";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { commands } from "$lib/api/bindings";
|
||||
import { commands, events } from "$lib/api/bindings";
|
||||
import type { Session } from "$lib/api/types";
|
||||
|
||||
interface SessionsState {
|
||||
@@ -14,11 +13,6 @@ interface SessionsState {
|
||||
lastUpdated: Date | null;
|
||||
}
|
||||
|
||||
interface PlayerStatusEvent {
|
||||
type: string;
|
||||
sessions?: Session[];
|
||||
}
|
||||
|
||||
function createSessionsStore() {
|
||||
const initialState: SessionsState = {
|
||||
sessions: [],
|
||||
@@ -30,16 +24,17 @@ function createSessionsStore() {
|
||||
|
||||
const { subscribe, update } = writable<SessionsState>(initialState);
|
||||
|
||||
// Listen for session updates from Rust backend
|
||||
listen<PlayerStatusEvent>("player-event", (event) => {
|
||||
if (event.payload.type === "sessions_updated" && event.payload.sessions) {
|
||||
console.log(`[Sessions] Received ${event.payload.sessions.length} sessions from backend`);
|
||||
event.payload.sessions.forEach((s, i) => {
|
||||
// Listen for session updates from Rust backend (generated tauri-specta event)
|
||||
events.playerStatusEvent.listen((event) => {
|
||||
if (event.payload.type === "sessions_updated") {
|
||||
const sessions = event.payload.sessions as unknown as Session[];
|
||||
console.log(`[Sessions] Received ${sessions.length} sessions from backend`);
|
||||
sessions.forEach((s, i) => {
|
||||
console.log(`[Sessions] Session ${i}: id=${s.id}, device=${s.deviceName}, supportsRemoteControl=${s.supportsRemoteControl}`);
|
||||
});
|
||||
update((s) => ({
|
||||
...s,
|
||||
sessions: event.payload.sessions!,
|
||||
sessions,
|
||||
lastUpdated: new Date(),
|
||||
error: null,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user