diff --git a/app/javascript/gabsocial/features/blocked_accounts.js b/app/javascript/gabsocial/features/blocked_accounts.js index 0e36b91c..b55e1c29 100644 --- a/app/javascript/gabsocial/features/blocked_accounts.js +++ b/app/javascript/gabsocial/features/blocked_accounts.js @@ -6,7 +6,7 @@ import { me } from '../initial_state' import { fetchBlocks, expandBlocks } from '../actions/blocks' import Account from '../components/account' import Block from '../components/block' -import Heading from '../components/heading' +import BlockHeading from '../components/block_heading' import ScrollableList from '../components/scrollable_list' const messages = defineMessages({ @@ -59,11 +59,7 @@ class Blocks extends ImmutablePureComponent { return ( -
- - {intl.formatMessage(messages.blocks)} - -
+ +
{ @@ -76,29 +76,23 @@ class Followers extends ImmutablePureComponent { return ( -
- - {intl.formatMessage(messages.followers)} - -
-
- - { - account && accountIds && accountIds.map((id) => ( - - )) - } - -
+ + + { + account && accountIds && accountIds.map((id) => ( + + )) + } +
) } diff --git a/app/javascript/gabsocial/features/following.js b/app/javascript/gabsocial/features/following.js index 286c0a23..8e146622 100644 --- a/app/javascript/gabsocial/features/following.js +++ b/app/javascript/gabsocial/features/following.js @@ -9,7 +9,7 @@ import { import Account from '../components/account' import ScrollableList from '../components/scrollable_list' import Block from '../components/block' -import Heading from '../components/heading' +import BlockHeading from '../components/block_heading' import AccountPlaceholder from '../components/placeholder/account_placeholder' const mapStateToProps = (state, { account }) => { @@ -76,29 +76,23 @@ class Following extends ImmutablePureComponent { return ( -
- - {intl.formatMessage(messages.follows)} - -
-
- - { - account && accountIds && accountIds.map((id) => ( - - )) - } - -
+ + + { + account && accountIds && accountIds.map((id) => ( + + )) + } +
) } diff --git a/app/javascript/gabsocial/features/group_members.js b/app/javascript/gabsocial/features/group_members.js index aa566a82..b359e537 100644 --- a/app/javascript/gabsocial/features/group_members.js +++ b/app/javascript/gabsocial/features/group_members.js @@ -4,7 +4,6 @@ import debounce from 'lodash.debounce' import isObject from 'lodash.isobject' import { FormattedMessage } from 'react-intl' import { - fetchGroup, fetchMembers, expandMembers, } from '../actions/groups' @@ -12,13 +11,13 @@ import { openPopover } from '../actions/popover' import Account from '../components/account' import ColumnIndicator from '../components/column_indicator' import Block from '../components/block' -import Heading from '../components/heading' +import BlockHeading from '../components/block_heading' import Input from '../components/input' import ScrollableList from '../components/scrollable_list' const mapStateToProps = (state, { params }) => { - const groupId = isObject(params) ? params['id'] : null - const group = state.getIn(['groups', groupId]) + const groupId = isObject(params) ? params['id'] : -1 + const group = groupId === -1 ? null : state.getIn(['groups', groupId]) return { group, @@ -30,9 +29,6 @@ const mapStateToProps = (state, { params }) => { } const mapDispatchToProps = (dispatch) => ({ - onFetchGroup(groupId) { - dispatch(fetchGroup(groupId)) - }, onFetchMembers(groupId) { dispatch(fetchMembers(groupId)) }, @@ -59,20 +55,10 @@ class GroupMembers extends ImmutablePureComponent { accountIds: ImmutablePropTypes.list, hasMore: PropTypes.bool, onExpandMembers: PropTypes.func.isRequired, - onFetchGroup: PropTypes.func.isRequired, onFetchMembers: PropTypes.func.isRequired, onOpenGroupMemberOptions: PropTypes.func.isRequired, } - componentDidMount() { - const { group, groupId } = this.props - - if (!group && groupId) { - console.log("componentDidMount:", groupId) - this.props.onFetchGroup(groupId) - } - } - componentWillMount() { const { groupId } = this.props @@ -109,11 +95,8 @@ class GroupMembers extends ImmutablePureComponent { return ( -
-
- Members -
-
+ + { /* : todo :
diff --git a/app/javascript/gabsocial/features/group_removed_accounts.js b/app/javascript/gabsocial/features/group_removed_accounts.js index cf3dacb9..71d6fde6 100644 --- a/app/javascript/gabsocial/features/group_removed_accounts.js +++ b/app/javascript/gabsocial/features/group_removed_accounts.js @@ -1,6 +1,8 @@ import ImmutablePureComponent from 'react-immutable-pure-component' import ImmutablePropTypes from 'react-immutable-proptypes' +import { defineMessages, injectIntl } from 'react-intl' import debounce from 'lodash.debounce' +import isObject from 'lodash.isobject' import { fetchRemovedAccounts, expandRemovedAccounts, @@ -8,70 +10,102 @@ import { } from '../actions/groups' import { FormattedMessage } from 'react-intl' import Account from '../components/account' +import Block from '../components/block' +import BlockHeading from '../components/block_heading' +import ColumnIndicator from '../components/column_indicator' import ScrollableList from '../components/scrollable_list' -import { defineMessages, injectIntl } from 'react-intl' const messages = defineMessages({ remove: { id: 'groups.removed_accounts', defaultMessage: 'Allow joining' }, }) -const mapStateToProps = (state, { groupId }) => ({ - group: state.getIn(['groups', groupId]), - accountIds: state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'items']), - hasMore: !!state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'next']), +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 -@connect(mapStateToProps) @injectIntl +@connect(mapStateToProps, mapDispatchToProps) class GroupRemovedAccounts extends ImmutablePureComponent { static propTypes = { groupId: PropTypes.string.isRequired, - dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, hasMore: PropTypes.bool, + onFetchRemovedAccounts: PropTypes.func.isRequired, + onExpandRemovedAccounts: PropTypes.func.isRequired, + onRemoveRemovedAccount: PropTypes.func.isRequired, } componentWillMount() { const { groupId } = this.props - this.props.dispatch(fetchRemovedAccounts(groupId)) + this.props.onFetchRemovedAccounts(groupId) } componentWillReceiveProps(nextProps) { if (nextProps.groupId !== this.props.groupId) { - this.props.dispatch(fetchRemovedAccounts(nextProps.groupId)) + this.props.onFetchRemovedAccounts(nextProps.groupId) } } handleLoadMore = debounce(() => { - this.props.dispatch(expandRemovedAccounts(this.props.groupId)) + this.props.onExpandRemovedAccounts(this.props.groupId) }, 300, { leading: true }) render() { - const { accountIds, hasMore, group, intl } = this.props + const { + accountIds, + hasMore, + group, + intl, + } = this.props + + if (!group) return return ( - } - > - { - accountIds && accountIds.map((id) => ( - this.props.dispatch(removeRemovedAccount(group.get('id'), id))} - actionTitle={intl.formatMessage(messages.remove)} - /> - )) - } - + + + } + > + { + accountIds && accountIds.map((id) => ( + this.props.onRemoveRemovedAccount(group.get('id'), id)} + actionTitle={intl.formatMessage(messages.remove)} + /> + )) + } + + ) } diff --git a/app/javascript/gabsocial/features/mutes.js b/app/javascript/gabsocial/features/mutes.js index bcb7d9dc..32c010b2 100644 --- a/app/javascript/gabsocial/features/mutes.js +++ b/app/javascript/gabsocial/features/mutes.js @@ -6,7 +6,7 @@ import { me } from '../initial_state' import { fetchMutes, expandMutes } from '../actions/mutes' import Account from '../components/account' import Block from '../components/block' -import Heading from '../components/heading' +import BlockHeading from '../components/block_heading' import ScrollableList from '../components/scrollable_list' const mapStateToProps = (state) => ({ @@ -50,11 +50,7 @@ class Mutes extends ImmutablePureComponent { return ( -
- - - -
+ } />