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 @@ - - - - + + + + + + {{ item.name }} + + {{ item.artists.map(x => x.name).join(`, `) }} + + + {{ item.popularity }} + {{ duration }} @@ -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