import PropTypes from 'prop-types'; import React, { Component } from 'react'; import HeartRating from 'Components/HeartRating'; import Icon from 'Components/Icon'; import Label from 'Components/Label'; import Link from 'Components/Link/Link'; import Tooltip from 'Components/Tooltip/Tooltip'; import { icons, kinds, sizes, tooltipPositions } from 'Helpers/Props'; import MoviePoster from 'Movie/MoviePoster'; import translate from 'Utilities/String/translate'; import AddNewMovieModal from './AddNewMovieModal'; import styles from './AddNewMovieSearchResult.css'; class AddNewMovieSearchResult extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { isNewAddMovieModalOpen: false }; } componentDidUpdate(prevProps) { if (!prevProps.isExistingMovie && this.props.isExistingMovie) { this.onAddMovieModalClose(); } } // // Listeners onPress = () => { this.setState({ isNewAddMovieModalOpen: true }); } onAddMovieModalClose = () => { this.setState({ isNewAddMovieModalOpen: false }); } onExternalLinkPress = (event) => { event.stopPropagation(); } // // Render render() { const { tmdbId, title, titleSlug, year, studio, status, overview, ratings, folder, images, isExistingMovie, isExclusionMovie, isSmallScreen } = this.props; const { isNewAddMovieModalOpen } = this.state; const linkProps = isExistingMovie ? { to: `/movie/${titleSlug}` } : { onPress: this.onPress }; return (