diff --git a/static/v3/playlists.js b/static/v3/playlists.js index 1e060be..c336d65 100644 --- a/static/v3/playlists.js +++ b/static/v3/playlists.js @@ -104,7 +104,7 @@ : '
No playlists yet. Create one to group songs.
') + ''; root.querySelector('#v3-pl-new')?.addEventListener('click', async () => { - const name = (window.prompt('Playlist name?') || '').trim(); + const name = ((await window.uiPrompt({ title: 'New Playlist', label: 'Playlist name', okLabel: 'Create', placeholder: 'My Playlist' })) || '').trim(); if (!name) return; await jsend('POST', '/api/playlists', { name }); renderPlaylists(); @@ -137,7 +137,7 @@ const listEl = root.querySelector('#v3-pl-songs'); if (listEl) wireSongRows(listEl, pid, () => renderPlaylistDetail(pid)); root.querySelector('#v3-pl-rename')?.addEventListener('click', async () => { - const name = (window.prompt('Rename playlist', pl.name) || '').trim(); + const name = ((await window.uiPrompt({ title: 'Rename Playlist', label: 'Playlist name', value: pl.name, okLabel: 'Rename' })) || '').trim(); if (!name) return; await jsend('PATCH', '/api/playlists/' + pid, { name }); renderPlaylistDetail(pid); diff --git a/static/v3/songs.js b/static/v3/songs.js index 67c6e5e..fa44a95 100644 --- a/static/v3/songs.js +++ b/static/v3/songs.js @@ -595,8 +595,13 @@ async function batchAddToPlaylist() { const lists = (await jget('/api/playlists')) || []; const choices = lists.filter((p) => !p.system_key); - const labels = choices.map((p, i) => (i + 1) + '. ' + p.name).join('\n'); - const ans = (window.prompt('Add ' + state.selected.size + ' song(s) to which playlist?\n' + labels + '\n\nEnter a number, or a new playlist name:', '') || '').trim(); + const labels = choices.map((p, i) => (i + 1) + '. ' + p.name).join(' '); + const ans = ((await window.uiPrompt({ + title: 'Add ' + state.selected.size + ' song(s) to a playlist', + label: (labels ? labels + ' ' : '') + 'Type a number above, or a new playlist name:', + okLabel: 'Add', + placeholder: 'Number or new playlist name', + })) || '').trim(); if (!ans) return; let pid = null; const num = parseInt(ans, 10);