2020-09-28 14:29:43 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import IconButton from 'mastodon/components/icon_button';
|
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
import Avatar from 'mastodon/components/avatar';
|
|
|
|
import DisplayName from 'mastodon/components/display_name';
|
2020-11-11 06:36:29 +02:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
|
|
|
});
|
2020-09-28 14:29:43 +03:00
|
|
|
|
|
|
|
const mapStateToProps = (state, { accountId }) => ({
|
|
|
|
account: state.getIn(['accounts', accountId]),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default @connect(mapStateToProps)
|
2020-11-11 06:36:29 +02:00
|
|
|
@injectIntl
|
2020-09-28 14:29:43 +03:00
|
|
|
class Header extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
accountId: PropTypes.string.isRequired,
|
|
|
|
statusId: PropTypes.string.isRequired,
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
|
|
|
onClose: PropTypes.func.isRequired,
|
2020-11-11 06:36:29 +02:00
|
|
|
intl: PropTypes.object.isRequired,
|
2020-09-28 14:29:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
render () {
|
2020-11-11 06:36:29 +02:00
|
|
|
const { account, statusId, onClose, intl } = this.props;
|
2020-09-28 14:29:43 +03:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='picture-in-picture__header'>
|
2021-09-26 06:46:13 +03:00
|
|
|
<Link to={`/@${account.get('acct')}/${statusId}`} className='picture-in-picture__header__account'>
|
2020-09-28 14:29:43 +03:00
|
|
|
<Avatar account={account} size={36} />
|
|
|
|
<DisplayName account={account} />
|
|
|
|
</Link>
|
|
|
|
|
2020-11-11 06:36:29 +02:00
|
|
|
<IconButton icon='times' onClick={onClose} title={intl.formatMessage(messages.close)} />
|
2020-09-28 14:29:43 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|