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

• Removing:
- the reformatting of propTypes and set redux, intl functions to end of component
This commit is contained in:
mgabdev
2020-08-17 19:57:35 -05:00
parent 46a0cbca7d
commit ddca693cfc
101 changed files with 2053 additions and 2140 deletions

View File

@@ -8,46 +8,19 @@ import { autoPlayGif } from '../initial_state'
import { openPopover, closePopover } from '../actions/popover'
import Image from './image'
const mapDispatchToProps = (dispatch) => ({
openUserInfoPopover(props) {
dispatch(openPopover('USER_INFO', props))
},
closeUserInfoPopover() {
dispatch(closePopover('USER_INFO'))
}
})
/**
* Renders an avatar component
* @param {map} [props.account] - the account for image
* @param {number} [props.size=40] - the size of the avatar
*/
export default
@connect(null, mapDispatchToProps)
class Avatar extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map,
noHover: PropTypes.bool,
openUserInfoPopover: PropTypes.func.isRequired,
size: PropTypes.number,
}
static defaultProps = {
size: 40,
}
state = {
hovering: false,
sameImg: !this.props.account ? false : this.props.account.get('avatar') === this.props.account.get('avatar_static'),
}
updateOnProps = [
'account',
'noHover',
'size',
]
mouseOverTimeout = null
componentDidUpdate (prevProps) {
@@ -143,3 +116,25 @@ class Avatar extends ImmutablePureComponent {
}
}
const mapDispatchToProps = (dispatch) => ({
openUserInfoPopover(props) {
dispatch(openPopover('USER_INFO', props))
},
closeUserInfoPopover() {
dispatch(closePopover('USER_INFO'))
}
})
Avatar.propTypes = {
account: ImmutablePropTypes.map,
noHover: PropTypes.bool,
openUserInfoPopover: PropTypes.func.isRequired,
size: PropTypes.number,
}
Avatar.defaultProps = {
size: 40,
}
export default connect(null, mapDispatchToProps)(Avatar)