feat(18-02): wire batch track-details to all 4 view context menus

- track-list: branch on selection count, resolve tracks from this.tracks
- cover-grid: branch on selection count, resolve from expandedTracks
- queue-panel: branch on indices count, resolve via libraryStore.getCachedTracks
- playlist-details: branch on selection count, resolve via libraryStore
- Each view determines coverArt/coverArtMixed state and calls showBatch()
This commit is contained in:
2026-03-18 13:14:02 -04:00
parent 6dab32b36b
commit 656985add9
4 changed files with 188 additions and 5 deletions
@@ -40,6 +40,7 @@ import {
removeDragImage,
} from '@utils/drag-image';
import { libraryStore } from '@store/library-store';
import type { library } from '@go/models';
import '@components/track-details/track-details.js';
import type { TrackDetails } from '@components/track-details/track-details.js';
import type { CoverArtUrls } from '@components/track-details/track-details.js';
@@ -817,7 +818,11 @@ export class QueuePanel
);
break;
case 'track-details':
this.openTrackDetails(indices[0]!);
if (indices.length === 1) {
this.openTrackDetails(indices[0]!);
} else {
this.openBatchTrackDetails(indices);
}
break;
}
@@ -869,6 +874,52 @@ export class QueuePanel
);
}
private openBatchTrackDetails(
indices: number[],
) {
const queueTracks = this.queue.tracks;
const cachedTracks =
libraryStore.getCachedTracks();
if (!cachedTracks) return;
const tracks = indices
.map((i) => queueTracks[i])
.filter((qt) => qt != null)
.map((qt) =>
cachedTracks.find(
(t) =>
t.FilePath === qt.filePath,
),
)
.filter(
(t): t is library.Track =>
t != null,
);
if (tracks.length === 0) return;
const albumNames = new Set(
tracks.map((t) => t.Album),
);
let coverArt: CoverArtUrls | null = null;
let coverArtMixed = false;
if (albumNames.size === 1) {
const albumName = [...albumNames][0]!;
coverArt =
this.resolveQueueCoverArt(albumName);
} else {
coverArtMixed = true;
}
this.trackDetailsDialog?.showBatch(
tracks,
coverArt,
coverArtMixed,
);
}
private resolveQueueCoverArt(
albumName: string,
): CoverArtUrls | null {