logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

index.js (1774B)


  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import PropTypes from 'prop-types';
  4. import ImmutablePropTypes from 'react-immutable-proptypes';
  5. import LoadingIndicator from '../../components/loading_indicator';
  6. import { fetchReblogs } from '../../actions/interactions';
  7. import { ScrollContainer } from 'react-router-scroll-4';
  8. import AccountContainer from '../../containers/account_container';
  9. import Column from '../ui/components/column';
  10. import ColumnBackButton from '../../components/column_back_button';
  11. import ImmutablePureComponent from 'react-immutable-pure-component';
  12. const mapStateToProps = (state, props) => ({
  13. accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]),
  14. });
  15. @connect(mapStateToProps)
  16. export default class Reblogs extends ImmutablePureComponent {
  17. static propTypes = {
  18. params: PropTypes.object.isRequired,
  19. dispatch: PropTypes.func.isRequired,
  20. accountIds: ImmutablePropTypes.list,
  21. };
  22. componentWillMount () {
  23. this.props.dispatch(fetchReblogs(this.props.params.statusId));
  24. }
  25. componentWillReceiveProps(nextProps) {
  26. if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
  27. this.props.dispatch(fetchReblogs(nextProps.params.statusId));
  28. }
  29. }
  30. render () {
  31. const { accountIds } = this.props;
  32. if (!accountIds) {
  33. return (
  34. <Column>
  35. <LoadingIndicator />
  36. </Column>
  37. );
  38. }
  39. return (
  40. <Column>
  41. <ColumnBackButton />
  42. <ScrollContainer scrollKey='reblogs'>
  43. <div className='scrollable reblogs'>
  44. {accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)}
  45. </div>
  46. </ScrollContainer>
  47. </Column>
  48. );
  49. }
  50. }