added context menu to search panel songs

This commit is contained in:
kveld9
2026-04-15 12:36:32 -03:00
parent 19b7c8ec06
commit 56d025f150
4 changed files with 75 additions and 17 deletions
+14 -2
View File
@@ -91,16 +91,28 @@ export function AddToPlaylistSubmenu({ songIds, onDone, dropDown, triggerId }: {
const newIds = songIds.filter((id) => !existingIds.has(id));
if (newIds.length > 0) {
await updatePlaylist(pl.id, [...songs.map((s) => s.id), ...newIds]);
showToast(t('playlists.addSuccess', { count: newIds.length, playlist: pl.name }));
} else {
showToast(t('playlists.addAllSkipped', { count: songIds.length, playlist: pl.name }), 3000, 'info');
}
touchPlaylist(pl.id);
} catch {}
} catch {
showToast(t('playlists.addError'), 3000, 'error');
}
setAdding(null);
onDone();
};
const handleCreate = async () => {
const name = newName.trim() || t('playlists.unnamed');
await createPlaylist(name, songIds);
try {
const pl = await createPlaylist(name, songIds);
if (pl?.id) {
showToast(t('playlists.createAndAddSuccess', { count: songIds.length, playlist: pl.name || name }));
}
} catch {
showToast(t('playlists.createError'), 3000, 'error');
}
onDone();
};