Skip to content

Commit

Permalink
fix: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ocoke committed Dec 21, 2023
1 parent 988cdfd commit da08aa0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
19 changes: 12 additions & 7 deletions src/views/CardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,17 @@
console.log(data.value)
const durationMs = data.value.item.duration_ms
const progressMs = data.value.item.progress_ms
if (data.value.item) {
const durationMs = data.value.item.duration_ms
const progressMs = data.value.item.progress_ms
const progressWidth = (progressMs / durationMs) * 100
const progressWidth = (progressMs / durationMs) * 100
if (progress.value) {
progress.value.style.width = progressWidth + '%'
}
if (progress.value) {
progress.value.style.width = progressWidth + '%'
}
}
const colorThief = new ColorThief()
Expand Down Expand Up @@ -133,8 +135,9 @@
'#FFFFFF',
'#000000'
)
if (progress.value) {
progress.value.style.backgroundColor = pickTextColor(color, '#FFFFFF', '#000000')
progress.value.style.backgroundColor = trackTitle.value.style.color
}
})
// }
Expand All @@ -151,12 +154,14 @@
.then((response) => response.text())
.then((text) => (text ? JSON.parse(text).data : {}))
if (data.value.item) {
const durationMs = data.value.item.duration_ms
const progressMs = data.value.item.progress_ms
const progressWidth = (progressMs / durationMs) * 100
if (progress.value) {
progress.value.style.width = progressWidth + '%'
}
}
}, 5000)
</script>

5 changes: 3 additions & 2 deletions src/views/NowView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/>

<div class="w-full bg-gray-300 mt-7 mb-1 rounded-full h-1" v-if="showProgress" ref="progressBar">
<div class="bg-white h-1 rounded-full opacity-50" ref="progress" style="width: 0; transition: all 4.5s;"></div>
<div class="h-1 rounded-full opacity-50" ref="progress" style="width: 0; transition: all 4.5s;"></div>
</div></div>
</div>
<div class="meta w-full sm:w-1/2">
Expand Down Expand Up @@ -155,8 +155,9 @@ watch(img, () => {
'#000000'
)
if (progress.value) {
progress.value.style.backgroundColor = pickTextColor(color, '#FFFFFF', '#000000')
progress.value.style.backgroundColor = trackTitle.value.style.color
}
})
// }
})
Expand Down

0 comments on commit da08aa0

Please sign in to comment.