about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/account_timeline
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/components/features/account_timeline')
-rw-r--r--app/assets/javascripts/components/features/account_timeline/components/header.jsx81
-rw-r--r--app/assets/javascripts/components/features/account_timeline/containers/header_container.jsx75
-rw-r--r--app/assets/javascripts/components/features/account_timeline/index.jsx87
3 files changed, 0 insertions, 243 deletions
diff --git a/app/assets/javascripts/components/features/account_timeline/components/header.jsx b/app/assets/javascripts/components/features/account_timeline/components/header.jsx
deleted file mode 100644
index fd66c13e0..000000000
--- a/app/assets/javascripts/components/features/account_timeline/components/header.jsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import ImmutablePropTypes from 'react-immutable-proptypes';
-import PropTypes from 'prop-types';
-import InnerHeader from '../../account/components/header';
-import ActionBar from '../../account/components/action_bar';
-import MissingIndicator from '../../../components/missing_indicator';
-
-class Header extends React.PureComponent {
-
-  constructor (props, context) {
-    super(props, context);
-    this.handleFollow = this.handleFollow.bind(this);
-    this.handleBlock = this.handleBlock.bind(this);
-    this.handleMention = this.handleMention.bind(this);
-    this.handleReport = this.handleReport.bind(this);
-    this.handleMute = this.handleMute.bind(this);
-  }
-
-  handleFollow () {
-    this.props.onFollow(this.props.account);
-  }
-
-  handleBlock () {
-    this.props.onBlock(this.props.account);
-  }
-
-  handleMention () {
-    this.props.onMention(this.props.account, this.context.router);
-  }
-
-  handleReport () {
-    this.props.onReport(this.props.account);
-    this.context.router.push('/report');
-  }
-
-  handleMute() {
-    this.props.onMute(this.props.account);
-  }
-
-  render () {
-    const { account, me } = this.props;
-
-    if (account === null) {
-      return <MissingIndicator />;
-    }
-
-    return (
-      <div className='account-timeline__header'>
-        <InnerHeader
-          account={account}
-          me={me}
-          onFollow={this.handleFollow}
-        />
-
-        <ActionBar
-          account={account}
-          me={me}
-          onBlock={this.handleBlock}
-          onMention={this.handleMention}
-          onReport={this.handleReport}
-          onMute={this.handleMute}
-        />
-      </div>
-    );
-  }
-}
-
-Header.propTypes = {
-  account: ImmutablePropTypes.map,
-  me: PropTypes.number.isRequired,
-  onFollow: PropTypes.func.isRequired,
-  onBlock: PropTypes.func.isRequired,
-  onMention: PropTypes.func.isRequired,
-  onReport: PropTypes.func.isRequired,
-  onMute: PropTypes.func.isRequired
-};
-
-Header.contextTypes = {
-  router: PropTypes.object
-};
-
-export default Header;
diff --git a/app/assets/javascripts/components/features/account_timeline/containers/header_container.jsx b/app/assets/javascripts/components/features/account_timeline/containers/header_container.jsx
deleted file mode 100644
index f924e7f5e..000000000
--- a/app/assets/javascripts/components/features/account_timeline/containers/header_container.jsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import { connect } from 'react-redux';
-import { makeGetAccount } from '../../../selectors';
-import Header from '../components/header';
-import {
-  followAccount,
-  unfollowAccount,
-  blockAccount,
-  unblockAccount,
-  muteAccount,
-  unmuteAccount
-} from '../../../actions/accounts';
-import { mentionCompose } from '../../../actions/compose';
-import { initReport } from '../../../actions/reports';
-import { openModal } from '../../../actions/modal';
-import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
-
-const messages = defineMessages({
-  blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
-  muteConfirm: { id: 'confirmations.mute.confirm', defaultMessage: 'Mute' }
-});
-
-const makeMapStateToProps = () => {
-  const getAccount = makeGetAccount();
-
-  const mapStateToProps = (state, { accountId }) => ({
-    account: getAccount(state, Number(accountId)),
-    me: state.getIn(['meta', 'me'])
-  });
-
-  return mapStateToProps;
-};
-
-const mapDispatchToProps = (dispatch, { intl }) => ({
-  onFollow (account) {
-    if (account.getIn(['relationship', 'following'])) {
-      dispatch(unfollowAccount(account.get('id')));
-    } else {
-      dispatch(followAccount(account.get('id')));
-    }
-  },
-
-  onBlock (account) {
-    if (account.getIn(['relationship', 'blocking'])) {
-      dispatch(unblockAccount(account.get('id')));
-    } else {
-      dispatch(openModal('CONFIRM', {
-        message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
-        confirm: intl.formatMessage(messages.blockConfirm),
-        onConfirm: () => dispatch(blockAccount(account.get('id')))
-      }));
-    }
-  },
-
-  onMention (account, router) {
-    dispatch(mentionCompose(account, router));
-  },
-
-  onReport (account) {
-    dispatch(initReport(account));
-  },
-
-  onMute (account) {
-    if (account.getIn(['relationship', 'muting'])) {
-      dispatch(unmuteAccount(account.get('id')));
-    } else {
-      dispatch(openModal('CONFIRM', {
-        message: <FormattedMessage id='confirmations.mute.message' defaultMessage='Are you sure you want to mute {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
-        confirm: intl.formatMessage(messages.muteConfirm),
-        onConfirm: () => dispatch(muteAccount(account.get('id')))
-      }));
-    }
-  }
-});
-
-export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Header));
diff --git a/app/assets/javascripts/components/features/account_timeline/index.jsx b/app/assets/javascripts/components/features/account_timeline/index.jsx
deleted file mode 100644
index a06de3d21..000000000
--- a/app/assets/javascripts/components/features/account_timeline/index.jsx
+++ /dev/null
@@ -1,87 +0,0 @@
-import { connect } from 'react-redux';
-import ImmutablePropTypes from 'react-immutable-proptypes';
-import PropTypes from 'prop-types';
-import {
-  fetchAccount,
-  fetchAccountTimeline,
-  expandAccountTimeline
-} from '../../actions/accounts';
-import StatusList from '../../components/status_list';
-import LoadingIndicator from '../../components/loading_indicator';
-import Column from '../ui/components/column';
-import HeaderContainer from './containers/header_container';
-import ColumnBackButton from '../../components/column_back_button';
-import Immutable from 'immutable';
-
-const mapStateToProps = (state, props) => ({
-  statusIds: state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'items'], Immutable.List()),
-  isLoading: state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'isLoading']),
-  hasMore: !!state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'next']),
-  me: state.getIn(['meta', 'me'])
-});
-
-class AccountTimeline extends React.PureComponent {
-
-  constructor (props, context) {
-    super(props, context);
-    this.handleScrollToBottom = this.handleScrollToBottom.bind(this);
-  }
-
-  componentWillMount () {
-    this.props.dispatch(fetchAccount(Number(this.props.params.accountId)));
-    this.props.dispatch(fetchAccountTimeline(Number(this.props.params.accountId)));
-  }
-
-  componentWillReceiveProps(nextProps) {
-    if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
-      this.props.dispatch(fetchAccount(Number(nextProps.params.accountId)));
-      this.props.dispatch(fetchAccountTimeline(Number(nextProps.params.accountId)));
-    }
-  }
-
-  handleScrollToBottom () {
-    if (!this.props.isLoading && this.props.hasMore) {
-      this.props.dispatch(expandAccountTimeline(Number(this.props.params.accountId)));
-    }
-  }
-
-  render () {
-    const { statusIds, isLoading, hasMore, me } = this.props;
-
-    if (!statusIds && isLoading) {
-      return (
-        <Column>
-          <LoadingIndicator />
-        </Column>
-      );
-    }
-
-    return (
-      <Column>
-        <ColumnBackButton />
-
-        <StatusList
-          prepend={<HeaderContainer accountId={this.props.params.accountId} />}
-          scrollKey='account_timeline'
-          statusIds={statusIds}
-          isLoading={isLoading}
-          hasMore={hasMore}
-          me={me}
-          onScrollToBottom={this.handleScrollToBottom}
-        />
-      </Column>
-    );
-  }
-
-}
-
-AccountTimeline.propTypes = {
-  params: PropTypes.object.isRequired,
-  dispatch: PropTypes.func.isRequired,
-  statusIds: ImmutablePropTypes.list,
-  isLoading: PropTypes.bool,
-  hasMore: PropTypes.bool,
-  me: PropTypes.number.isRequired
-};
-
-export default connect(mapStateToProps)(AccountTimeline);