style: auto-fix linting issues
This commit is contained in:
parent
92dc25cf68
commit
5bb028d153
3 changed files with 21 additions and 18 deletions
20
index.html
20
index.html
|
|
@ -799,18 +799,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div id="playlist-detail-tracklist" class="track-list"></div>
|
<div id="playlist-detail-tracklist" class="track-list"></div>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
class="content-section"
|
class="content-section"
|
||||||
id="playlist-section-recommended"
|
id="playlist-section-recommended"
|
||||||
style="display: none; margin-top: 3rem"
|
style="display: none; margin-top: 3rem"
|
||||||
>
|
>
|
||||||
<h2 class="section-title">Recommended Songs</h2>
|
<h2 class="section-title">Recommended Songs</h2>
|
||||||
<p style="color: grey; margin-bottom: 15px;">Suggested Songs From Your Playlist.</p>
|
<p style="color: grey; margin-bottom: 15px">Suggested Songs From Your Playlist.</p>
|
||||||
<div class="track-list" id="playlist-detail-recommended"></div>
|
<div class="track-list" id="playlist-detail-recommended"></div>
|
||||||
|
</section>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="page-mix" class="page">
|
<section id="page-mix" class="page">
|
||||||
<header class="detail-header">
|
<header class="detail-header">
|
||||||
|
|
|
||||||
|
|
@ -742,7 +742,7 @@ export class LosslessAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
const recommendedTracks = [];
|
const recommendedTracks = [];
|
||||||
const seenTrackIds = new Set(tracks.map(t => t.id));
|
const seenTrackIds = new Set(tracks.map((t) => t.id));
|
||||||
|
|
||||||
const artistsToProcess = artists.slice(0, Math.min(5, artists.length));
|
const artistsToProcess = artists.slice(0, Math.min(5, artists.length));
|
||||||
console.log(`Processing ${artistsToProcess.length} artists for recommendations`);
|
console.log(`Processing ${artistsToProcess.length} artists for recommendations`);
|
||||||
|
|
@ -752,14 +752,11 @@ export class LosslessAPI {
|
||||||
console.log(`Fetching tracks for artist: ${artist.name} (ID: ${artist.id})`);
|
console.log(`Fetching tracks for artist: ${artist.name} (ID: ${artist.id})`);
|
||||||
const artistData = await this.getArtist(artist.id);
|
const artistData = await this.getArtist(artist.id);
|
||||||
if (artistData && artistData.tracks && artistData.tracks.length > 0) {
|
if (artistData && artistData.tracks && artistData.tracks.length > 0) {
|
||||||
|
const newTracks = artistData.tracks.filter((track) => !seenTrackIds.has(track.id)).slice(0, 4);
|
||||||
const newTracks = artistData.tracks
|
|
||||||
.filter(track => !seenTrackIds.has(track.id))
|
|
||||||
.slice(0, 4);
|
|
||||||
|
|
||||||
console.log(`Found ${newTracks.length} new tracks from ${artist.name}`);
|
console.log(`Found ${newTracks.length} new tracks from ${artist.name}`);
|
||||||
recommendedTracks.push(...newTracks);
|
recommendedTracks.push(...newTracks);
|
||||||
seenTrackIds.add(...newTracks.map(t => t.id));
|
seenTrackIds.add(...newTracks.map((t) => t.id));
|
||||||
} else {
|
} else {
|
||||||
console.warn(`No tracks found for artist ${artist.name}`);
|
console.warn(`No tracks found for artist ${artist.name}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
js/ui.js
10
js/ui.js
|
|
@ -1196,7 +1196,8 @@ export class UIRenderer {
|
||||||
const addToPlaylistBtn = document.createElement('button');
|
const addToPlaylistBtn = document.createElement('button');
|
||||||
addToPlaylistBtn.className = 'track-action-btn add-to-playlist-btn';
|
addToPlaylistBtn.className = 'track-action-btn add-to-playlist-btn';
|
||||||
addToPlaylistBtn.title = 'Add to this playlist';
|
addToPlaylistBtn.title = 'Add to this playlist';
|
||||||
addToPlaylistBtn.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14"/><path d="M5 12h14"/></svg>';
|
addToPlaylistBtn.innerHTML =
|
||||||
|
'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14"/><path d="M5 12h14"/></svg>';
|
||||||
addToPlaylistBtn.onclick = async (e) => {
|
addToPlaylistBtn.onclick = async (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const trackData = trackDataStore.get(item);
|
const trackData = trackDataStore.get(item);
|
||||||
|
|
@ -1222,7 +1223,12 @@ export class UIRenderer {
|
||||||
this.renderListWithTracks(tracklistContainer, updatedPlaylist.tracks, true);
|
this.renderListWithTracks(tracklistContainer, updatedPlaylist.tracks, true);
|
||||||
|
|
||||||
if (document.querySelector('.remove-from-playlist-btn')) {
|
if (document.querySelector('.remove-from-playlist-btn')) {
|
||||||
this.enableTrackReordering(tracklistContainer, updatedPlaylist.tracks, playlistId, syncManager);
|
this.enableTrackReordering(
|
||||||
|
tracklistContainer,
|
||||||
|
updatedPlaylist.tracks,
|
||||||
|
playlistId,
|
||||||
|
syncManager
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the playlist metadata
|
// Update the playlist metadata
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue