Handle unsynced lyrics marked synced

This commit is contained in:
lucast committed 2026-10-05 02:22:06 +02:00
1 parent fb99058492
commit 51114d65c8
1 file changed
+6 -5
@@ -12,13 +12,14 @@ const debugView = useCookie("DEBUG_VIEW")
const debugViewEnabled = computed(() => String(debugView.value ?? "") === "1") const debugViewEnabled = computed(() => String(debugView.value ?? "") === "1")
const parsedLyrics = computed(() => { const parsedLyrics = computed(() => {
if (!song.value?.lyrics?.synced) return if (!song.value?.lyrics?.synced) return []
if (song.value.lyrics.synced) return parseLyrics(song.value.lyrics.text) return parseLyrics(song.value.lyrics.text)
}) })
const hasParsedLyrics = computed(() => parsedLyrics.value.length > 0)
const findLyricIndex = (time: number) => { const findLyricIndex = (time: number) => {
if (!parsedLyrics.value) return -1 if (!hasParsedLyrics.value) return -1
const index = parsedLyrics.value.findIndex( const index = parsedLyrics.value.findIndex(
(lyric, i) => (lyric, i) =>
@@ -34,7 +35,7 @@ const activeIndex = computed(() => {
return findLyricIndex(secondsPlayed.value) return findLyricIndex(secondsPlayed.value)
}) })
const scrollActiveIndex = computed(() => { const scrollActiveIndex = computed(() => {
if (!parsedLyrics.value) return -1 if (!hasParsedLyrics.value) return -1
const time = secondsPlayed.value + animationDuration const time = secondsPlayed.value + animationDuration
@@ -164,7 +165,7 @@ const finalTransform = computed(() => {
/> />
<div <div
ref="outer-ref" ref="outer-ref"
v-if="song && song.lyrics && song.lyrics.synced" v-if="song && song.lyrics && song.lyrics.synced && hasParsedLyrics"
class="synced-lyrics-container" class="synced-lyrics-container"
:style="{ :style="{
height: `${syncedHeight + topFadeExtension}px`, height: `${syncedHeight + topFadeExtension}px`,