From 0b84a199e41e3cd5e645ed6c59f9ac84bd839585 Mon Sep 17 00:00:00 2001 From: Frank Stellmacher <171614930+Psychotoxical@users.noreply.github.com> Date: Wed, 13 May 2026 13:09:00 +0200 Subject: [PATCH] =?UTF-8?q?refactor(playlist):=20G.65=20=E2=80=94=20extrac?= =?UTF-8?q?t=20Tracklist=20+=20FilterToolbar=20+=20displayedSongs=20(clust?= =?UTF-8?q?er)=20(#632)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three-cut cluster on PlaylistDetail.tsx. 1065 → 742 LOC (−323). PlaylistTracklist — the big one. Owns the bulk-action bar, column visibility picker, sortable header (3-click cycle: asc → desc → natural, plus arrow indicator + drag-resize handles between columns), empty state with "add first song" button, and the song rows themselves (drag-over indicators, current-track highlight, bulk-selection check, ctrl/meta/shift selection vs. play vs. orbit-queue-hint, inline play-next + preview buttons in the title cell, artist/album links, star/rating cells, format/duration/delete columns). Subscribes directly to playerStore (currentTrack / isPlaying / playTrack / openContextMenu / starredOverrides / userRatingOverrides), previewStore (previewingId / audioStarted), themeStore (showBitrate), useDragDrop (isDragging), useOrbitSongRowBehavior — so the parent doesn't have to thread any of that through props. PL_CENTERED moves to the component because the only remaining tracklist header lives there now. PlaylistFilterToolbar — small filter input with clear-X. playlistDisplayedSongs — pure `getDisplayedSongs(songs, opts)` that returns the filtered + sorted song list. Exports PlaylistSortKey / PlaylistSortDir types so PlaylistDetail's sortKey/sortDir state and PlaylistTracklist's props share the same union types. PlaylistDetail's import list loses the icons/components that only the tracklist used (AudioLines, ChevronDown, Check, Heart, RotateCcw, StarRating, AddToPlaylistSubmenu) — they followed the component to the new file. Pure code move otherwise. --- .../playlist/PlaylistFilterToolbar.tsx | 35 ++ src/components/playlist/PlaylistTracklist.tsx | 435 +++++++++++++++++ src/pages/PlaylistDetail.tsx | 436 +++--------------- src/utils/playlistDisplayedSongs.ts | 43 ++ 4 files changed, 569 insertions(+), 380 deletions(-) create mode 100644 src/components/playlist/PlaylistFilterToolbar.tsx create mode 100644 src/components/playlist/PlaylistTracklist.tsx create mode 100644 src/utils/playlistDisplayedSongs.ts diff --git a/src/components/playlist/PlaylistFilterToolbar.tsx b/src/components/playlist/PlaylistFilterToolbar.tsx new file mode 100644 index 00000000..28851bbb --- /dev/null +++ b/src/components/playlist/PlaylistFilterToolbar.tsx @@ -0,0 +1,35 @@ +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { Search, X } from 'lucide-react'; + +interface Props { + filterText: string; + setFilterText: (v: string) => void; +} + +export default function PlaylistFilterToolbar({ filterText, setFilterText }: Props) { + const { t } = useTranslation(); + return ( +