import { Button } from '@/components/ui/button' import { filesService } from '@/lib/api/services/files' import type { PlayerState } from '@/lib/api/services/player' import { cn } from '@/lib/utils' import { Maximize2, Music } from 'lucide-react' import { memo } from 'react' interface CompactPlayerTrackInfoProps { currentSound: PlayerState['current_sound'] playlistName?: string onExpand: () => void } export const CompactPlayerTrackInfo = memo(function CompactPlayerTrackInfo({ currentSound, playlistName, onExpand, }: CompactPlayerTrackInfoProps) { return (
{currentSound?.thumbnail ? ( {currentSound.name} { // Hide image and show music icon if thumbnail fails to load const target = e.target as HTMLImageElement target.style.display = 'none' const musicIcon = target.nextElementSibling as HTMLElement if (musicIcon) musicIcon.style.display = 'block' }} /> ) : null}
{currentSound?.name || 'No track selected'}
{playlistName}
) })