diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-10-23 00:08:39 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2019-04-22 20:15:47 +0200 |
commit | 9b9816aba6c97eae9ea35698b185fe3deb3a870a (patch) | |
tree | ea009d33977dde6d877a4021e3232bf5555efe58 /app/javascript/flavours/glitch/features/compose/components | |
parent | 149aa07409ef7cd17098a28510e515530b173f13 (diff) |
[Glitch] Show suggested follows on search screen in mobile layout
Port ad510db3a19640267f94062756d558a45472af14 to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose/components')
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/components/search_results.js | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/search_results.js b/app/javascript/flavours/glitch/features/compose/components/search_results.js index 3d29675b4..69df8cdc9 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search_results.js +++ b/app/javascript/flavours/glitch/features/compose/components/search_results.js @@ -8,16 +8,50 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import Hashtag from 'flavours/glitch/components/hashtag'; import Icon from 'flavours/glitch/components/icon'; +const messages = defineMessages({ + dismissSuggestion: { id: 'suggestions.dismiss', defaultMessage: 'Dismiss suggestion' }, +}); + export default @injectIntl class SearchResults extends ImmutablePureComponent { static propTypes = { results: ImmutablePropTypes.map.isRequired, + suggestions: ImmutablePropTypes.list.isRequired, + fetchSuggestions: PropTypes.func.isRequired, + dismissSuggestion: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; + componentDidMount () { + this.props.fetchSuggestions(); + } + render() { - const { intl, results } = this.props; + const { intl, results, suggestions, dismissSuggestion } = this.props; + + if (results.isEmpty() && !suggestions.isEmpty()) { + return ( + <div className='drawer--results'> + <div className='trends'> + <div className='trends__header'> + <i className='fa fa-user-plus fa-fw' /> + <FormattedMessage id='suggestions.header' defaultMessage='You might be interested in…' /> + </div> + + {suggestions && suggestions.map(accountId => ( + <AccountContainer + key={accountId} + id={accountId} + actionIcon='times' + actionTitle={intl.formatMessage(messages.dismissSuggestion)} + onActionClick={dismissSuggestion} + /> + ))} + </div> + </div> + ); + } let accounts, statuses, hashtags; let count = 0; |