You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.2 KiB

  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { connect } from 'react-redux';
  4. import FeaturedTags from 'mastodon/features/account/containers/featured_tags_container';
  5. import { normalizeForLookup } from 'mastodon/reducers/accounts_map';
  6. const mapStateToProps = (state, { match: { params: { acct } } }) => {
  7. const accountId = state.getIn(['accounts_map', normalizeForLookup(acct)]);
  8. if (!accountId) {
  9. return {
  10. isLoading: true,
  11. };
  12. }
  13. return {
  14. accountId,
  15. isLoading: false,
  16. };
  17. };
  18. class AccountNavigation extends React.PureComponent {
  19. static propTypes = {
  20. match: PropTypes.shape({
  21. params: PropTypes.shape({
  22. acct: PropTypes.string,
  23. tagged: PropTypes.string,
  24. }).isRequired,
  25. }).isRequired,
  26. accountId: PropTypes.string,
  27. isLoading: PropTypes.bool,
  28. };
  29. render () {
  30. const { accountId, isLoading, match: { params: { tagged } } } = this.props;
  31. if (isLoading) {
  32. return null;
  33. }
  34. return (
  35. <>
  36. <div className='flex-spacer' />
  37. <FeaturedTags accountId={accountId} tagged={tagged} />
  38. </>
  39. );
  40. }
  41. }
  42. export default connect(mapStateToProps)(AccountNavigation);