Continuing updating the reformatting of propTypes and set redux, intl functions to end of component

Continuing updating the reformatting of propTypes and set redux, intl functions to end of component
This commit is contained in:
mgabdev
2020-08-18 12:07:47 -05:00
parent 1c2cb6a63a
commit e5f4e12b7b
37 changed files with 834 additions and 931 deletions

View File

@@ -15,39 +15,8 @@ import Button from '../button'
import Text from '../text'
import SettingSwitch from '../setting_switch'
const messages = defineMessages({
message: { id: 'display_options.message', defaultMessage: 'Display settings affect your Gab account on this browser. These settings are only visible to you.' },
title: { id: 'display_options', defaultMessage: 'Customize your view' },
})
const mapStateToProps = (state) => ({
displayOptionsSettings: state.getIn(['settings', 'displayOptions']),
fontSize: state.getIn(['settings', 'displayOptions', 'fontSize'], DEFAULT_FONT_SIZE),
theme: state.getIn(['settings', 'displayOptions', 'theme'], DEFAULT_THEME),
})
const mapDispatchToProps = (dispatch) => ({
onChange(key, value) {
dispatch(changeSetting(['displayOptions', key], value))
dispatch(saveSettings())
},
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class DisplayOptionsModal extends ImmutablePureComponent {
static propTypes = {
fontSize: PropTypes.string,
intl: PropTypes.object.isRequired,
onClose: PropTypes.func.isRequired,
displayOptionsSettings: ImmutablePropTypes.map,
theme: PropTypes.string,
onChange: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
}
handleOnFontSizeChange = (e) => {
const fontSizeNames = Object.keys(FONT_SIZES)
const index = fontSizeNames[e.target.value]
@@ -244,4 +213,34 @@ class ThemeBlock extends React.PureComponent {
)
}
}
}
const messages = defineMessages({
message: { id: 'display_options.message', defaultMessage: 'Display settings affect your Gab account on this browser. These settings are only visible to you.' },
title: { id: 'display_options', defaultMessage: 'Customize your view' },
})
const mapStateToProps = (state) => ({
displayOptionsSettings: state.getIn(['settings', 'displayOptions']),
fontSize: state.getIn(['settings', 'displayOptions', 'fontSize'], DEFAULT_FONT_SIZE),
theme: state.getIn(['settings', 'displayOptions', 'theme'], DEFAULT_THEME),
})
const mapDispatchToProps = (dispatch) => ({
onChange(key, value) {
dispatch(changeSetting(['displayOptions', key], value))
dispatch(saveSettings())
},
})
DisplayOptionsModal.propTypes = {
fontSize: PropTypes.string,
intl: PropTypes.object.isRequired,
onClose: PropTypes.func.isRequired,
displayOptionsSettings: ImmutablePropTypes.map,
theme: PropTypes.string,
onChange: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(DisplayOptionsModal))