// TODO: Styling // NPM import import React, { Component, PropTypes } from "react"; import Immutable from "immutable"; import { defineMessages, injectIntl, intlShape, FormattedMessage } from "react-intl"; // Local imports import { messagesMap } from "../utils"; // Other components import { SongsTable } from "./Songs"; // Translations import commonMessages from "../locales/messagesDescriptors/common"; import messages from "../locales/messagesDescriptors/Playlist"; // Define translations const playlistMessages = defineMessages(messagesMap(Array.concat([], commonMessages, messages))); /** * An entire album row containing art and tracks table. */ class PlaylistIntl extends Component { render() { let playlistText = null; if (this.props.songs.size > 0) { const currentSongSongsTableProps = { playAction: this.props.playAction, playNextAction: this.props.playNextAction, songs: this.props.songs.slice(this.props.currentIndex, this.props.currentIndex + 1), }; const fullPlaylistSongsTableProps = { playAction: this.props.playAction, playNextAction: this.props.playNextAction, songs: this.props.songs, }; playlistText = (

); } else { playlistText = (

); } return (

{ playlistText }
); } } PlaylistIntl.propTypes = { playAction: PropTypes.func.isRequired, playNextAction: PropTypes.func, flushAction: PropTypes.func.isRequired, songs: PropTypes.instanceOf(Immutable.List).isRequired, currentIndex: PropTypes.number.isRequired, intl: intlShape.isRequired, }; export default injectIntl(PlaylistIntl);