import React from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import { NavLink } from 'react-router-dom' import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' import { fetchStatus } from '../../actions/statuses' import { makeGetStatus } from '../../selectors' import { me } from '../../initial_state' import { CX, } from '../../constants' import PanelLayout from './panel_layout' import Avatar from '../avatar' import Button from '../button' import DisplayName from '../display_name' import ColumnIndicator from '../column_indicator' import StatusContent from '../status_content' import StatusMedia from '../status_media' class StatusPromotionPanel extends ImmutablePureComponent { componentDidMount() { if (!this.props.status) { this.props.onFetchStatus(this.props.statusId) } } render() { const { status } = this.props const containerClasses = CX({ d: 1, pb10: !!status ? (status.get('media_attachments').size === 0 || !!status.get('card')) : false, }) return ( { !status && } { !!status &&
{ }} onExpandedToggle={() => { }} />
{ }} onToggleVisibility={() => { }} onOpenVideo={() => { }} isStatusCard // width={this.props.cachedMediaWidth} // cacheWidth={this.props.cacheMediaWidth} // defaultWidth={this.props.cachedMediaWidth} // visible={this.state.showMedia} />
}
) } } const mapStateToProps = (state, { statusId }) => ({ status: makeGetStatus()(state, { id: statusId }), }) const mapDispatchToProps = (dispatch) => ({ onFetchStatus: (id) => dispatch(fetchStatus(id)), }) StatusPromotionPanel.propTypes = { status: ImmutablePropTypes.map.isRequired, statusId: PropTypes.string.isRequired, onFetchStatus: PropTypes.func.isRequired, } export default connect(mapStateToProps, mapDispatchToProps)(StatusPromotionPanel)