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); // Hardcoded height beased on line-height of 32 + bottom margin of 10. // Less side-effecty than using react-measure. const titleRowHeight = 42; function getContentHeight(rowHeight, isSmallScreen) { const padding = isSmallScreen ? columnPaddingSmallScreen : columnPadding; return rowHeight - padding; } 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 { id, artistName, overview, monitored, status, titleSlug, nextAiring, statistics, images, posterWidth, posterHeight, qualityProfile, overviewOptions, showSearchAction, showRelativeDates, shortDateFormat, longDateFormat, timeFormat, rowHeight, isSmallScreen, isRefreshingArtist, isSearchingArtist, onRefreshArtistPress, onSearchPress, ...otherProps } = this.props; const { albumCount, sizeOnDisk, trackCount, trackFileCount, totalTrackCount } = statistics; const { isEditArtistModalOpen, isDeleteArtistModalOpen } = this.state; const link = `/author/${titleSlug}`; const elementStyle = { width: `${posterWidth}px`, height: `${posterHeight}px` }; const contentHeight = getContentHeight(rowHeight, isSmallScreen); const overviewHeight = contentHeight - titleRowHeight; return (