import { injectIntl } from 'react-intl' import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' import StatusCard from './status_card' import { MediaGallery, Video } from '../features/ui/util/async_components' import Poll from './poll' // We use the component (and not the container) since we do not want // to use the progress bar to show download progress import Bundle from '../features/ui/util/bundle' export default class StatusMedia extends ImmutablePureComponent { static propTypes = { status: ImmutablePropTypes.map, isChild: PropTypes.bool, isComment: PropTypes.bool, onOpenMedia: PropTypes.func, onOpenVideo: PropTypes.func, width: PropTypes.number, onToggleVisibility: PropTypes.func, visible: PropTypes.bool, defaultWidth: PropTypes.number, cacheWidth: PropTypes.number, isComposeModalOpen: PropTypes.bool, } // Avoid checking props that are functions (and whose equality will always // evaluate to false. See react-immutable-pure-component for usage. updateOnProps = [ 'status', 'isChild', 'isComment', 'cacheWidth', 'defaultWidth', 'visible', 'width', 'isComposeModalOpen', ] renderLoadingMedia() { return
} render() { const { status, isChild, isComment, onOpenMedia, onOpenVideo, width, onToggleVisibility, visible, defaultWidth, cacheWidth, isComposeModalOpen, } = this.props if (!status) return null let media = null if (status.get('poll')) { media =