diff --git a/src/components/playlist/PlaylistHero.tsx b/src/components/playlist/PlaylistHero.tsx new file mode 100644 index 00000000..3b0bc30a --- /dev/null +++ b/src/components/playlist/PlaylistHero.tsx @@ -0,0 +1,231 @@ +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 { + displayPlaylistName, formatSize, isSmartPlaylistName, totalDurationLabel, +} from '../../utils/playlistDetailHelpers'; +import CachedImage from '../CachedImage'; + +interface Props { + playlist: SubsonicPlaylist; + songs: SubsonicSong[]; + id: string | undefined; + customCoverId: string | null; + customCoverFetchUrl: string | null; + customCoverCacheKey: string | null; + coverQuadUrls: ({ src: string; cacheKey: string } | 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, customCoverFetchUrl, customCoverCacheKey, coverQuadUrls, + 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); + + return ( +
+ {resolvedBgUrl && enableCoverArtBackground && ( + <> +