From b12952f85ebe3a40b5cf63b1e2a71b2d1d89e3c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Wed, 17 Jun 2026 23:47:14 +0400 Subject: [PATCH] feat: add karaoke modal --- components/teks/karaoke-modal.js | 149 +++++++++++++++++++++++++++++++ components/teks/teks-drawer.js | 4 + 2 files changed, 153 insertions(+) create mode 100644 components/teks/karaoke-modal.js diff --git a/components/teks/karaoke-modal.js b/components/teks/karaoke-modal.js new file mode 100644 index 0000000..7d1e811 --- /dev/null +++ b/components/teks/karaoke-modal.js @@ -0,0 +1,149 @@ +'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 && ( +