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:
@@ -10,7 +10,8 @@ use crate::utils::lock::MutexSafe;
|
||||
use log::error;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::sync::Arc;
|
||||
use tauri::{AppHandle, Emitter};
|
||||
use tauri::AppHandle;
|
||||
use tauri_specta::Event;
|
||||
|
||||
use super::{MediaSessionType, SleepTimerMode};
|
||||
|
||||
@@ -20,8 +21,8 @@ use super::{MediaSessionType, SleepTimerMode};
|
||||
/// state machine transitions.
|
||||
///
|
||||
/// TRACES: UR-005, UR-019, UR-023, UR-026 | DR-001, DR-028, DR-047
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, specta::Type, tauri_specta::Event)]
|
||||
#[serde(tag = "type", rename_all = "snake_case", rename_all_fields = "camelCase")]
|
||||
pub enum PlayerStatusEvent {
|
||||
/// Playback position updated (emitted periodically during playback)
|
||||
PositionUpdate {
|
||||
@@ -113,9 +114,6 @@ pub enum PlayerStatusEvent {
|
||||
},
|
||||
}
|
||||
|
||||
/// Tauri event name for player status events
|
||||
pub const PLAYER_EVENT_NAME: &str = "player-event";
|
||||
|
||||
/// Trait for emitting player events to the frontend.
|
||||
///
|
||||
/// This abstraction allows backends to emit events without depending
|
||||
@@ -141,7 +139,9 @@ impl TauriEventEmitter {
|
||||
|
||||
impl PlayerEventEmitter for TauriEventEmitter {
|
||||
fn emit(&self, event: PlayerStatusEvent) {
|
||||
if let Err(e) = self.app_handle.emit(PLAYER_EVENT_NAME, &event) {
|
||||
// Emitted via the tauri-specta Event trait so the payload shape and event
|
||||
// name match the generated TypeScript bindings (events.playerStatusEvent).
|
||||
if let Err(e) = Event::emit(&event, &self.app_handle) {
|
||||
error!("Failed to emit player event: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user