import { useQuery } from '@tanstack/react-query'; import { X } from 'lucide-react'; import { usePlaybackStore } from '../store/usePlaybackStore'; import { trackService } from '../services/trackService'; import { albumService } from '../services/albumService'; import { Artwork } from './Artwork'; import { ArtistLinks } from './ArtistLinks'; import { SyncedLyrics } from './SyncedLyrics'; /** * Dedicated, roomy lyrics view — overlays the content area (not the playback * bar, so transport stays usable). Separated from the queue sidebar so the * karaoke lyrics get the space they deserve. */ export function LyricsOverlay({ onClose }: { onClose: () => void }) { const currentTrack = usePlaybackStore((s) => s.currentTrack); const albumQ = useQuery({ queryKey: ['album', currentTrack?.album_id], queryFn: () => albumService.getAlbum(currentTrack!.album_id), enabled: !!currentTrack?.album_id, staleTime: 5 * 60 * 1000, }); const lyricsQ = useQuery({ queryKey: ['lyrics', currentTrack?.id], queryFn: () => trackService.getLyrics(currentTrack!.id), enabled: !!currentTrack, retry: false, }); return (
Nothing playing.
) : lyricsQ.isLoading ? (Loading…
) : lyricsQ.isError || !lyricsQ.data ? (No lyrics available.
) : (