2020-12-18 22:05:43 +01:00
|
|
|
import {useState} from 'react'
|
2020-12-15 08:50:14 +01:00
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
|
import {
|
|
|
|
|
Youtube,
|
|
|
|
|
Dailymotion,
|
|
|
|
|
Youtubemusic,
|
|
|
|
|
Applemusic,
|
|
|
|
|
Tidal,
|
|
|
|
|
Spotify,
|
|
|
|
|
Deezer,
|
|
|
|
|
Amazon,
|
2021-02-22 22:31:37 +01:00
|
|
|
Soundcloud,
|
2021-05-04 20:24:39 +02:00
|
|
|
Lbry,
|
|
|
|
|
Peertube
|
2020-12-15 08:50:14 +01:00
|
|
|
} from '@icons-pack/react-simple-icons'
|
2022-01-19 07:06:26 +04:00
|
|
|
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'
|
2020-12-15 08:50:14 +01:00
|
|
|
|
2022-01-19 06:35:04 +04:00
|
|
|
const PREFIX = 'vwe-koute-achte'
|
|
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
|
root: `${PREFIX}-root`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Root = styled('div')(() => ({
|
|
|
|
|
[`&.${classes.root}`]: {
|
2020-12-15 08:50:14 +01:00
|
|
|
height: 0,
|
|
|
|
|
transform: 'translateZ(0px)'
|
|
|
|
|
}
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
const kouteyAchteyIcons = {
|
|
|
|
|
Qobuz: <AlbumIcon />,
|
|
|
|
|
Deezer: <Deezer />,
|
|
|
|
|
Spotify: <Spotify />,
|
|
|
|
|
Tidal: <Tidal />,
|
|
|
|
|
Amazon: <Amazon />,
|
|
|
|
|
Applemusic: <Applemusic />,
|
2021-06-17 23:10:08 +02:00
|
|
|
Youtubemusic: <Youtubemusic />,
|
|
|
|
|
Soundcloud: <Soundcloud />
|
2020-12-15 08:50:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const vweyIcons = {
|
|
|
|
|
Youtube: <Youtube />,
|
|
|
|
|
Dailymotion: <Dailymotion />,
|
2021-04-29 20:12:14 +02:00
|
|
|
Lbry: <Lbry />,
|
2021-05-04 20:24:39 +02:00
|
|
|
Rumble: <PlayCircleFilledIcon />,
|
2022-05-20 02:15:56 +04:00
|
|
|
Gadé: <Peertube />
|
2020-12-15 08:50:14 +01:00
|
|
|
}
|
|
|
|
|
|
2022-05-20 02:15:56 +04:00
|
|
|
export default function VweKouteAchte({parole, niVideyo, niOdyo}) {
|
2020-12-18 22:05:43 +01:00
|
|
|
const [ouve, meteOuve] = useState(false)
|
2022-05-20 02:15:56 +04:00
|
|
|
const {streamAudio, streamVideo} = parole
|
2020-12-15 08:50:14 +01:00
|
|
|
|
2022-05-20 02:15:56 +04:00
|
|
|
const kouteyAchteyActions = streamAudio.map(({plateforme, url}) => ({
|
|
|
|
|
icon: kouteyAchteyIcons[plateforme],
|
|
|
|
|
name: plateforme,
|
2022-01-18 09:08:26 +04:00
|
|
|
link: url
|
|
|
|
|
}))
|
2020-12-15 08:50:14 +01:00
|
|
|
|
2022-05-20 02:15:56 +04:00
|
|
|
const vweyActions = streamVideo.map(({plateforme, url}) => ({
|
|
|
|
|
icon: vweyIcons[plateforme],
|
|
|
|
|
name: plateforme,
|
2022-01-18 09:08:26 +04:00
|
|
|
link: url
|
|
|
|
|
}))
|
2020-12-15 08:50:14 +01:00
|
|
|
|
|
|
|
|
const handleOpen = () => {
|
2020-12-18 22:05:43 +01:00
|
|
|
meteOuve(true)
|
2020-12-15 08:50:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleClick = link => {
|
|
|
|
|
window.location = link
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleClose = () => {
|
2020-12-18 22:05:43 +01:00
|
|
|
meteOuve(false)
|
2020-12-15 08:50:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2022-01-19 06:35:04 +04:00
|
|
|
<Root className={classes.root}>
|
2020-12-15 08:50:14 +01:00
|
|
|
<SpeedDial
|
|
|
|
|
color='secondary'
|
|
|
|
|
FabProps={{size: 'small', margin: 'auto', color: 'default'}}
|
|
|
|
|
ariaLabel='SpeedDial openIcon example'
|
|
|
|
|
className={classes.speedDial}
|
|
|
|
|
direction='down'
|
2020-12-19 23:05:42 +01:00
|
|
|
icon={<SpeedDialIcon icon={niOdyo ? <MusicNoteIcon /> : <VideocamIcon />} />}
|
2020-12-18 22:05:43 +01:00
|
|
|
open={ouve}
|
2020-12-15 08:50:14 +01:00
|
|
|
onClose={handleClose}
|
|
|
|
|
onOpen={handleOpen}
|
|
|
|
|
>
|
2020-12-18 22:05:43 +01:00
|
|
|
{niOdyo && kouteyAchteyActions.map(action => (
|
2020-12-15 08:50:14 +01:00
|
|
|
<SpeedDialAction
|
|
|
|
|
key={action.name}
|
|
|
|
|
icon={action.icon}
|
|
|
|
|
tooltipTitle={action.name}
|
|
|
|
|
onClick={() => handleClick(action.link)}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
2020-12-18 22:05:43 +01:00
|
|
|
{niVideyo && vweyActions.map(action => (
|
2020-12-15 08:50:14 +01:00
|
|
|
<SpeedDialAction
|
|
|
|
|
key={action.name}
|
|
|
|
|
icon={action.icon}
|
|
|
|
|
tooltipTitle={action.name}
|
|
|
|
|
onClick={() => handleClick(action.link)}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</SpeedDial>
|
2022-01-19 06:35:04 +04:00
|
|
|
</Root>
|
2020-12-15 08:50:14 +01:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VweKouteAchte.propTypes = {
|
2022-05-20 02:15:56 +04:00
|
|
|
parole: PropTypes.object.isRequired,
|
2020-12-18 22:05:43 +01:00
|
|
|
niVideyo: PropTypes.bool,
|
|
|
|
|
niOdyo: PropTypes.bool
|
2020-12-15 08:50:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VweKouteAchte.defaultProps = {
|
2020-12-18 22:05:43 +01:00
|
|
|
niVideyo: false,
|
|
|
|
|
niOdyo: false
|
2020-12-15 08:50:14 +01:00
|
|
|
}
|