fix: corriger toutes les erreurs de lint restantes (263 -> 0)

This commit is contained in:
2026-07-04 14:34:50 +04:00
parent b193914c57
commit 454eefbe58
33 changed files with 210 additions and 159 deletions
+13 -5
View File
@@ -30,9 +30,10 @@ function createAudio(src) {
function parseLrc(text) {
const lines = []
for (const raw of text.split('\n')) {
const match = raw.match(/^\[(\d{2}):(\d{2})[.:]\d+\](.*)$/)
const match = raw.match(/^\[(\d{2}):(\d{2})[.:]\d+](.*)$/)
if (match) {
lines.push({time: parseInt(match[1]) * 60 + parseInt(match[2]), text: match[3].trim()})
const time = (Number.parseInt(match[1], 10) * 60) + Number.parseInt(match[2], 10)
lines.push({time, text: match[3].trim()})
}
}
@@ -145,6 +146,7 @@ export default function Lekte({audio, url, parole}) {
setPosition(0)
el.currentTime = 0
}
el.addEventListener('loadedmetadata', onLoaded)
el.addEventListener('ended', onEnded)
return () => {
@@ -154,7 +156,10 @@ export default function Lekte({audio, url, parole}) {
}, [audio])
useEffect(() => {
if (!parole?.pawol?.url) return
if (!parole?.pawol?.url) {
return
}
fetch(new URL(parole.pawol.url, IMAGE_URL).toString())
.then(r => r.text())
.then(text => setLrcLines(parseLrc(text)))
@@ -162,7 +167,7 @@ export default function Lekte({audio, url, parole}) {
}, [parole?.pawol?.url])
const activeIndex = lrcLines
? lrcLines.reduce((last, line, i) => line.time <= position ? i : last, -1)
? lrcLines.findLastIndex(line => line.time <= position)
: -1
const handleChangePosition = value => {
@@ -317,7 +322,10 @@ export default function Lekte({audio, url, parole}) {
{[-1, 0, 1].map(offset => {
const idx = activeIndex + offset
const line = lrcLines[idx]
if (!line) return <Box key={offset} sx={{height: offset === 0 ? 28 : 20}} />
if (!line) {
return <Box key={offset} sx={{height: offset === 0 ? 28 : 20}} />
}
return (
<Typography
key={offset}