« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--socket.js2
-rw-r--r--todo.txt7
-rw-r--r--ui.js11
3 files changed, 19 insertions, 1 deletions
diff --git a/socket.js b/socket.js
index 33269ee..e02285c 100644
--- a/socket.js
+++ b/socket.js
@@ -42,7 +42,7 @@ import {
 // clients / the server otherwise.
 const DEFAULT_NICKNAME = '(Unnamed)'
 
-const originalSymbol = Symbol('Original item')
+export const originalSymbol = Symbol('Original item')
 
 function serializePartySource(item) {
   // Turn an item into a sanitized, compact format for sharing with the server
diff --git a/todo.txt b/todo.txt
index 1371aa8..2cf7f66 100644
--- a/todo.txt
+++ b/todo.txt
@@ -704,6 +704,13 @@ TODO: The checks for "grouplike"/"track" have been super arbitrary for a long
 TODO: Synchronize items that have been shared with the party upon a new client
       joining. Should be next to (or part of) the initialize-backend command.
 
+TODO: We currently use a hack to access the original item in the context menu
+      for items in the party sources listing. This doesn't make, for example,
+      queuing by pressing enter on a track work. We should instead have a way
+      to specifically refer to the item "represented" by a line, rather than
+      the literal object it's associated with (i.e. the pseudo-track/group
+      shared in the sources array).
+
 TODO: Pressing escape while you've got items selected should deselect those
       items, rather than stop playback! ...Or SHOULD IT??? Well, yes. But it's
       still handy to not be locked out of stopping playback altogether.
diff --git a/ui.js b/ui.js
index b64763b..7e36858 100644
--- a/ui.js
+++ b/ui.js
@@ -19,6 +19,7 @@ import unic from 'tui-lib/util/unichars'
 
 import {getAllCrawlersForArg} from './crawlers.js'
 import processSmartPlaylist from './smart-playlist.js'
+import {originalSymbol} from './socket.js'
 import UndoManager from './undo-manager.js'
 
 import {
@@ -1498,6 +1499,16 @@ export default class AppElement extends FocusElement {
       // const isMarked = false
 
       const rootGroup = getItemPath(item)[0]
+
+      // This is the hack mentioned in the todo!!!!
+      if (
+        this.config.showPartyControls &&
+        rootGroup.isPartySources &&
+        item[originalSymbol]
+      ) {
+        item = item[originalSymbol]
+      }
+
       // const hasNotesFile = !!getCorrespondingFileForItem(item, '.txt')
       const timestampsItem = this.hasTimestampsFile(item) && (this.timestampsExpanded(item, listing)
         ? {label: 'Collapse saved timestamps', action: () => this.collapseTimestamps(item, listing)}