import PropTypes from 'prop-types'; import React, { Component } from 'react'; import TextTruncate from 'react-text-truncate'; import { icons } from 'Helpers/Props'; import Icon from 'Components/Icon'; import IconButton from 'Components/Link/IconButton'; import dimensions from 'Styles/Variables/dimensions'; import fonts from 'Styles/Variables/fonts'; import CheckInput from 'Components/Form/CheckInput'; import MoviePoster from 'Movie/MoviePoster'; import Link from 'Components/Link/Link'; import AddNewDiscoverMovieModal from 'DiscoverMovie/AddNewDiscoverMovieModal'; import ExcludeMovieModal from 'DiscoverMovie/Exclusion/ExcludeMovieModal'; import styles from './AddListMovieOverview.css'; import Popover from 'Components/Tooltip/Popover'; import MovieDetailsLinks from 'Movie/Details/MovieDetailsLinks'; const columnPadding = parseInt(dimensions.movieIndexColumnPadding); const columnPaddingSmallScreen = parseInt(dimensions.movieIndexColumnPaddingSmallScreen); 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 AddListMovieOverview extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { isNewAddMovieModalOpen: false, isExcludeMovieModalOpen: false }; } // // Listeners onPress = () => { this.setState({ isNewAddMovieModalOpen: true }); } onAddMovieModalClose = () => { this.setState({ isNewAddMovieModalOpen: false }); } onExcludeMoviePress = () => { this.setState({ isExcludeMovieModalOpen: true }); } onExcludeMovieModalClose = () => { this.setState({ isExcludeMovieModalOpen: false }); } onChange = ({ value, shiftKey }) => { const { tmdbId, onSelectedChange } = this.props; onSelectedChange({ id: tmdbId, value, shiftKey }); } // // Render render() { const { tmdbId, imdbId, youTubeTrailerId, title, titleSlug, folder, year, overview, images, posterWidth, posterHeight, rowHeight, isSmallScreen, isExisting, isExcluded, isSelected } = this.props; const { isNewAddMovieModalOpen, isExcludeMovieModalOpen } = this.state; const elementStyle = { width: `${posterWidth}px`, height: `${posterHeight}px` }; const linkProps = isExisting ? { to: `/movie/${titleSlug}` } : { onPress: this.onPress }; const contentHeight = getContentHeight(rowHeight, isSmallScreen); const overviewHeight = contentHeight - titleRowHeight; return (