import React, { Component, PropTypes } from "react"; import CSSModules from "react-css-modules"; import { defineMessages, injectIntl, intlShape, FormattedMessage } from "react-intl"; import FontAwesome from "react-fontawesome"; import Immutable from "immutable"; import { messagesMap } from "../../utils"; import css from "../../styles/elements/WebPlayer.scss"; import commonMessages from "../../locales/messagesDescriptors/common"; import messages from "../../locales/messagesDescriptors/elements/WebPlayer"; const webplayerMessages = defineMessages(messagesMap(Array.concat([], commonMessages, messages))); class WebPlayerCSSIntl extends Component { constructor (props) { super(props); this.artOpacityHandler = this.artOpacityHandler.bind(this); } artOpacityHandler (ev) { if (ev.type == "mouseover") { this.refs.art.style.opacity = "1"; this.refs.artText.style.display = "none"; } else { this.refs.art.style.opacity = "0.75"; this.refs.artText.style.display = "block"; } } render () { const { formatMessage } = this.props.intl; const song = this.props.currentTrack; if (!song) { return (
); } const playPause = this.props.isPlaying ? "pause" : "play"; const volumeMute = this.props.isMute ? "volume-off" : "volume-up"; const randomBtnStyles = ["randomBtn"]; const repeatBtnStyles = ["repeatBtn"]; if (this.props.isRandom) { randomBtnStyles.push("active"); } if (this.props.isRepeat) { repeatBtnStyles.push("active"); } return (
{formatMessage(webplayerMessages["app.common.art"])}

{song.get("title")}

{ this.props.currentArtist.get("name") }

); } } WebPlayerCSSIntl.propTypes = { isPlaying: PropTypes.bool.isRequired, isRandom: PropTypes.bool.isRequired, isRepeat: PropTypes.bool.isRequired, isMute: PropTypes.bool.isRequired, currentTrack: PropTypes.instanceOf(Immutable.Map), currentArtist: PropTypes.instanceOf(Immutable.Map), onPlayPause: PropTypes.func.isRequired, onPrev: PropTypes.func.isRequired, onSkip: PropTypes.func.isRequired, onRandom: PropTypes.func.isRequired, onRepeat: PropTypes.func.isRequired, onMute: PropTypes.func.isRequired, intl: intlShape.isRequired }; export default injectIntl(CSSModules(WebPlayerCSSIntl, css, { allowMultiple: true }));