MarkdownButton: don't do the availability check in the component itself

purgecss
Alex Gleason 2022-03-04 13:01:22 -06:00
rodzic d98c54de4f
commit 664dfa2688
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 1 dodań i 12 usunięć

Wyświetl plik

@ -17,7 +17,6 @@ class MarkdownButton extends React.PureComponent {
active: PropTypes.bool,
onClick: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
unavailable: PropTypes.bool,
};
handleClick = () => {
@ -25,11 +24,7 @@ class MarkdownButton extends React.PureComponent {
}
render() {
const { intl, active, unavailable } = this.props;
if (unavailable) {
return null;
}
const { intl, active } = this.props;
return (
<div className='compose-form__markdown-button'>

Wyświetl plik

@ -1,17 +1,11 @@
import { connect } from 'react-redux';
import { getFeatures } from 'soapbox/utils/features';
import { changeComposeContentType } from '../../../actions/compose';
import MarkdownButton from '../components/markdown_button';
const mapStateToProps = (state, { intl }) => {
const instance = state.get('instance');
const features = getFeatures(instance);
return {
active: state.getIn(['compose', 'content_type']) === 'text/markdown',
unavailable: !features.richText,
};
};