« get me outta code hell

Only show 'shuffle' context menu options on groups - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-07-25 14:16:33 -0300
committerFlorrie <towerofnix@gmail.com>2018-07-25 14:16:40 -0300
commite90f95077be409333d0e7d67c84c84352245fae2 (patch)
treef269bfd48f7894507c223599ce9593eaa010a0d7
parentff828a89b40060519c8d1557c0b504242948b2fc (diff)
Only show 'shuffle' context menu options on groups
This really puts the "context" in "context menu"!
-rw-r--r--ui.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/ui.js b/ui.js
index f686ba9..e6ae644 100644
--- a/ui.js
+++ b/ui.js
@@ -976,8 +976,8 @@ class GrouplikeItemElement extends Button {
           {label: 'Play', action: () => this.emit('play')},
           {label: 'Play next', action: () => this.emit('queue (play next)')},
           {label: 'Play at end', action: () => this.emit('queue (at end)')},
-          {label: 'Play next, shuffled', action: () => this.emit('queue (play next, shuffled)')},
-          {label: 'Play at end, shuffled', action: () => this.emit('queue (at end, shuffled)')}
+          isGroup(this.item) && {label: 'Play next, shuffled', action: () => this.emit('queue (play next, shuffled)')},
+          isGroup(this.item) && {label: 'Play at end, shuffled', action: () => this.emit('queue (at end, shuffled)')}
         ]
       })
     }
@@ -1470,7 +1470,7 @@ class ContextMenu extends FocusElement {
     this.visible = true
 
     // TODO: Actions, that sorta thing
-    for (const { label, action } of items) {
+    for (const { label, action } of items.filter(Boolean)) {
       const button = new Button(label)
       if (action) {
         button.on('pressed', () => {