fix: corriger toutes les erreurs de lint restantes (263 -> 0)
This commit is contained in:
@@ -20,7 +20,7 @@ const getMizikFiltered = (paroles, filter) => {
|
||||
const filteredTitre = paroles.filter(({titre}) => {
|
||||
const deburredTit = deburr(titre)
|
||||
return deburredTit.toLowerCase().includes(deburr(filter.toLowerCase()))
|
||||
})
|
||||
})
|
||||
|
||||
const filteredAlias = paroles.filter(({artistes}) => {
|
||||
const aliasLis = artistes.map(({alias}) => deburr(alias)).join(', ')
|
||||
|
||||
@@ -21,7 +21,7 @@ const pulse = keyframes`
|
||||
`
|
||||
|
||||
const SlideUp = forwardRef(function SlideUp(props, ref) {
|
||||
return <Slide direction='up' ref={ref} {...props} />
|
||||
return <Slide ref={ref} direction='up' {...props} />
|
||||
})
|
||||
|
||||
function toEmbedUrl(url) {
|
||||
@@ -31,6 +31,7 @@ function toEmbedUrl(url) {
|
||||
if (match) {
|
||||
return `${u.origin}/videos/embed/${match[1]}?title=0&warningTitle=0&peertubeLink=0&controlBar=1`
|
||||
}
|
||||
|
||||
return url
|
||||
} catch {
|
||||
return url
|
||||
@@ -45,7 +46,9 @@ export default function KaraokeModal({url, desktopUrl, titre, artistes}) {
|
||||
const activeUrl = (!isMobile && desktopUrl) ? desktopUrl : url
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) setLoaded(false)
|
||||
if (!open) {
|
||||
setLoaded(false)
|
||||
}
|
||||
}, [open])
|
||||
|
||||
return (
|
||||
@@ -55,13 +58,13 @@ export default function KaraokeModal({url, desktopUrl, titre, artistes}) {
|
||||
color='primary'
|
||||
size={isMobile ? 'medium' : 'large'}
|
||||
aria-label='karaoké'
|
||||
onClick={() => setOpen(true)}
|
||||
sx={{
|
||||
position: 'fixed',
|
||||
bottom: {xs: 24, sm: 32},
|
||||
right: {xs: 24, sm: 32},
|
||||
zIndex: 1050,
|
||||
}}
|
||||
onClick={() => setOpen(true)}
|
||||
>
|
||||
<MicIcon />
|
||||
</Fab>
|
||||
@@ -69,7 +72,6 @@ export default function KaraokeModal({url, desktopUrl, titre, artistes}) {
|
||||
|
||||
<Dialog
|
||||
open={open}
|
||||
onClose={() => setOpen(false)}
|
||||
slots={{transition: SlideUp}}
|
||||
maxWidth={false}
|
||||
sx={{
|
||||
@@ -102,6 +104,7 @@ export default function KaraokeModal({url, desktopUrl, titre, artistes}) {
|
||||
}
|
||||
}
|
||||
}}
|
||||
onClose={() => setOpen(false)}
|
||||
>
|
||||
{/* Header superposé en gradient */}
|
||||
<Box sx={{
|
||||
@@ -118,7 +121,8 @@ export default function KaraokeModal({url, desktopUrl, titre, artistes}) {
|
||||
alignItems: 'flex-start',
|
||||
justifyContent: 'space-between',
|
||||
pointerEvents: 'none',
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<Box sx={{pointerEvents: 'none'}}>
|
||||
{titre && (
|
||||
<Typography variant='subtitle1' sx={{color: '#fff', fontWeight: 700, lineHeight: 1.2, textShadow: '0 1px 4px rgba(0,0,0,0.5)'}}>
|
||||
@@ -133,7 +137,6 @@ export default function KaraokeModal({url, desktopUrl, titre, artistes}) {
|
||||
</Box>
|
||||
<IconButton
|
||||
size='small'
|
||||
onClick={() => setOpen(false)}
|
||||
aria-label='fermer'
|
||||
sx={{
|
||||
pointerEvents: 'auto',
|
||||
@@ -143,6 +146,7 @@ export default function KaraokeModal({url, desktopUrl, titre, artistes}) {
|
||||
border: '1px solid rgba(255,255,255,0.12)',
|
||||
'&:hover': {bgcolor: 'rgba(255,255,255,0.25)'},
|
||||
}}
|
||||
onClick={() => setOpen(false)}
|
||||
>
|
||||
<CloseIcon fontSize='small' />
|
||||
</IconButton>
|
||||
@@ -166,7 +170,8 @@ export default function KaraokeModal({url, desktopUrl, titre, artistes}) {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
gap: 1.5,
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<MicIcon sx={{fontSize: 44, color: 'rgba(255,255,255,0.55)', animation: `${pulse} 1.6s ease-in-out infinite`}} />
|
||||
<Typography
|
||||
variant='caption'
|
||||
@@ -187,27 +192,28 @@ export default function KaraokeModal({url, desktopUrl, titre, artistes}) {
|
||||
transform: 'translateX(-50%)',
|
||||
height: '100%',
|
||||
aspectRatio: '16 / 9',
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<iframe
|
||||
src={toEmbedUrl(activeUrl)}
|
||||
onLoad={() => setLoaded(true)}
|
||||
style={{width: '100%', height: '100%', border: 'none', display: 'block', opacity: loaded ? 1 : 0, transition: 'opacity 0.4s ease'}}
|
||||
allowFullScreen
|
||||
src={toEmbedUrl(activeUrl)}
|
||||
style={{width: '100%', height: '100%', border: 'none', display: 'block', opacity: loaded ? 1 : 0, transition: 'opacity 0.4s ease'}}
|
||||
allow='autoplay; fullscreen'
|
||||
sandbox='allow-same-origin allow-scripts allow-popups allow-forms'
|
||||
title='Karaoké'
|
||||
onLoad={() => setLoaded(true)}
|
||||
/>
|
||||
</Box>
|
||||
) : (
|
||||
/* Vidéo 16:9 desktop : player remplit exactement le dialog paysage */
|
||||
<iframe
|
||||
src={toEmbedUrl(activeUrl)}
|
||||
onLoad={() => setLoaded(true)}
|
||||
style={{width: '100%', height: '100%', border: 'none', display: 'block', opacity: loaded ? 1 : 0, transition: 'opacity 0.4s ease'}}
|
||||
allowFullScreen
|
||||
src={toEmbedUrl(activeUrl)}
|
||||
style={{width: '100%', height: '100%', border: 'none', display: 'block', opacity: loaded ? 1 : 0, transition: 'opacity 0.4s ease'}}
|
||||
allow='autoplay; fullscreen'
|
||||
sandbox='allow-same-origin allow-scripts allow-popups allow-forms'
|
||||
title='Karaoké'
|
||||
onLoad={() => setLoaded(true)}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -51,9 +51,9 @@ export default function TeksKat({parole}) {
|
||||
<Box sx={{position: 'relative', height: 240}}>
|
||||
{couverture?.url ? (
|
||||
<Image
|
||||
fill
|
||||
src={`${IMAGE_URL}${formatKuveti(couverture, 'thumbnail')?.url}`}
|
||||
alt={titre}
|
||||
fill
|
||||
placeholder='blur'
|
||||
blurDataURL={BLUR_DATA_URL}
|
||||
sizes='(max-width: 600px) 100vw, (max-width: 900px) 50vw, 33vw'
|
||||
|
||||
@@ -183,7 +183,7 @@ export default function Teks({parole}) {
|
||||
<i>parole soumise par {parole.user.username}</i>
|
||||
</Typography>
|
||||
)}
|
||||
{parole?.userAdmin&& !parole.user && (
|
||||
{parole?.userAdmin && !parole.user && (
|
||||
<Typography style={{marginBottom: '1.5em'}} display='block' variant='caption'>
|
||||
<i>parole soumise par {parole.userAdmin.firstname}</i>
|
||||
</Typography>
|
||||
@@ -220,8 +220,8 @@ export default function Teks({parole}) {
|
||||
Écouter sur
|
||||
</Typography>
|
||||
<Box sx={{display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: 1}}>
|
||||
{parole.streamAudio.map((lyen, i) => (
|
||||
<StreamButton key={i} lyen={lyen} />
|
||||
{parole.streamAudio.map(lyen => (
|
||||
<StreamButton key={lyen.url} lyen={lyen} />
|
||||
))}
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -229,11 +229,10 @@ export default function Teks({parole}) {
|
||||
</Box>
|
||||
<Box sx={{maxWidth: 700, margin: '0 auto'}} className={classes.gridText}>
|
||||
<Tabs
|
||||
value={tab}
|
||||
onChange={(event, value) => setTab(value)}
|
||||
variant='scrollable'
|
||||
scrollButtons
|
||||
allowScrollButtonsMobile
|
||||
value={tab}
|
||||
variant='scrollable'
|
||||
centered={langArray.length === 0}
|
||||
slots={{
|
||||
startScrollButtonIcon: ArrowBackIosNewIcon,
|
||||
@@ -255,6 +254,7 @@ export default function Teks({parole}) {
|
||||
}
|
||||
}
|
||||
}}
|
||||
onChange={(event, value) => setTab(value)}
|
||||
>
|
||||
<Tab label='Transcription' />
|
||||
{langArray.map(({title}) => (
|
||||
|
||||
Reference in New Issue
Block a user