fix custom playlist sortorder handling

This commit is contained in:
Simon
2025-07-12 22:24:02 +07:00
parent 2b709ce9c1
commit 454952d9dd
5 changed files with 36 additions and 25 deletions

View File

@@ -288,31 +288,33 @@ const Playlist = () => {
/>
</div>
)}
<div className="toggle">
<span>Switch sort order:</span>
<div className="toggleBox">
<input
id="playlist_sort_order"
type="checkbox"
checked={playlist.playlist_sort_order === 'bottom'}
onChange={async () => {
const newSortOrder =
playlist.playlist_sort_order === 'top' ? 'bottom' : 'top';
await updatePlaylistSortOrder(playlist.playlist_id, newSortOrder);
setRefresh(true);
}}
/>
{playlist.playlist_sort_order === 'bottom' ? (
<label htmlFor="" className="onbtn">
On
</label>
) : (
<label htmlFor="" className="ofbtn">
Off
</label>
)}
{playlist.playlist_type !== 'custom' && (
<div className="toggle">
<span>Switch sort order:</span>
<div className="toggleBox">
<input
id="playlist_sort_order"
type="checkbox"
checked={playlist.playlist_sort_order === 'bottom'}
onChange={async () => {
const newSortOrder =
playlist.playlist_sort_order === 'top' ? 'bottom' : 'top';
await updatePlaylistSortOrder(playlist.playlist_id, newSortOrder);
setRefresh(true);
}}
/>
{playlist.playlist_sort_order === 'bottom' ? (
<label htmlFor="" className="onbtn">
On
</label>
) : (
<label htmlFor="" className="ofbtn">
Off
</label>
)}
</div>
</div>
</div>
)}
</div>
</div>
</div>