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

• Finished:
- updating the reformatting of propTypes and set redux, intl functions to end of component

• Removed:
- Gif implementation
This commit is contained in:
mgabdev
2020-08-18 19:22:15 -05:00
parent e21a6ff897
commit 99982c0391
102 changed files with 2540 additions and 3285 deletions

View File

@@ -18,48 +18,8 @@ import BlockHeading from '../components/block_heading'
import ColumnIndicator from '../components/column_indicator'
import ScrollableList from '../components/scrollable_list'
const messages = defineMessages({
remove: { id: 'groups.removed_accounts', defaultMessage: 'Allow joining' },
})
const mapStateToProps = (state, { params }) => {
const groupId = isObject(params) ? params['id'] : -1
const group = groupId === -1 ? null : state.getIn(['groups', groupId])
return {
group,
groupId,
accountIds: state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'items']),
hasMore: !!state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'next']),
}
}
const mapDispatchToProps = (dispatch) => ({
onFetchRemovedAccounts(groupId) {
dispatch(fetchRemovedAccounts(groupId))
},
onExpandRemovedAccounts(groupId) {
dispatch(expandRemovedAccounts(groupId))
},
onRemoveRemovedAccount(groupId, accountId) {
dispatch(removeRemovedAccount(groupId, accountId))
},
})
export default
@injectIntl
@connect(mapStateToProps, mapDispatchToProps)
class GroupRemovedAccounts extends ImmutablePureComponent {
static propTypes = {
groupId: PropTypes.string.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
onFetchRemovedAccounts: PropTypes.func.isRequired,
onExpandRemovedAccounts: PropTypes.func.isRequired,
onRemoveRemovedAccount: PropTypes.func.isRequired,
}
componentWillMount() {
const { groupId } = this.props
@@ -113,3 +73,42 @@ class GroupRemovedAccounts extends ImmutablePureComponent {
}
}
const messages = defineMessages({
remove: { id: 'groups.removed_accounts', defaultMessage: 'Allow joining' },
})
const mapStateToProps = (state, { params }) => {
const groupId = isObject(params) ? params['id'] : -1
const group = groupId === -1 ? null : state.getIn(['groups', groupId])
return {
group,
groupId,
accountIds: state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'items']),
hasMore: !!state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'next']),
}
}
const mapDispatchToProps = (dispatch) => ({
onFetchRemovedAccounts(groupId) {
dispatch(fetchRemovedAccounts(groupId))
},
onExpandRemovedAccounts(groupId) {
dispatch(expandRemovedAccounts(groupId))
},
onRemoveRemovedAccount(groupId, accountId) {
dispatch(removeRemovedAccount(groupId, accountId))
},
})
GroupRemovedAccounts.propTypes = {
groupId: PropTypes.string.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
onFetchRemovedAccounts: PropTypes.func.isRequired,
onExpandRemovedAccounts: PropTypes.func.isRequired,
onRemoveRemovedAccount: PropTypes.func.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(GroupRemovedAccounts))