mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-08-11 11:19:24 +00:00
fix(v3): replace broken window.prompt() in Playlists with in-app uiPrompt modal (#614)
window.prompt() is a silent no-op in the Electron desktop shell, so the Playlists "New Playlist" and "Rename" buttons and the library's bulk "add selected songs to a playlist" action did nothing. Route all three through the existing window.uiPrompt() modal (resolves to the string, or null on cancel; the handlers were already async). window.confirm() works in Electron and is left as-is. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
4480ac2732
commit
a57d0e3f85
@@ -104,7 +104,7 @@
|
||||
: '<p class="text-fb-textDim">No playlists yet. Create one to group songs.</p>') +
|
||||
'</div>';
|
||||
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);
|
||||
|
||||
+7
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user