import {FormattedMessage, intlShape, defineMessages} from 'react-intl'; import PropTypes from 'prop-types'; import React from 'react'; import Box from '../box/box.jsx'; import PlayButton from '../../containers/play-button.jsx'; import styles from './library-item.css'; import classNames from 'classnames'; import bluetoothIconURL from './bluetooth.svg'; import internetConnectionIconURL from './internet-connection.svg'; import favoritedFilledUrl from './favorite/filled.svg'; import favoritedOutlineUrl from './favorite/outline.svg'; import deleteFilledUrl from './delete/filled.svg'; import downloadFilled from './download/filled.svg'; const getURLOrigin = (url) => { let urlObj; try { urlObj = new URL(url); } catch { // not a valid URL return String(url); } return urlObj.origin; }; const getMSFormatted = (ms) => { return (ms / 1000).toFixed(2); }; /* eslint-disable react/prefer-stateless-function */ class LibraryItemComponent extends React.PureComponent { render() { return this.props.featured ? (