2022-10-19 20:30:59 +11:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-24 01:15:17 +10:00
|
|
|
import { PureComponent } from 'react';
|
|
|
|
|
2022-10-19 20:30:59 +11:00
|
|
|
import { connect } from 'react-redux';
|
2023-05-24 01:15:17 +10:00
|
|
|
|
2022-10-19 20:30:59 +11:00
|
|
|
import FeaturedTags from 'mastodon/features/account/containers/featured_tags_container';
|
2022-10-24 08:38:08 +11:00
|
|
|
import { normalizeForLookup } from 'mastodon/reducers/accounts_map';
|
2022-10-19 20:30:59 +11:00
|
|
|
|
|
|
|
const mapStateToProps = (state, { match: { params: { acct } } }) => {
|
2022-10-24 08:38:08 +11:00
|
|
|
const accountId = state.getIn(['accounts_map', normalizeForLookup(acct)]);
|
2022-10-19 20:30:59 +11:00
|
|
|
|
|
|
|
if (!accountId) {
|
|
|
|
return {
|
|
|
|
isLoading: true,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
accountId,
|
|
|
|
isLoading: false,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-05-23 18:52:27 +10:00
|
|
|
class AccountNavigation extends PureComponent {
|
2022-10-19 20:30:59 +11:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
match: PropTypes.shape({
|
|
|
|
params: PropTypes.shape({
|
|
|
|
acct: PropTypes.string,
|
|
|
|
tagged: PropTypes.string,
|
|
|
|
}).isRequired,
|
|
|
|
}).isRequired,
|
|
|
|
|
|
|
|
accountId: PropTypes.string,
|
|
|
|
isLoading: PropTypes.bool,
|
|
|
|
};
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { accountId, isLoading, match: { params: { tagged } } } = this.props;
|
|
|
|
|
|
|
|
if (isLoading) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div className='flex-spacer' />
|
|
|
|
<FeaturedTags accountId={accountId} tagged={tagged} />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-03-24 13:17:53 +11:00
|
|
|
|
|
|
|
export default connect(mapStateToProps)(AccountNavigation);
|