From 948efcc54b0ad3f3e6fff3c511f7cf5138a1a75f Mon Sep 17 00:00:00 2001 From: Tyler-A Date: Wed, 5 Aug 2020 22:42:03 -0600 Subject: [PATCH] Populate track component --- src/components/cards/Track.vue | 119 +++++++++++++++++++++++++++++++-- 1 file changed, 112 insertions(+), 7 deletions(-) diff --git a/src/components/cards/Track.vue b/src/components/cards/Track.vue index 1f3a537..1746a1f 100644 --- a/src/components/cards/Track.vue +++ b/src/components/cards/Track.vue @@ -1,9 +1,34 @@ @@ -17,12 +42,92 @@ export default { required: true, } }, - data() { return {};}, - computed: {}, + data() { return { + duration_tooltip: `Song Duration`, + popularity_tooltip: `Song Popularity`, + }}, + computed: { + duration() { + let timestamp = ``; + + // Converting to seconds + let duration = Math.trunc(this.item.duration_ms / 1000); + let seconds = duration % 60; + + // Converting to minutes + duration = Math.trunc(duration / 60); + let minutes = duration % 60 + + // Converting to hours + duration = Math.trunc(duration / 60); + let hours = duration % 24; + + if (seconds < 10) { + seconds = `0${seconds}` + }; + + return `${hours > 0 ? `${hours}:` : ''}${minutes}:${seconds}`; + } + }, methods: {} } - \ No newline at end of file