diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-10-19 11:30:59 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-10-28 19:24:02 +0200 |
commit | 7bb1b917b27760609b08c8c690c87a69ea321ce3 (patch) | |
tree | 2c9e1585cf07d99e4ef82472a51fc33e22f56d25 /app/javascript/flavours/glitch/features/account/navigation.js | |
parent | 2cea6e55646bf47feb96c43d5461fc36f7a828f4 (diff) |
[Glitch] Change featured hashtags to be displayed in navigation panel
Port aefa9253d61def572396c18a8d2ac3cc706ffa2e to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/account/navigation.js')
-rw-r--r-- | app/javascript/flavours/glitch/features/account/navigation.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/account/navigation.js b/app/javascript/flavours/glitch/features/account/navigation.js new file mode 100644 index 000000000..ebd37ec14 --- /dev/null +++ b/app/javascript/flavours/glitch/features/account/navigation.js @@ -0,0 +1,51 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; +import FeaturedTags from 'flavours/glitch/features/account/containers/featured_tags_container'; + +const mapStateToProps = (state, { match: { params: { acct } } }) => { + const accountId = state.getIn(['accounts_map', acct]); + + if (!accountId) { + return { + isLoading: true, + }; + } + + return { + accountId, + isLoading: false, + }; +}; + +export default @connect(mapStateToProps) +class AccountNavigation extends React.PureComponent { + + 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} /> + </> + ); + } + +} |