import PropTypes from 'prop-types'; import React, { Component } from 'react'; import getRelativeDate from 'Utilities/Date/getRelativeDate'; import { icons } from 'Helpers/Props'; import IconButton from 'Components/Link/IconButton'; import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; import Label from 'Components/Label'; import Link from 'Components/Link/Link'; import ArtistPoster from 'Artist/ArtistPoster'; import EditArtistModalConnector from 'Artist/Edit/EditArtistModalConnector'; import DeleteArtistModal from 'Artist/Delete/DeleteArtistModal'; import ArtistIndexPosterProgressBar from './ArtistIndexPosterProgressBar'; import ArtistIndexPosterInfo from './ArtistIndexPosterInfo'; import styles from './ArtistIndexPoster.css'; class ArtistIndexPoster extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { isEditArtistModalOpen: false, isDeleteArtistModalOpen: false }; } // // Listeners onEditSeriesPress = () => { this.setState({ isEditArtistModalOpen: true }); } onEditSeriesModalClose = () => { this.setState({ isEditArtistModalOpen: false }); } onDeleteSeriesPress = () => { this.setState({ isEditArtistModalOpen: false, isDeleteArtistModalOpen: true }); } onDeleteArtistModalClose = () => { this.setState({ isDeleteArtistModalOpen: false }); } // // Render render() { const { style, id, artistName, monitored, status, nameSlug, nextAiring, trackCount, trackFileCount, images, posterWidth, posterHeight, detailedProgressBar, showTitle, showQualityProfile, qualityProfile, showRelativeDates, shortDateFormat, timeFormat, isRefreshingSeries, onRefreshArtistPress, ...otherProps } = this.props; const { isEditArtistModalOpen, isDeleteArtistModalOpen } = this.state; const link = `/artist/${nameSlug}`; const elementStyle = { width: `${posterWidth}px`, height: `${posterHeight}px` }; return (
{ status === 'ended' &&
}
{ showTitle &&
{artistName}
} { showQualityProfile &&
{qualityProfile.name}
}
{ getRelativeDate( nextAiring, shortDateFormat, showRelativeDates, { timeFormat, timeForToday: true } ) }
); } } ArtistIndexPoster.propTypes = { style: PropTypes.object.isRequired, id: PropTypes.number.isRequired, artistName: PropTypes.string.isRequired, monitored: PropTypes.bool.isRequired, status: PropTypes.string.isRequired, nameSlug: PropTypes.string.isRequired, nextAiring: PropTypes.string, trackCount: PropTypes.number, trackFileCount: PropTypes.number, images: PropTypes.arrayOf(PropTypes.object).isRequired, posterWidth: PropTypes.number.isRequired, posterHeight: PropTypes.number.isRequired, detailedProgressBar: PropTypes.bool.isRequired, showTitle: PropTypes.bool.isRequired, showQualityProfile: PropTypes.bool.isRequired, qualityProfile: PropTypes.object.isRequired, showRelativeDates: PropTypes.bool.isRequired, shortDateFormat: PropTypes.string.isRequired, timeFormat: PropTypes.string.isRequired, isRefreshingSeries: PropTypes.bool.isRequired, onRefreshArtistPress: PropTypes.func.isRequired }; ArtistIndexPoster.defaultProps = { trackCount: 0, trackFileCount: 0 }; export default ArtistIndexPoster;