gab-social/app/javascript/gabsocial/components/status_quote.js

40 lines
990 B
JavaScript
Raw Normal View History

2019-08-01 00:46:23 +01:00
import ImmutablePropTypes from 'react-immutable-proptypes';
2020-03-06 15:38:22 +00:00
import StatusContent from './status_content';
import DisplayName from './display_name';
2019-08-01 00:46:23 +01:00
import { NavLink } from 'react-router-dom';
const mapStateToProps = (state, { id }) => ({
status: state.getIn(['statuses', id]),
account: state.getIn(['accounts', state.getIn(['statuses', id, 'account'])]),
2019-08-01 00:46:23 +01:00
});
@connect(mapStateToProps)
2020-01-29 21:54:39 +00:00
export default class StatusQuote extends PureComponent {
2019-08-01 00:46:23 +01:00
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
status: ImmutablePropTypes.map.isRequired,
};
render() {
const { status, account } = this.props;
const statusUrl = `/${account.get('acct')}/posts/${status.get('id')}`;
return (
<NavLink to={statusUrl} className="status__quote">
<DisplayName account={account} />
<StatusContent
status={status}
expanded={false}
onClick
collapsable
/>
</NavLink>
);
}
2019-08-01 00:46:23 +01:00
}