The code powering m.abunchtell.com https://m.abunchtell.com
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

40 lignes
1.2 KiB

  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { fetchFollowRequests } from 'mastodon/actions/accounts';
  4. import { connect } from 'react-redux';
  5. import { NavLink, withRouter } from 'react-router-dom';
  6. import IconWithBadge from 'mastodon/components/icon_with_badge';
  7. import { List as ImmutableList } from 'immutable';
  8. import { FormattedMessage } from 'react-intl';
  9. const mapStateToProps = state => ({
  10. count: state.getIn(['user_lists', 'follow_requests', 'items'], ImmutableList()).size,
  11. });
  12. export default @withRouter
  13. @connect(mapStateToProps)
  14. class FollowRequestsNavLink extends React.Component {
  15. static propTypes = {
  16. dispatch: PropTypes.func.isRequired,
  17. count: PropTypes.number.isRequired,
  18. };
  19. componentDidMount () {
  20. const { dispatch } = this.props;
  21. dispatch(fetchFollowRequests());
  22. }
  23. render () {
  24. const { count } = this.props;
  25. if (count === 0) {
  26. return null;
  27. }
  28. return <NavLink className='column-link column-link--transparent' to='/follow_requests'><IconWithBadge className='column-link__icon' id='user-plus' count={count} /><FormattedMessage id='navigation_bar.follow_requests' defaultMessage='Follow requests' /></NavLink>;
  29. }
  30. }