'use client' import {useState, forwardRef} from 'react' import PropTypes from 'prop-types' import Fab from '@mui/material/Fab' import Dialog from '@mui/material/Dialog' import Slide from '@mui/material/Slide' import Box from '@mui/material/Box' import IconButton from '@mui/material/IconButton' import Typography from '@mui/material/Typography' import Tooltip from '@mui/material/Tooltip' import useMediaQuery from '@mui/material/useMediaQuery' import {useTheme} from '@mui/material/styles' import MicIcon from '@mui/icons-material/Mic' import CloseIcon from '@mui/icons-material/Close' const SlideUp = forwardRef(function SlideUp(props, ref) { return }) function toEmbedUrl(url) { try { const u = new URL(url) const match = u.pathname.match(/\/(?:videos\/watch|w)\/([^/?#]+)/) if (match) { return `${u.origin}/videos/embed/${match[1]}?title=0&warningTitle=0&peertubeLink=0&controlBar=1` } return url } catch { return url } } export default function KaraokeModal({url, titre, artistes}) { const [open, setOpen] = useState(false) const theme = useTheme() const isMobile = useMediaQuery(theme.breakpoints.down('sm')) return ( <> setOpen(true)} sx={{ position: 'fixed', bottom: {xs: 24, sm: 32}, right: {xs: 24, sm: 32}, zIndex: 10, }} > setOpen(false)} TransitionComponent={SlideUp} maxWidth={false} slotProps={{ backdrop: {sx: {backdropFilter: 'blur(6px)', bgcolor: 'rgba(0,0,0,0.85)'}} }} PaperProps={{ sx: { bgcolor: '#000', overflow: 'hidden', ...(isMobile ? { width: '100vw', height: '100dvh', maxWidth: 'none', maxHeight: 'none', m: 0, borderRadius: 0, } : { width: 'calc(88vh * 9 / 16)', height: '88vh', maxWidth: 'none', maxHeight: 'none', borderRadius: 3, }) } }} > {/* Header superposé */} {titre && ( {titre} )} {artistes?.length > 0 && ( {artistes.map(a => a.alias).join(', ')} )} setOpen(false)} aria-label='fermer' sx={{ color: '#fff', bgcolor: 'rgba(255,255,255,0.15)', backdropFilter: 'blur(4px)', mt: 0.5, '&:hover': {bgcolor: 'rgba(255,255,255,0.25)'}, }} > {open && (