2020-09-28 21:29:43 +10:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-24 01:15:17 +10:00
|
|
|
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
|
2020-09-28 21:29:43 +10:00
|
|
|
import { Link } from 'react-router-dom';
|
2023-05-24 01:15:17 +10:00
|
|
|
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
2023-10-25 04:45:08 +11:00
|
|
|
import { ReactComponent as CloseIcon } from '@material-symbols/svg-600/outlined/close.svg';
|
|
|
|
|
2023-05-09 11:11:56 +10:00
|
|
|
import { Avatar } from 'mastodon/components/avatar';
|
2023-05-10 07:08:54 +10:00
|
|
|
import { DisplayName } from 'mastodon/components/display_name';
|
2023-05-24 01:15:17 +10:00
|
|
|
import { IconButton } from 'mastodon/components/icon_button';
|
2020-11-11 15:36:29 +11:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
|
|
|
});
|
2020-09-28 21:29:43 +10:00
|
|
|
|
|
|
|
const mapStateToProps = (state, { accountId }) => ({
|
|
|
|
account: state.getIn(['accounts', accountId]),
|
|
|
|
});
|
|
|
|
|
|
|
|
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 15:36:29 +11:00
|
|
|
intl: PropTypes.object.isRequired,
|
2020-09-28 21:29:43 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
render () {
|
2020-11-11 15:36:29 +11:00
|
|
|
const { account, statusId, onClose, intl } = this.props;
|
2020-09-28 21:29:43 +10:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='picture-in-picture__header'>
|
2021-09-26 13:46:13 +10:00
|
|
|
<Link to={`/@${account.get('acct')}/${statusId}`} className='picture-in-picture__header__account'>
|
2020-09-28 21:29:43 +10:00
|
|
|
<Avatar account={account} size={36} />
|
|
|
|
<DisplayName account={account} />
|
|
|
|
</Link>
|
|
|
|
|
2023-10-25 04:45:08 +11:00
|
|
|
<IconButton icon='times' iconComponent={CloseIcon} onClick={onClose} title={intl.formatMessage(messages.close)} />
|
2020-09-28 21:29:43 +10:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-03-24 13:17:53 +11:00
|
|
|
|
|
|
|
export default connect(mapStateToProps)(injectIntl(Header));
|