This commit is contained in:
mgabdev
2020-05-01 01:50:27 -04:00
parent c15d4f12dc
commit 8e349c368c
99 changed files with 1268 additions and 887 deletions

View File

@@ -4,7 +4,6 @@ import ImmutablePropTypes from 'react-immutable-proptypes'
import debounce from 'lodash.debounce'
import { fetchBlocks, expandBlocks } from '../actions/blocks'
import Account from '../components/account'
import ColumnIndicator from '../components/column_indicator'
import ScrollableList from '../components/scrollable_list'
const messages = defineMessages({
@@ -14,6 +13,7 @@ const messages = defineMessages({
const mapStateToProps = (state) => ({
accountIds: state.getIn(['user_lists', 'blocks', 'items']),
hasMore: !!state.getIn(['user_lists', 'blocks', 'next']),
isLoading: state.getIn(['user_lists', 'blocks', 'isLoading'], true),
})
export default
@@ -26,6 +26,7 @@ class Blocks extends ImmutablePureComponent {
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
intl: PropTypes.object.isRequired,
}
@@ -41,13 +42,10 @@ class Blocks extends ImmutablePureComponent {
const {
intl,
accountIds,
hasMore
hasMore,
isLoading,
} = this.props
if (!accountIds) {
return <ColumnIndicator type='loading' />
}
const emptyMessage = intl.formatMessage(messages.empty)
return (
@@ -56,9 +54,10 @@ class Blocks extends ImmutablePureComponent {
onLoadMore={this.handleLoadMore}
hasMore={hasMore}
emptyMessage={emptyMessage}
isLoading={isLoading}
>
{
accountIds.map(id =>
!!accountIds && accountIds.map(id =>
<Account key={`blocked-${id}`} id={id} compact />
)
}

View File

@@ -7,9 +7,9 @@ import ColumnIndicator from '../components/column_indicator'
import List from '../components/list'
const messages = defineMessages({
heading: { id: 'column.domain_blocks', defaultMessage: 'Hidden domains' },
unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unhide {domain}' },
emptyMessage: { id: 'empty_column.domain_blocks', defaultMessage: 'There are no hidden domains yet.' },
heading: { id: 'column.domain_blocks', defaultMessage: 'Blocked domains' },
unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unblock domain {domain}' },
emptyMessage: { id: 'empty_column.domain_blocks', defaultMessage: 'There are no blocked domains yet.' },
});
const mapDispatchToProps = (dispatch) => ({

View File

@@ -5,7 +5,7 @@ import { openModal } from '../../../actions/modal'
const messages = defineMessages({
marked: { id: 'compose_form.spoiler.marked', defaultMessage: 'Text is hidden behind warning' },
unmarked: { id: 'compose_form.spoiler.unmarked', defaultMessage: 'Text is not hidden' },
title: { id: 'compose_form.spoiler.title', defaultMessage: 'Warning' },
title: { id: 'compose_form.gif.title', defaultMessage: 'Insert gif' },
})
const mapStateToProps = (state) => ({

View File

@@ -12,7 +12,7 @@ const messages = defineMessages({
const makeMapStateToProps = () => {
const mapStateToProps = (state) => ({
acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']),
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')),
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size + state.getIn(['compose', 'pending_media_attachments']) > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')),
unavailable: state.getIn(['compose', 'poll']) !== null,
resetFileKey: state.getIn(['compose', 'resetFileKey']),
})

View File

@@ -5,7 +5,7 @@ import ComposeExtraButton from './compose_extra_button'
const messages = defineMessages({
marked: { id: 'compose_form.spoiler.marked', defaultMessage: 'Text is hidden behind warning' },
unmarked: { id: 'compose_form.spoiler.unmarked', defaultMessage: 'Text is not hidden' },
title: { id: 'compose_form.spoiler.title', defaultMessage: 'Warning' },
title: { id: 'compose_form.rte.title', defaultMessage: 'Rich Text Editor' },
})
const mapStateToProps = (state) => ({

View File

@@ -1,20 +1,23 @@
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'
import ImmutablePureComponent from 'react-immutable-pure-component'
import ImmutablePropTypes from 'react-immutable-proptypes'
import debounce from 'lodash.debounce'
import { fetchFollowRequests, expandFollowRequests } from '../../actions/accounts';
import ColumnIndicator from '../../components/column_indicator';
import AccountAuthorize from './components/account_authorize';
import ScrollableList from '../../components/scrollable_list';
import { me } from '../../initial_state'
import { fetchFollowRequests, expandFollowRequests } from '../../actions/accounts'
import AccountAuthorize from './components/account_authorize'
import ScrollableList from '../../components/scrollable_list'
const messages = defineMessages({
heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' },
});
})
const mapStateToProps = (state) => ({
accountIds: state.getIn(['user_lists', 'follow_requests', 'items']),
isLoading: state.getIn(['user_lists', 'follow_requests', 'isLoading'], true),
hasMore: !!state.getIn(['user_lists', 'follow_requests', 'next']),
});
locked: !!state.getIn(['accounts', me, 'locked']),
domain: state.getIn(['meta', 'domain']),
})
export default
@connect(mapStateToProps)
@@ -25,35 +28,48 @@ class FollowRequests extends ImmutablePureComponent {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
hasMore: PropTypes.bool,
locked: PropTypes.bool,
domain: PropTypes.string,
isLoading: PropTypes.bool,
accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired,
};
}
componentWillMount () {
this.props.dispatch(fetchFollowRequests());
this.props.dispatch(fetchFollowRequests())
}
handleLoadMore = debounce(() => {
this.props.dispatch(expandFollowRequests());
}, 300, { leading: true });
this.props.dispatch(expandFollowRequests())
}, 300, { leading: true })
render () {
const { intl, accountIds, hasMore } = this.props;
const { intl, accountIds, hasMore, locked, domain, isLoading } = this.props
if (!accountIds) {
return (<ColumnIndicator type='loading' />);
}
// : todo :
const unlockedPrependMessage = locked ? null : (
<div className='follow_requests-unlocked_explanation'>
<FormattedMessage
id='follow_requests.unlocked_explanation'
defaultMessage='Even though your account is not locked, the {domain} staff thought you might want to review follow requests from these accounts manually.'
values={{ domain: domain }}
/>
</div>
);
return (
<ScrollableList
scrollKey='follow_requests'
onLoadMore={this.handleLoadMore}
hasMore={hasMore}
isLoading={isLoading}
emptyMessage={<FormattedMessage id='empty_column.follow_requests' defaultMessage="You don't have any follow requests yet. When you receive one, it will show up here." />}
>
{accountIds.map(id =>
<AccountAuthorize key={id} id={id} />
)}
{
!!accountIds && accountIds.map(id =>
<AccountAuthorize key={id} id={id} />
)
}
</ScrollableList>
);
}

View File

@@ -18,6 +18,7 @@ const mapStateToProps = (state, { account }) => {
accountId,
accountIds: state.getIn(['user_lists', 'followers', accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'followers', accountId, 'next']),
isLoading: state.getIn(['user_lists', 'followers', accountId, 'isLoading'], true),
}
}
@@ -39,6 +40,7 @@ class Followers extends ImmutablePureComponent {
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
}
componentWillMount() {
@@ -67,7 +69,8 @@ class Followers extends ImmutablePureComponent {
account,
accountIds,
hasMore,
intl
intl,
isLoading,
} = this.props
if (!account) return null
@@ -83,6 +86,7 @@ class Followers extends ImmutablePureComponent {
<ScrollableList
scrollKey='followers'
hasMore={hasMore}
isLoading={isLoading}
onLoadMore={this.handleLoadMore}
emptyMessage={intl.formatMessage(messages.empty)}
>

View File

@@ -18,6 +18,7 @@ const mapStateToProps = (state, { account }) => {
accountId,
accountIds: state.getIn(['user_lists', 'following', accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'following', accountId, 'next']),
isLoading: state.getIn(['user_lists', 'following', accountId, 'isLoading'], true),
}
}
@@ -39,6 +40,7 @@ class Following extends ImmutablePureComponent {
account: ImmutablePropTypes.map,
accountId: PropTypes.string,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
}
componentDidMount() {
@@ -68,6 +70,7 @@ class Following extends ImmutablePureComponent {
accountIds,
hasMore,
intl,
isLoading,
} = this.props
if (!account) return null
@@ -83,6 +86,7 @@ class Following extends ImmutablePureComponent {
<ScrollableList
scrollKey='following'
hasMore={hasMore}
isLoading={isLoading}
onLoadMore={this.handleLoadMore}
emptyMessage={intl.formatMessage(messages.empty)}
>

View File

@@ -38,8 +38,6 @@ class GroupsCollection extends ImmutablePureComponent {
const halfCount = parseInt(groupIds.size / 2)
console.log("halfCount", halfCount)
return (
<div className={[_s.default, _s.flexRow, _s.flexWrap].join(' ')}>
<div className={[_s.default, _s.flexNormal].join(' ')}>

View File

@@ -4,7 +4,7 @@ import StatusList from '../components/status_list'
const messages = defineMessages({
title: { id: 'column.home', defaultMessage: 'Home' },
empty: { id: 'empty_column.home', defaultMessage: 'Your home timeline is empty. Start following other users to recieve their content here.' },
empty: { id: 'empty_timeline.home', defaultMessage: 'Your home timeline is empty. Start following other users to recieve their content here.' },
})
const mapStateToProps = (state) => ({

View File

@@ -4,12 +4,12 @@ import ImmutablePropTypes from 'react-immutable-proptypes'
import debounce from 'lodash.debounce'
import { fetchMutes, expandMutes } from '../actions/mutes'
import Account from '../components/account'
import ColumnIndicator from '../components/column_indicator'
import ScrollableList from '../components/scrollable_list'
const mapStateToProps = (state) => ({
accountIds: state.getIn(['user_lists', 'mutes', 'items']),
hasMore: !!state.getIn(['user_lists', 'mutes', 'next']),
isLoading: state.getIn(['user_lists', 'mutes', 'isLoading'], true),
})
export default
@@ -22,6 +22,7 @@ class Mutes extends ImmutablePureComponent {
dispatch: PropTypes.func.isRequired,
hasMore: PropTypes.bool,
accountIds: ImmutablePropTypes.list,
isLoading: PropTypes.bool,
}
componentWillMount() {
@@ -33,21 +34,18 @@ class Mutes extends ImmutablePureComponent {
}, 300, { leading: true })
render() {
const { hasMore, accountIds } = this.props
if (!accountIds) {
return <ColumnIndicator type='loading' />
}
const { hasMore, accountIds, isLoading } = this.props
return (
<ScrollableList
scrollKey='mutes'
onLoadMore={this.handleLoadMore}
hasMore={hasMore}
isLoading={isLoading}
emptyMessage={<FormattedMessage id='empty_column.mutes' defaultMessage="You haven't muted any users yet." />}
>
{
accountIds.map(id =>
accountIds && accountIds.map(id =>
<Account key={`mutes-${id}`} id={id} compact />
)
}

View File

@@ -2,8 +2,6 @@ import StatusContainer from '../containers/status_container'
export default class Status extends PureComponent {
render() {
console.log("this.props:", this.props)
return (
<StatusContainer {...this.props} />
)