feat(toast): buffering toast with shimmer effect, persistent until loaded

- Add 'buffering' toast type that doesn't auto-hide
- Add shimmer animation to "Buffering" text
- Add spinning loader icon for buffering state
- Toast shows "Buffering... [track name]" format
- Dismiss buffering toast when track loads or on error
- Remove callback pattern, use toastStore directly in services

fix(artwork): show empty placeholder when no artwork available

- NowPlayingBar shows empty placeholder instead of Play icon
- Miniplayer shows empty placeholder instead of Play icon
- Prevents showing incorrect CD placeholder on session restore
This commit is contained in:
vicrodh committed 2026-01-12 09:06:58 -06:00
1 parent 434f8d8a67
commit e93144e5ef
7 files changed
+131 -62

No files matched your search

+13 -12
View File
@@ -34,19 +34,17 @@ export interface MediaMetadata {
coverUrl: string | null;
}
// ============ Callbacks ============
// These are set by the consumer (e.g., +page.svelte) to handle UI feedback
// ============ Toast Integration ============
// Use the toast store directly for buffering toast support
let toastCallback: ((message: string, type: 'success' | 'error' | 'info') => void) | null = null;
import {
showToast as storeShowToast,
dismissBuffering,
type ToastType
} from '$lib/stores/toastStore';
export function setToastCallback(callback: (message: string, type: 'success' | 'error' | 'info') => void): void {
toastCallback = callback;
}
function showToast(message: string, type: 'success' | 'error' | 'info'): void {
if (toastCallback) {
toastCallback(message, type);
}
function showToast(message: string, type: ToastType): void {
storeShowToast(message, type);
}
// ============ Core Playback ============
@@ -65,7 +63,7 @@ export async function playTrack(
try {
if (showLoadingToast) {
showToast(`Loading: ${track.title}`, 'info');
showToast(track.title, 'buffering');
}
// Use appropriate playback command
@@ -75,6 +73,8 @@ export async function playTrack(
await invoke('play_track', { trackId: track.id });
}
// Dismiss buffering toast and show success
dismissBuffering();
setIsPlaying(true);
showToast(`Playing: ${track.title}`, 'success');
@@ -125,6 +125,7 @@ export async function playTrack(
return true;
} catch (err) {
console.error('Failed to play track:', err);
dismissBuffering();
showToast(`Playback error: ${err}`, 'error');
setIsPlaying(false);
return false;