The code powering m.abunchtell.com https://m.abunchtell.com
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

69 řádky
2.1 KiB

  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import ImmutablePureComponent from 'react-immutable-pure-component';
  4. import PropTypes from 'prop-types';
  5. import ImmutablePropTypes from 'react-immutable-proptypes';
  6. import LoadingIndicator from '../../components/loading_indicator';
  7. import { fetchReblogs } from '../../actions/interactions';
  8. import { FormattedMessage } from 'react-intl';
  9. import AccountContainer from '../../containers/account_container';
  10. import Column from '../ui/components/column';
  11. import ColumnBackButton from '../../components/column_back_button';
  12. import ScrollableList from '../../components/scrollable_list';
  13. const mapStateToProps = (state, props) => ({
  14. accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]),
  15. });
  16. @connect(mapStateToProps)
  17. export default class Reblogs extends ImmutablePureComponent {
  18. static propTypes = {
  19. params: PropTypes.object.isRequired,
  20. dispatch: PropTypes.func.isRequired,
  21. shouldUpdateScroll: PropTypes.func,
  22. accountIds: ImmutablePropTypes.list,
  23. };
  24. componentWillMount () {
  25. this.props.dispatch(fetchReblogs(this.props.params.statusId));
  26. }
  27. componentWillReceiveProps(nextProps) {
  28. if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
  29. this.props.dispatch(fetchReblogs(nextProps.params.statusId));
  30. }
  31. }
  32. render () {
  33. const { shouldUpdateScroll, accountIds } = this.props;
  34. if (!accountIds) {
  35. return (
  36. <Column>
  37. <LoadingIndicator />
  38. </Column>
  39. );
  40. }
  41. const emptyMessage = <FormattedMessage id='status.reblogs.empty' defaultMessage='No one has boosted this toot yet. When someone does, they will show up here.' />;
  42. return (
  43. <Column>
  44. <ColumnBackButton />
  45. <ScrollableList
  46. scrollKey='reblogs'
  47. shouldUpdateScroll={shouldUpdateScroll}
  48. emptyMessage={emptyMessage}
  49. >
  50. {accountIds.map(id =>
  51. <AccountContainer key={id} id={id} withNote={false} />
  52. )}
  53. </ScrollableList>
  54. </Column>
  55. );
  56. }
  57. }