about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-09-29 04:39:33 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-10-09 13:11:18 +0200
commit9cbb51e8978b93668997d658cd20fecb03848e53 (patch)
tree907dd668ed6649c504f22f08c562f3c8f78b3f89
parent44486db912ac6064419680dbc3dcd3843a02a144 (diff)
[Glitch] Add empty message for “Explore” tabs
Port part of 43b5d5e38d2b8ad8f1d1ad0911c3c1718159c912 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
-rw-r--r--app/javascript/flavours/glitch/features/explore/links.js11
-rw-r--r--app/javascript/flavours/glitch/features/explore/suggestions.js11
-rw-r--r--app/javascript/flavours/glitch/features/explore/tags.js11
3 files changed, 33 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/explore/links.js b/app/javascript/flavours/glitch/features/explore/links.js
index 1d8cd8efc..6adc2f6fb 100644
--- a/app/javascript/flavours/glitch/features/explore/links.js
+++ b/app/javascript/flavours/glitch/features/explore/links.js
@@ -5,6 +5,7 @@ import Story from './components/story';
 import LoadingIndicator from 'flavours/glitch/components/loading_indicator';
 import { connect } from 'react-redux';
 import { fetchTrendingLinks } from 'flavours/glitch/actions/trends';
+import { FormattedMessage } from 'react-intl';
 
 const mapStateToProps = state => ({
   links: state.getIn(['trends', 'links', 'items']),
@@ -28,6 +29,16 @@ class Links extends React.PureComponent {
   render () {
     const { isLoading, links } = this.props;
 
+    if (!isLoading && links.isEmpty()) {
+      return (
+        <div className='explore__links scrollable scrollable--flex'>
+          <div className='empty-column-indicator'>
+            <FormattedMessage id='empty_column.explore_statuses' defaultMessage='Nothing is trending right now. Check back later!' />
+          </div>
+        </div>
+      );
+    }
+
     return (
       <div className='explore__links'>
         {isLoading ? (<LoadingIndicator />) : links.map(link => (
diff --git a/app/javascript/flavours/glitch/features/explore/suggestions.js b/app/javascript/flavours/glitch/features/explore/suggestions.js
index ccd2c950a..52e5ce62b 100644
--- a/app/javascript/flavours/glitch/features/explore/suggestions.js
+++ b/app/javascript/flavours/glitch/features/explore/suggestions.js
@@ -5,6 +5,7 @@ import AccountCard from 'flavours/glitch/features/directory/components/account_c
 import LoadingIndicator from 'flavours/glitch/components/loading_indicator';
 import { connect } from 'react-redux';
 import { fetchSuggestions, dismissSuggestion } from 'flavours/glitch/actions/suggestions';
+import { FormattedMessage } from 'react-intl';
 
 const mapStateToProps = state => ({
   suggestions: state.getIn(['suggestions', 'items']),
@@ -33,6 +34,16 @@ class Suggestions extends React.PureComponent {
   render () {
     const { isLoading, suggestions } = this.props;
 
+    if (!isLoading && suggestions.isEmpty()) {
+      return (
+        <div className='explore__suggestions scrollable scrollable--flex'>
+          <div className='empty-column-indicator'>
+            <FormattedMessage id='empty_column.explore_statuses' defaultMessage='Nothing is trending right now. Check back later!' />
+          </div>
+        </div>
+      );
+    }
+
     return (
       <div className='explore__suggestions'>
         {isLoading ? <LoadingIndicator /> : suggestions.map(suggestion => (
diff --git a/app/javascript/flavours/glitch/features/explore/tags.js b/app/javascript/flavours/glitch/features/explore/tags.js
index 0ec1eb88b..465fad0df 100644
--- a/app/javascript/flavours/glitch/features/explore/tags.js
+++ b/app/javascript/flavours/glitch/features/explore/tags.js
@@ -5,6 +5,7 @@ import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag'
 import LoadingIndicator from 'flavours/glitch/components/loading_indicator';
 import { connect } from 'react-redux';
 import { fetchTrendingHashtags } from 'flavours/glitch/actions/trends';
+import { FormattedMessage } from 'react-intl';
 
 const mapStateToProps = state => ({
   hashtags: state.getIn(['trends', 'tags', 'items']),
@@ -28,6 +29,16 @@ class Tags extends React.PureComponent {
   render () {
     const { isLoading, hashtags } = this.props;
 
+    if (!isLoading && hashtags.isEmpty()) {
+      return (
+        <div className='explore__links scrollable scrollable--flex'>
+          <div className='empty-column-indicator'>
+            <FormattedMessage id='empty_column.explore_statuses' defaultMessage='Nothing is trending right now. Check back later!' />
+          </div>
+        </div>
+      );
+    }
+
     return (
       <div className='explore__links'>
         {isLoading ? (<LoadingIndicator />) : hashtags.map(hashtag => (