kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
ComposeModal: conditional title when replying
rodzic
a354fd325d
commit
47a3ecc30e
|
@ -20,6 +20,7 @@ const mapStateToProps = state => {
|
||||||
account: state.getIn(['accounts', me]),
|
account: state.getIn(['accounts', me]),
|
||||||
composeText: state.getIn(['compose', 'text']),
|
composeText: state.getIn(['compose', 'text']),
|
||||||
privacy: state.getIn(['compose', 'privacy']),
|
privacy: state.getIn(['compose', 'privacy']),
|
||||||
|
inReplyTo: state.getIn(['compose', 'in_reply_to']),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ class ComposeModal extends ImmutablePureComponent {
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
composeText: PropTypes.string,
|
composeText: PropTypes.string,
|
||||||
privacy: PropTypes.string,
|
privacy: PropTypes.string,
|
||||||
|
inReplyTo: PropTypes.string,
|
||||||
dispatch: PropTypes.func.isRequired,
|
dispatch: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,18 +51,26 @@ class ComposeModal extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
renderTitle = () => {
|
||||||
|
const { privacy, inReplyTo } = this.props;
|
||||||
|
|
||||||
|
if (privacy === 'direct') {
|
||||||
|
return <FormattedMessage id='navigation_bar.compose_direct' defaultMessage='Direct message' />;
|
||||||
|
} else if (inReplyTo) {
|
||||||
|
return <FormattedMessage id='navigation_bar.compose_reply' defaultMessage='Reply to post' />;
|
||||||
|
} else {
|
||||||
|
return <FormattedMessage id='navigation_bar.compose' defaultMessage='Compose new post' />;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl, privacy } = this.props;
|
const { intl } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='modal-root__modal compose-modal'>
|
<div className='modal-root__modal compose-modal'>
|
||||||
<div className='compose-modal__header'>
|
<div className='compose-modal__header'>
|
||||||
<h3 className='compose-modal__header__title'>
|
<h3 className='compose-modal__header__title'>
|
||||||
{privacy === 'direct' ? (
|
{this.renderTitle()}
|
||||||
<FormattedMessage id='navigation_bar.compose_direct' defaultMessage='Direct message' />
|
|
||||||
) : (
|
|
||||||
<FormattedMessage id='navigation_bar.compose' defaultMessage='Compose new post' />
|
|
||||||
)}
|
|
||||||
</h3>
|
</h3>
|
||||||
<IconButton
|
<IconButton
|
||||||
className='compose-modal__close'
|
className='compose-modal__close'
|
||||||
|
|
Ładowanie…
Reference in New Issue