Restore manual track ordering in playlists (fix #165)
This commit is contained in:
parent
a308d380b9
commit
62937e551e
2 changed files with 7 additions and 8 deletions
|
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
<div id="sort-menu" style="display: none">
|
<div id="sort-menu" style="display: none">
|
||||||
<ul>
|
<ul>
|
||||||
<li data-sort="custom" class="requires-custom-order">Playlist Order</li>
|
<li data-sort="custom">Playlist Order</li>
|
||||||
<li data-sort="added-newest" class="requires-added-date">Date Added (Newest)</li>
|
<li data-sort="added-newest" class="requires-added-date">Date Added (Newest)</li>
|
||||||
<li data-sort="added-oldest" class="requires-added-date">Date Added (Oldest)</li>
|
<li data-sort="added-oldest" class="requires-added-date">Date Added (Oldest)</li>
|
||||||
<li data-sort="title">Title (A-Z)</li>
|
<li data-sort="title">Title (A-Z)</li>
|
||||||
|
|
|
||||||
13
js/ui.js
13
js/ui.js
|
|
@ -2327,11 +2327,13 @@ export class UIRenderer {
|
||||||
actionsDiv.insertBefore(removeBtn, menuBtn);
|
actionsDiv.insertBefore(removeBtn, menuBtn);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (currentSort === 'custom') {
|
// Always add is-editable class for owned playlists to fix layout
|
||||||
|
// This expands the grid columns to accommodate the remove button
|
||||||
container.classList.add('is-editable');
|
container.classList.add('is-editable');
|
||||||
|
|
||||||
|
// Only enable drag-and-drop reordering in custom sort mode
|
||||||
|
if (currentSort === 'custom') {
|
||||||
this.enableTrackReordering(container, currentTracks, playlistId, syncManager);
|
this.enableTrackReordering(container, currentTracks, playlistId, syncManager);
|
||||||
} else {
|
|
||||||
container.classList.remove('is-editable');
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
container.classList.remove('is-editable');
|
container.classList.remove('is-editable');
|
||||||
|
|
@ -3030,14 +3032,11 @@ export class UIRenderer {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const menu = document.getElementById('sort-menu');
|
const menu = document.getElementById('sort-menu');
|
||||||
|
|
||||||
// Show "Date Added" if tracks have addedAt, otherwise show "Playlist Order"
|
// Show "Date Added" options only if tracks have addedAt
|
||||||
const hasAddedDate = tracks.some((t) => t.addedAt);
|
const hasAddedDate = tracks.some((t) => t.addedAt);
|
||||||
menu.querySelectorAll('.requires-added-date').forEach((opt) => {
|
menu.querySelectorAll('.requires-added-date').forEach((opt) => {
|
||||||
opt.style.display = hasAddedDate ? '' : 'none';
|
opt.style.display = hasAddedDate ? '' : 'none';
|
||||||
});
|
});
|
||||||
menu.querySelectorAll('.requires-custom-order').forEach((opt) => {
|
|
||||||
opt.style.display = hasAddedDate ? 'none' : '';
|
|
||||||
});
|
|
||||||
|
|
||||||
// Highlight current sort option
|
// Highlight current sort option
|
||||||
const currentSortType = getCurrentSort ? getCurrentSort() : 'custom';
|
const currentSortType = getCurrentSort ? getCurrentSort() : 'custom';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue