ComposeModal, ComposeForm: adapt depending on privacy scope
This commit is contained in:
parent
4fb447596e
commit
8dd49343ad
3 changed files with 31 additions and 6 deletions
|
@ -36,6 +36,7 @@ const messages = defineMessages({
|
||||||
spoiler_placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Write your warning here' },
|
spoiler_placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Write your warning here' },
|
||||||
publish: { id: 'compose_form.publish', defaultMessage: 'Publish' },
|
publish: { id: 'compose_form.publish', defaultMessage: 'Publish' },
|
||||||
publishLoud: { id: 'compose_form.publish_loud', defaultMessage: '{publish}!' },
|
publishLoud: { id: 'compose_form.publish_loud', defaultMessage: '{publish}!' },
|
||||||
|
message: { id: 'compose_form.message', defaultMessage: 'Message' },
|
||||||
schedule: { id: 'compose_form.schedule', defaultMessage: 'Schedule' },
|
schedule: { id: 'compose_form.schedule', defaultMessage: 'Schedule' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -257,8 +258,20 @@ export default class ComposeForm extends ImmutablePureComponent {
|
||||||
|
|
||||||
let publishText = '';
|
let publishText = '';
|
||||||
|
|
||||||
if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
|
if (this.props.privacy === 'direct') {
|
||||||
publishText = <span className='compose-form__publish-private'><Icon id='lock' /> {intl.formatMessage(messages.publish)}</span>;
|
publishText = (
|
||||||
|
<>
|
||||||
|
<Icon src={require('@tabler/icons/icons/mail.svg')} />
|
||||||
|
{intl.formatMessage(messages.message)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
} else if (this.props.privacy === 'private') {
|
||||||
|
publishText = (
|
||||||
|
<>
|
||||||
|
<Icon src={require('@tabler/icons/icons/lock.svg')} />
|
||||||
|
{intl.formatMessage(messages.publish)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
publishText = this.props.privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish);
|
publishText = this.props.privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ const mapStateToProps = state => {
|
||||||
return {
|
return {
|
||||||
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']),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ class ComposeModal extends ImmutablePureComponent {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
composeText: PropTypes.string,
|
composeText: PropTypes.string,
|
||||||
|
privacy: PropTypes.string,
|
||||||
dispatch: PropTypes.func.isRequired,
|
dispatch: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,13 +50,17 @@ class ComposeModal extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl } = this.props;
|
const { intl, privacy } = 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'>
|
||||||
<FormattedMessage id='navigation_bar.compose' defaultMessage='Compose new post' />
|
{privacy === 'direct' ? (
|
||||||
|
<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'
|
||||||
|
|
|
@ -14,7 +14,9 @@ button {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: inline-block;
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
@ -31,6 +33,10 @@ button {
|
||||||
width: auto;
|
width: auto;
|
||||||
transition: 0.2s;
|
transition: 0.2s;
|
||||||
|
|
||||||
|
.svg-icon {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
&:active,
|
&:active,
|
||||||
&:focus,
|
&:focus,
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -113,7 +119,7 @@ button {
|
||||||
}
|
}
|
||||||
|
|
||||||
&.button--block {
|
&.button--block {
|
||||||
display: block;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue