import {useState} from 'react' import PropTypes from 'prop-types' import { Youtube, Dailymotion, Youtubemusic, Applemusic, Tidal, Spotify, Deezer, Amazon, Soundcloud, Lbry, Peertube } from '@icons-pack/react-simple-icons' import VideocamIcon from '@mui/icons-material/Videocam' import MusicNoteIcon from '@mui/icons-material/MusicNote' import AlbumIcon from '@mui/icons-material/Album' import PlayCircleFilledIcon from '@mui/icons-material/PlayCircleFilled' import {styled} from '@mui/material/styles' import {SpeedDial, SpeedDialIcon, SpeedDialAction} from '@mui/material' const PREFIX = 'vwe-koute-achte' const classes = { root: `${PREFIX}-root` } const Root = styled('div')(() => ({ [`&.${classes.root}`]: { height: 0, transform: 'translateZ(0px)' } })) const kouteyAchteyIcons = { Qobuz: , Deezer: , Spotify: , Tidal: , Amazon: , Applemusic: , Youtubemusic: , Soundcloud: } const vweyIcons = { Youtube: , Dailymotion: , Lbry: , Rumble: , Gadé: } export default function VweKouteAchte({parole, niVideyo, niOdyo}) { const [ouve, meteOuve] = useState(false) const {streamAudio, streamVideo} = parole const kouteyAchteyActions = streamAudio.map(({plateforme, url}) => ({ icon: kouteyAchteyIcons[plateforme], name: plateforme, link: url })) const vweyActions = streamVideo.map(({plateforme, url}) => ({ icon: vweyIcons[plateforme], name: plateforme, link: url })) const handleOpen = () => { meteOuve(true) } const handleClick = link => { window.location = link } const handleClose = () => { meteOuve(false) } return ( : } />} open={ouve} onClose={handleClose} onOpen={handleOpen} > {niOdyo && kouteyAchteyActions.map(action => ( handleClick(action.link)} /> ))} {niVideyo && vweyActions.map(action => ( handleClick(action.link)} /> ))} ) } VweKouteAchte.propTypes = { parole: PropTypes.object.isRequired, niVideyo: PropTypes.bool, niOdyo: PropTypes.bool } VweKouteAchte.defaultProps = { niVideyo: false, niOdyo: false }