From 39732bd31e13c9a785eac1fc724bc9fc768be2ab Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 14 Aug 2021 00:44:47 -0300 Subject: show timestamp hours column whenever appropriate --- ui.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ui.js') diff --git a/ui.js b/ui.js index 2da7e02..d6452d9 100644 --- a/ui.js +++ b/ui.js @@ -2557,7 +2557,7 @@ class GrouplikeListingElement extends Form { // Generate some items! Just go over the data list and generate one for // each timestamp. const tsElements = timestampData.map(ts => { - const el = new TimestampGrouplikeItemElement(item, ts, this.app) + const el = new TimestampGrouplikeItemElement(item, ts, timestampData, this.app) el.on('pressed', () => this.emit('timestamp', item, ts.timestamp)) if (this.grouplike.isTheQueue) { el.hideMetadata = true @@ -3752,20 +3752,24 @@ class InteractiveGrouplikeItemElement extends BasicGrouplikeItemElement { } class TimestampGrouplikeItemElement extends BasicGrouplikeItemElement { - constructor(item, timestampData, app) { + constructor(item, timestampData, tsDataArray, app) { super('') this.app = app this.data = timestampData + this.tsData = tsDataArray this.item = item this.hideMetadata = false } drawTo(writable) { - const { data } = this + const { data, tsData } = this const metadata = this.app.backend.getMetadataFor(this.item) - const duration = (metadata && metadata.duration) || 0 + const last = tsData[tsData.length - 1] + const duration = ((metadata && metadata.duration) + || last.timestampEnd !== Infinity && last.timestampEnd + || last.timestamp) const strings = getTimeStringsFromSec(data.timestamp, duration) const stringsEnd = getTimeStringsFromSec(data.timestampEnd, duration) -- cgit 1.3.0-6-gf8a5