import PropTypes from 'prop-types'; import React, { Component } from 'react'; import TextTruncate from 'react-text-truncate'; import { icons } from 'Helpers/Props'; import dimensions from 'Styles/Variables/dimensions'; import fonts from 'Styles/Variables/fonts'; import IconButton from 'Components/Link/IconButton'; import Link from 'Components/Link/Link'; import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; import ArtistPoster from 'Artist/ArtistPoster'; import EditArtistModalConnector from 'Artist/Edit/EditArtistModalConnector'; import DeleteArtistModal from 'Artist/Delete/DeleteArtistModal'; import ArtistIndexProgressBar from 'Artist/Index/ProgressBar/ArtistIndexProgressBar'; import ArtistIndexOverviewInfo from './ArtistIndexOverviewInfo'; import styles from './ArtistIndexOverview.css'; const columnPadding = parseInt(dimensions.artistIndexColumnPadding); const columnPaddingSmallScreen = parseInt(dimensions.artistIndexColumnPaddingSmallScreen); const defaultFontSize = parseInt(fonts.defaultFontSize); const lineHeight = parseFloat(fonts.lineHeight); function calculateHeight(rowHeight, isSmallScreen) { let height = rowHeight - 45; if (isSmallScreen) { height -= columnPaddingSmallScreen; } else { height -= columnPadding; } return height; } class ArtistIndexOverview extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { isEditArtistModalOpen: false, isDeleteArtistModalOpen: false }; } // // Listeners onEditArtistPress = () => { this.setState({ isEditArtistModalOpen: true }); } onEditArtistModalClose = () => { this.setState({ isEditArtistModalOpen: false }); } onDeleteArtistPress = () => { this.setState({ isEditArtistModalOpen: false, isDeleteArtistModalOpen: true }); } onDeleteArtistModalClose = () => { this.setState({ isDeleteArtistModalOpen: false }); } // // Render render() { const { style, id, artistName, overview, monitored, status, nameSlug, nextAiring, trackCount, trackFileCount, images, posterWidth, posterHeight, qualityProfile, overviewOptions, showRelativeDates, shortDateFormat, timeFormat, rowHeight, isSmallScreen, isRefreshingArtist, onRefreshArtistPress, ...otherProps } = this.props; const { isEditArtistModalOpen, isDeleteArtistModalOpen } = this.state; const link = `/artist/${nameSlug}`; const elementStyle = { width: `${posterWidth}px`, height: `${posterHeight}px` }; const height = calculateHeight(rowHeight, isSmallScreen); return (
{ status === 'ended' &&
}
{artistName}
); } } ArtistIndexOverview.propTypes = { style: PropTypes.object.isRequired, id: PropTypes.number.isRequired, artistName: PropTypes.string.isRequired, overview: 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, rowHeight: PropTypes.number.isRequired, qualityProfile: PropTypes.object.isRequired, overviewOptions: PropTypes.object.isRequired, showRelativeDates: PropTypes.bool.isRequired, shortDateFormat: PropTypes.string.isRequired, timeFormat: PropTypes.string.isRequired, isSmallScreen: PropTypes.bool.isRequired, isRefreshingArtist: PropTypes.bool.isRequired, onRefreshArtistPress: PropTypes.func.isRequired }; ArtistIndexOverview.defaultProps = { trackCount: 0, trackFileCount: 0 }; export default ArtistIndexOverview;