forked from SpoTUI/SpoTUI
refactor(theme): simplify keydown variable logic in playlist panel
This commit is contained in:
@@ -1354,21 +1354,16 @@ async function handlePlaylistPanelKeydown(e) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isPlaylist = activePane === 'playlist';
|
||||||
if (e.key === "ArrowUp") {
|
if (e.key === "ArrowUp") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (activePane === 'playlist') {
|
if (isPlaylist && playlists.length) selectedPlaylist = (selectedPlaylist - 1 + playlists.length) % playlists.length;
|
||||||
if (playlists.length) selectedPlaylist = (selectedPlaylist - 1 + playlists.length) % playlists.length;
|
if (!isPlaylist && playlistSongs.length) selectedSong = (selectedSong - 1 + playlistSongs.length) % playlistSongs.length;
|
||||||
} else {
|
|
||||||
if (playlistSongs.length) selectedSong = (selectedSong - 1 + playlistSongs.length) % playlistSongs.length;
|
|
||||||
}
|
|
||||||
await renderPlaylistPanel();
|
await renderPlaylistPanel();
|
||||||
} else if (e.key === "ArrowDown") {
|
} else if (e.key === "ArrowDown") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (activePane === 'playlist') {
|
if (isPlaylist && playlists.length) selectedPlaylist = (selectedPlaylist + 1) % playlists.length;
|
||||||
if (playlists.length) selectedPlaylist = (selectedPlaylist + 1) % playlists.length;
|
if (!isPlaylist && playlistSongs.length) selectedSong = (selectedSong + 1) % playlistSongs.length;
|
||||||
} else {
|
|
||||||
if (playlistSongs.length) selectedSong = (selectedSong + 1) % playlistSongs.length;
|
|
||||||
}
|
|
||||||
await renderPlaylistPanel();
|
await renderPlaylistPanel();
|
||||||
} else if (e.key === "ArrowLeft") {
|
} else if (e.key === "ArrowLeft") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -1380,7 +1375,7 @@ async function handlePlaylistPanelKeydown(e) {
|
|||||||
await renderPlaylistPanel();
|
await renderPlaylistPanel();
|
||||||
} else if (e.key === "Enter") {
|
} else if (e.key === "Enter") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (activePane === 'playlist') {
|
if (isPlaylist) {
|
||||||
const p = playlists[selectedPlaylist];
|
const p = playlists[selectedPlaylist];
|
||||||
if (p) {
|
if (p) {
|
||||||
Spicetify.Player.playUri(p.uri);
|
Spicetify.Player.playUri(p.uri);
|
||||||
|
|||||||
Reference in New Issue
Block a user