diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-08-14 00:11:15 -0300 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-08-14 00:11:15 -0300 |
commit | 9c7e30f90f0e30535f87fbb28222c9a40940d9ec (patch) | |
tree | ac7e612b46ac2603837894a2d1c27f4170f35421 | |
parent | b29f82bc0afca425bb42fecc0583e804701110dd (diff) |
show timestamp durations in main listing
-rw-r--r-- | ui.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ui.js b/ui.js index 594c6f8..2599427 100644 --- a/ui.js +++ b/ui.js @@ -2559,6 +2559,9 @@ class GrouplikeListingElement extends Form { const tsElements = timestampData.map(ts => { const el = new TimestampGrouplikeItemElement(item, ts, this.app) el.on('pressed', () => this.emit('timestamp', item, ts.timestamp)) + if (this.grouplike.isTheQueue) { + el.hideMetadata = true + } return el }) @@ -3755,6 +3758,7 @@ class TimestampGrouplikeItemElement extends BasicGrouplikeItemElement { this.app = app this.data = timestampData this.item = item + this.hideMetadata = false } drawTo(writable) { @@ -3777,6 +3781,18 @@ class TimestampGrouplikeItemElement extends BasicGrouplikeItemElement { : '') ) + if (!this.hideMetadata) { + const durationString = (data.timestampEnd === Infinity + ? 'to end' + : getTimeStringsFromSec(0, data.timestampEnd - data.timestamp).duration) + + // Try to line up so there's one column of negative padding - the duration + // of the timestamp(s) should start one column before the duration of the + // actual track. This makes for a nice nested look! + const rightPadding = ' '.repeat(duration > 3600 ? 4 : 2) + this.rightText = ` (${durationString})` + rightPadding + } + super.drawTo(writable) } |