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,
|
|
|
|
|
Soundcloud
|
|
|
|
|
} from '@icons-pack/react-simple-icons'
|
|
|
|
|
import PlayArrowIcon from '@material-ui/icons/PlayArrow'
|
|
|
|
|
import MusicNoteIcon from '@material-ui/icons/MusicNote'
|
|
|
|
|
import AlbumIcon from '@material-ui/icons/Album'
|
|
|
|
|
import {makeStyles} from '@material-ui/core/styles'
|
|
|
|
|
import {SpeedDial, SpeedDialIcon, SpeedDialAction} from '@material-ui/lab'
|
|
|
|
|
|
|
|
|
|
const useStyles = makeStyles(() => ({
|
|
|
|
|
root: {
|
|
|
|
|
height: 0,
|
|
|
|
|
transform: 'translateZ(0px)'
|
|
|
|
|
}
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
const kouteyAchteyIcons = {
|
|
|
|
|
Qobuz: <AlbumIcon />,
|
|
|
|
|
Deezer: <Deezer />,
|
|
|
|
|
Spotify: <Spotify />,
|
|
|
|
|
Tidal: <Tidal />,
|
|
|
|
|
Amazon: <Amazon />,
|
|
|
|
|
Applemusic: <Applemusic />,
|
|
|
|
|
Youtubemusic: <Youtubemusic />
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const vweyIcons = {
|
|
|
|
|
Youtube: <Youtube />,
|
|
|
|
|
Dailymotion: <Dailymotion />,
|
|
|
|
|
Soundcloud: <Soundcloud />
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-18 22:05:43 +01:00
|
|
|
export default function VweKouteAchte({anTeks, niVideyo, niOdyo}) {
|
2020-12-15 08:50:14 +01:00
|
|
|
const classes = useStyles()
|
2020-12-18 22:05:43 +01:00
|
|
|
const [ouve, meteOuve] = useState(false)
|
|
|
|
|
const {kouteyAchtey, lyen} = anTeks
|
2020-12-15 08:50:14 +01:00
|
|
|
|
2020-12-18 22:05:43 +01:00
|
|
|
const kouteyAchteyActions = kouteyAchtey.map(({boutik, url}) => {
|
2020-12-15 08:50:14 +01:00
|
|
|
return {
|
2020-12-18 22:05:43 +01:00
|
|
|
icon: kouteyAchteyIcons[boutik],
|
|
|
|
|
name: boutik,
|
|
|
|
|
link: url
|
2020-12-15 08:50:14 +01:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2020-12-18 22:05:43 +01:00
|
|
|
const vweyActions = lyen.map(({url, sit}) => {
|
2020-12-15 08:50:14 +01:00
|
|
|
return {
|
2020-12-18 22:05:43 +01:00
|
|
|
icon: vweyIcons[sit],
|
|
|
|
|
name: sit,
|
|
|
|
|
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 (
|
|
|
|
|
<div className={classes.root}>
|
|
|
|
|
<SpeedDial
|
|
|
|
|
color='secondary'
|
|
|
|
|
FabProps={{size: 'small', margin: 'auto', color: 'default'}}
|
|
|
|
|
ariaLabel='SpeedDial openIcon example'
|
|
|
|
|
className={classes.speedDial}
|
|
|
|
|
direction='down'
|
2020-12-18 22:05:43 +01:00
|
|
|
icon={<SpeedDialIcon icon={niOdyo ? <MusicNoteIcon /> : <PlayArrowIcon />} />}
|
|
|
|
|
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>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VweKouteAchte.propTypes = {
|
2020-12-18 22:05:43 +01:00
|
|
|
anTeks: PropTypes.object.isRequired,
|
|
|
|
|
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
|
|
|
}
|