Updated components to use BlockHeading
• Updated: - components to use BlockHeading
This commit is contained in:
parent
083a864be3
commit
6328b21186
|
@ -6,7 +6,7 @@ import { me } from '../initial_state'
|
||||||
import { fetchBlocks, expandBlocks } from '../actions/blocks'
|
import { fetchBlocks, expandBlocks } from '../actions/blocks'
|
||||||
import Account from '../components/account'
|
import Account from '../components/account'
|
||||||
import Block from '../components/block'
|
import Block from '../components/block'
|
||||||
import Heading from '../components/heading'
|
import BlockHeading from '../components/block_heading'
|
||||||
import ScrollableList from '../components/scrollable_list'
|
import ScrollableList from '../components/scrollable_list'
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
|
@ -59,11 +59,7 @@ class Blocks extends ImmutablePureComponent {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Block>
|
<Block>
|
||||||
<div className={[_s.default, _s.px15, _s.py10, _s.justifyContentCenter].join(' ')}>
|
<BlockHeading title={intl.formatMessage(messages.blocks)} />
|
||||||
<Heading size='h2'>
|
|
||||||
{intl.formatMessage(messages.blocks)}
|
|
||||||
</Heading>
|
|
||||||
</div>
|
|
||||||
<ScrollableList
|
<ScrollableList
|
||||||
scrollKey='blocked_accounts'
|
scrollKey='blocked_accounts'
|
||||||
onLoadMore={this.handleLoadMore}
|
onLoadMore={this.handleLoadMore}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class FollowRequests extends ImmutablePureComponent {
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
const unlockedPrependMessage = locked ? null : (
|
const unlockedPrependMessage = locked ? null : (
|
||||||
<div className={[_s.default, _s.px15, _s.py15].join(' ')}>
|
<div className={[_s.default, _s.px15, _s.py15, _s.borderBottom1PX, _s.borderColorSecondary].join(' ')}>
|
||||||
<Text>
|
<Text>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='follow_requests.unlocked_explanation'
|
id='follow_requests.unlocked_explanation'
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
import Account from '../components/account'
|
import Account from '../components/account'
|
||||||
import ScrollableList from '../components/scrollable_list'
|
import ScrollableList from '../components/scrollable_list'
|
||||||
import Block from '../components/block'
|
import Block from '../components/block'
|
||||||
import Heading from '../components/heading'
|
import BlockHeading from '../components/block_heading'
|
||||||
import AccountPlaceholder from '../components/placeholder/account_placeholder'
|
import AccountPlaceholder from '../components/placeholder/account_placeholder'
|
||||||
|
|
||||||
const mapStateToProps = (state, { account }) => {
|
const mapStateToProps = (state, { account }) => {
|
||||||
|
@ -76,29 +76,23 @@ class Followers extends ImmutablePureComponent {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Block>
|
<Block>
|
||||||
<div className={[_s.default, _s.px15, _s.py10, _s.justifyContentCenter].join(' ')}>
|
<BlockHeading title={intl.formatMessage(messages.followers)} />
|
||||||
<Heading size='h2'>
|
<ScrollableList
|
||||||
{intl.formatMessage(messages.followers)}
|
scrollKey='followers'
|
||||||
</Heading>
|
hasMore={hasMore}
|
||||||
</div>
|
isLoading={isLoading}
|
||||||
<div className={[_s.default, _s.py10].join(' ')}>
|
showLoading={isLoading}
|
||||||
<ScrollableList
|
onLoadMore={this.handleLoadMore}
|
||||||
scrollKey='followers'
|
placeholderComponent={AccountPlaceholder}
|
||||||
hasMore={hasMore}
|
placeholderCount={4}
|
||||||
isLoading={isLoading}
|
emptyMessage={intl.formatMessage(messages.empty)}
|
||||||
showLoading={isLoading}
|
>
|
||||||
onLoadMore={this.handleLoadMore}
|
{
|
||||||
placeholderComponent={AccountPlaceholder}
|
account && accountIds && accountIds.map((id) => (
|
||||||
placeholderCount={4}
|
<Account key={`follower-${id}`} id={id} compact withBio />
|
||||||
emptyMessage={intl.formatMessage(messages.empty)}
|
))
|
||||||
>
|
}
|
||||||
{
|
</ScrollableList>
|
||||||
account && accountIds && accountIds.map((id) => (
|
|
||||||
<Account key={`follower-${id}`} id={id} compact withBio />
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</ScrollableList>
|
|
||||||
</div>
|
|
||||||
</Block>
|
</Block>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
import Account from '../components/account'
|
import Account from '../components/account'
|
||||||
import ScrollableList from '../components/scrollable_list'
|
import ScrollableList from '../components/scrollable_list'
|
||||||
import Block from '../components/block'
|
import Block from '../components/block'
|
||||||
import Heading from '../components/heading'
|
import BlockHeading from '../components/block_heading'
|
||||||
import AccountPlaceholder from '../components/placeholder/account_placeholder'
|
import AccountPlaceholder from '../components/placeholder/account_placeholder'
|
||||||
|
|
||||||
const mapStateToProps = (state, { account }) => {
|
const mapStateToProps = (state, { account }) => {
|
||||||
|
@ -76,29 +76,23 @@ class Following extends ImmutablePureComponent {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Block>
|
<Block>
|
||||||
<div className={[_s.default, _s.px15, _s.py10, _s.justifyContentCenter].join(' ')}>
|
<BlockHeading title={intl.formatMessage(messages.follows)} />
|
||||||
<Heading size='h2'>
|
<ScrollableList
|
||||||
{intl.formatMessage(messages.follows)}
|
scrollKey='following'
|
||||||
</Heading>
|
hasMore={hasMore}
|
||||||
</div>
|
isLoading={isLoading}
|
||||||
<div className={[_s.default, _s.py10].join(' ')}>
|
showLoading={isLoading}
|
||||||
<ScrollableList
|
onLoadMore={this.handleLoadMore}
|
||||||
scrollKey='following'
|
placeholderComponent={AccountPlaceholder}
|
||||||
hasMore={hasMore}
|
placeholderCount={4}
|
||||||
isLoading={isLoading}
|
emptyMessage={intl.formatMessage(messages.empty)}
|
||||||
showLoading={isLoading}
|
>
|
||||||
onLoadMore={this.handleLoadMore}
|
{
|
||||||
placeholderComponent={AccountPlaceholder}
|
account && accountIds && accountIds.map((id) => (
|
||||||
placeholderCount={4}
|
<Account key={`following-${id}`} id={id} compact withBio />
|
||||||
emptyMessage={intl.formatMessage(messages.empty)}
|
))
|
||||||
>
|
}
|
||||||
{
|
</ScrollableList>
|
||||||
account && accountIds && accountIds.map((id) => (
|
|
||||||
<Account key={`following-${id}`} id={id} compact withBio />
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</ScrollableList>
|
|
||||||
</div>
|
|
||||||
</Block>
|
</Block>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import debounce from 'lodash.debounce'
|
||||||
import isObject from 'lodash.isobject'
|
import isObject from 'lodash.isobject'
|
||||||
import { FormattedMessage } from 'react-intl'
|
import { FormattedMessage } from 'react-intl'
|
||||||
import {
|
import {
|
||||||
fetchGroup,
|
|
||||||
fetchMembers,
|
fetchMembers,
|
||||||
expandMembers,
|
expandMembers,
|
||||||
} from '../actions/groups'
|
} from '../actions/groups'
|
||||||
|
@ -12,13 +11,13 @@ import { openPopover } from '../actions/popover'
|
||||||
import Account from '../components/account'
|
import Account from '../components/account'
|
||||||
import ColumnIndicator from '../components/column_indicator'
|
import ColumnIndicator from '../components/column_indicator'
|
||||||
import Block from '../components/block'
|
import Block from '../components/block'
|
||||||
import Heading from '../components/heading'
|
import BlockHeading from '../components/block_heading'
|
||||||
import Input from '../components/input'
|
import Input from '../components/input'
|
||||||
import ScrollableList from '../components/scrollable_list'
|
import ScrollableList from '../components/scrollable_list'
|
||||||
|
|
||||||
const mapStateToProps = (state, { params }) => {
|
const mapStateToProps = (state, { params }) => {
|
||||||
const groupId = isObject(params) ? params['id'] : null
|
const groupId = isObject(params) ? params['id'] : -1
|
||||||
const group = state.getIn(['groups', groupId])
|
const group = groupId === -1 ? null : state.getIn(['groups', groupId])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
group,
|
group,
|
||||||
|
@ -30,9 +29,6 @@ const mapStateToProps = (state, { params }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
onFetchGroup(groupId) {
|
|
||||||
dispatch(fetchGroup(groupId))
|
|
||||||
},
|
|
||||||
onFetchMembers(groupId) {
|
onFetchMembers(groupId) {
|
||||||
dispatch(fetchMembers(groupId))
|
dispatch(fetchMembers(groupId))
|
||||||
},
|
},
|
||||||
|
@ -59,20 +55,10 @@ class GroupMembers extends ImmutablePureComponent {
|
||||||
accountIds: ImmutablePropTypes.list,
|
accountIds: ImmutablePropTypes.list,
|
||||||
hasMore: PropTypes.bool,
|
hasMore: PropTypes.bool,
|
||||||
onExpandMembers: PropTypes.func.isRequired,
|
onExpandMembers: PropTypes.func.isRequired,
|
||||||
onFetchGroup: PropTypes.func.isRequired,
|
|
||||||
onFetchMembers: PropTypes.func.isRequired,
|
onFetchMembers: PropTypes.func.isRequired,
|
||||||
onOpenGroupMemberOptions: 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() {
|
componentWillMount() {
|
||||||
const { groupId } = this.props
|
const { groupId } = this.props
|
||||||
|
|
||||||
|
@ -109,11 +95,8 @@ class GroupMembers extends ImmutablePureComponent {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Block>
|
<Block>
|
||||||
<div className={[_s.default, _s.px15, _s.py10].join(' ')}>
|
<BlockHeading title='Group Members' />
|
||||||
<div className={[_s.default, _s.flexRow, _s.alignItemsCenter].join(' ')}>
|
|
||||||
<Heading size='h2'>Members</Heading>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{
|
{
|
||||||
/* : todo :
|
/* : todo :
|
||||||
<div className={[_s.default, _s.justifyContentCenter, _s.px15, _s.my5, _s.borderBottom1PX, _s.borderColorSecondary, _s.pt5, _s.pb15].join(' ')}>
|
<div className={[_s.default, _s.justifyContentCenter, _s.px15, _s.my5, _s.borderBottom1PX, _s.borderColorSecondary, _s.pt5, _s.pb15].join(' ')}>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component'
|
import ImmutablePureComponent from 'react-immutable-pure-component'
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes'
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||||
|
import { defineMessages, injectIntl } from 'react-intl'
|
||||||
import debounce from 'lodash.debounce'
|
import debounce from 'lodash.debounce'
|
||||||
|
import isObject from 'lodash.isobject'
|
||||||
import {
|
import {
|
||||||
fetchRemovedAccounts,
|
fetchRemovedAccounts,
|
||||||
expandRemovedAccounts,
|
expandRemovedAccounts,
|
||||||
|
@ -8,70 +10,102 @@ import {
|
||||||
} from '../actions/groups'
|
} from '../actions/groups'
|
||||||
import { FormattedMessage } from 'react-intl'
|
import { FormattedMessage } from 'react-intl'
|
||||||
import Account from '../components/account'
|
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 ScrollableList from '../components/scrollable_list'
|
||||||
import { defineMessages, injectIntl } from 'react-intl'
|
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
remove: { id: 'groups.removed_accounts', defaultMessage: 'Allow joining' },
|
remove: { id: 'groups.removed_accounts', defaultMessage: 'Allow joining' },
|
||||||
})
|
})
|
||||||
|
|
||||||
const mapStateToProps = (state, { groupId }) => ({
|
const mapStateToProps = (state, { params }) => {
|
||||||
group: state.getIn(['groups', groupId]),
|
const groupId = isObject(params) ? params['id'] : -1
|
||||||
accountIds: state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'items']),
|
const group = groupId === -1 ? null : state.getIn(['groups', groupId])
|
||||||
hasMore: !!state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'next']),
|
|
||||||
|
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
|
export default
|
||||||
@connect(mapStateToProps)
|
|
||||||
@injectIntl
|
@injectIntl
|
||||||
|
@connect(mapStateToProps, mapDispatchToProps)
|
||||||
class GroupRemovedAccounts extends ImmutablePureComponent {
|
class GroupRemovedAccounts extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
groupId: PropTypes.string.isRequired,
|
groupId: PropTypes.string.isRequired,
|
||||||
dispatch: PropTypes.func.isRequired,
|
|
||||||
accountIds: ImmutablePropTypes.list,
|
accountIds: ImmutablePropTypes.list,
|
||||||
hasMore: PropTypes.bool,
|
hasMore: PropTypes.bool,
|
||||||
|
onFetchRemovedAccounts: PropTypes.func.isRequired,
|
||||||
|
onExpandRemovedAccounts: PropTypes.func.isRequired,
|
||||||
|
onRemoveRemovedAccount: PropTypes.func.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
const { groupId } = this.props
|
const { groupId } = this.props
|
||||||
|
|
||||||
this.props.dispatch(fetchRemovedAccounts(groupId))
|
this.props.onFetchRemovedAccounts(groupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (nextProps.groupId !== this.props.groupId) {
|
if (nextProps.groupId !== this.props.groupId) {
|
||||||
this.props.dispatch(fetchRemovedAccounts(nextProps.groupId))
|
this.props.onFetchRemovedAccounts(nextProps.groupId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLoadMore = debounce(() => {
|
handleLoadMore = debounce(() => {
|
||||||
this.props.dispatch(expandRemovedAccounts(this.props.groupId))
|
this.props.onExpandRemovedAccounts(this.props.groupId)
|
||||||
}, 300, { leading: true })
|
}, 300, { leading: true })
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { accountIds, hasMore, group, intl } = this.props
|
const {
|
||||||
|
accountIds,
|
||||||
|
hasMore,
|
||||||
|
group,
|
||||||
|
intl,
|
||||||
|
} = this.props
|
||||||
|
|
||||||
|
if (!group) return <ColumnIndicator type='loading' />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollableList
|
<Block>
|
||||||
scrollKey='removed_accounts'
|
<BlockHeading title='Removed Accounts' />
|
||||||
hasMore={hasMore}
|
<ScrollableList
|
||||||
showLoading={(!group || !accountIds)}
|
scrollKey='removed_accounts'
|
||||||
onLoadMore={this.handleLoadMore}
|
hasMore={hasMore}
|
||||||
emptyMessage={<FormattedMessage id='group.removed_accounts.empty' defaultMessage='This group does not has any removed accounts.' />}
|
showLoading={(!group || !accountIds)}
|
||||||
>
|
onLoadMore={this.handleLoadMore}
|
||||||
{
|
emptyMessage={<FormattedMessage id='group.removed_accounts.empty' defaultMessage='This group does not has any removed accounts.' />}
|
||||||
accountIds && accountIds.map((id) => (
|
>
|
||||||
<Account
|
{
|
||||||
key={id}
|
accountIds && accountIds.map((id) => (
|
||||||
id={id}
|
<Account
|
||||||
actionIcon='subtract'
|
key={id}
|
||||||
onActionClick={() => this.props.dispatch(removeRemovedAccount(group.get('id'), id))}
|
id={id}
|
||||||
actionTitle={intl.formatMessage(messages.remove)}
|
actionIcon='subtract'
|
||||||
/>
|
onActionClick={() => this.props.onRemoveRemovedAccount(group.get('id'), id)}
|
||||||
))
|
actionTitle={intl.formatMessage(messages.remove)}
|
||||||
}
|
/>
|
||||||
</ScrollableList>
|
))
|
||||||
|
}
|
||||||
|
</ScrollableList>
|
||||||
|
</Block>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { me } from '../initial_state'
|
||||||
import { fetchMutes, expandMutes } from '../actions/mutes'
|
import { fetchMutes, expandMutes } from '../actions/mutes'
|
||||||
import Account from '../components/account'
|
import Account from '../components/account'
|
||||||
import Block from '../components/block'
|
import Block from '../components/block'
|
||||||
import Heading from '../components/heading'
|
import BlockHeading from '../components/block_heading'
|
||||||
import ScrollableList from '../components/scrollable_list'
|
import ScrollableList from '../components/scrollable_list'
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = (state) => ({
|
||||||
|
@ -50,11 +50,7 @@ class Mutes extends ImmutablePureComponent {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Block>
|
<Block>
|
||||||
<div className={[_s.default, _s.px15, _s.py10, _s.justifyContentCenter].join(' ')}>
|
<BlockHeading title={<FormattedMessage id='navigation_bar.mutes' defaultMessage='Muted users' />} />
|
||||||
<Heading size='h2'>
|
|
||||||
<FormattedMessage id='navigation_bar.mutes' defaultMessage='Muted users' />
|
|
||||||
</Heading>
|
|
||||||
</div>
|
|
||||||
<ScrollableList
|
<ScrollableList
|
||||||
scrollKey='mutes'
|
scrollKey='mutes'
|
||||||
onLoadMore={this.handleLoadMore}
|
onLoadMore={this.handleLoadMore}
|
||||||
|
|
Loading…
Reference in New Issue