import React from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; import { Camera, ChevronLeft, Download, FileUp, Globe, HardDriveDownload, ListPlus, Loader2, Lock, Pencil, Play, Search, Shuffle, Sparkles, Trash2, } from 'lucide-react'; import type { SubsonicPlaylist, SubsonicSong } from '../../api/subsonicTypes'; import type { ZipDownload } from '../../store/zipDownloadStore'; import { useThemeStore } from '../../store/themeStore'; import { usePlaylistLayoutStore, type PlaylistLayoutItemId } from '../../store/playlistLayoutStore'; import { displayPlaylistName, formatSize, isSmartPlaylistName, totalDurationLabel, } from '../../utils/componentHelpers/playlistDetailHelpers'; import type { CoverArtId } from '../../cover/types'; import { CoverArtImage } from '../../cover/CoverArtImage'; import { AlbumCoverArtImage } from '../../cover/AlbumCoverArtImage'; import { PLAYLIST_MAIN_COVER_CSS_PX } from '../../hooks/usePlaylistCovers'; import { PlaylistSmartCoverCell } from '../playlists/PlaylistCoverImages'; interface Props { playlist: SubsonicPlaylist; songs: SubsonicSong[]; id: string | undefined; customCoverId: string | null; coverQuadIds: (CoverArtId | null)[]; resolvedBgUrl: string | null; saving: boolean; searchOpen: boolean; csvImporting: boolean; activeZip: ZipDownload | undefined; isCached: boolean; isDownloading: boolean; offlineProgress: { done: number; total: number } | null; activeServerId: string; setEditingMeta: React.Dispatch>; setSearchOpen: React.Dispatch>; setSearchQuery: React.Dispatch>; setSearchResults: React.Dispatch>; setSelectedSearchIds: React.Dispatch>>; setSearchPlPickerOpen: React.Dispatch>; handlePlayAll: () => void; handleShuffleAll: () => void; handleEnqueueAll: () => void; handleImportCsv: () => void; handleDownload: () => void; deleteAlbum: (id: string, serverId: string) => void; downloadPlaylist: (id: string, name: string, coverArt: string | undefined, songs: SubsonicSong[], serverId: string) => void; } export default function PlaylistHero({ playlist, songs, id, customCoverId, coverQuadIds, resolvedBgUrl, saving, searchOpen, csvImporting, activeZip, isCached, isDownloading, offlineProgress, activeServerId, setEditingMeta, setSearchOpen, setSearchQuery, setSearchResults, setSelectedSearchIds, setSearchPlPickerOpen, handlePlayAll, handleShuffleAll, handleEnqueueAll, handleImportCsv, handleDownload, deleteAlbum, downloadPlaylist, }: Props) { const { t } = useTranslation(); const navigate = useNavigate(); const enableCoverArtBackground = useThemeStore(s => s.enableCoverArtBackground); const enablePlaylistCoverPhoto = useThemeStore(s => s.enablePlaylistCoverPhoto); const layoutItems = usePlaylistLayoutStore(s => s.items); const isLayoutVisible = (id: PlaylistLayoutItemId) => layoutItems.find(i => i.id === id)?.visible !== false; return (
{resolvedBgUrl && enableCoverArtBackground && ( <>