]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Add empty message for “Explore” tabs
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 29 Sep 2022 02:39:33 +0000 (04:39 +0200)
committeraescling <aescling+gitlab@cat.family>
Thu, 17 Nov 2022 05:28:25 +0000 (00:28 -0500)
Port part of 43b5d5e38d2b8ad8f1d1ad0911c3c1718159c912 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/features/explore/links.js
app/javascript/flavours/glitch/features/explore/suggestions.js
app/javascript/flavours/glitch/features/explore/tags.js

index 1d8cd8efc1ca4c5d5ed5be9de377d6df03064fdf..6adc2f6fbaeb5fb3d5d6f34d3c400801affaba73 100644 (file)
@@ -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 => (
index ccd2c950a5bfd6c8466efb602c22de09c3489323..52e5ce62bdf4cdc6ecf45c959dc4d557020195e0 100644 (file)
@@ -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 => (
index 0ec1eb88be93c7600f2ed4552f875cf4540177bd..465fad0df946a8afcc1042403ae5da3dcdd14090 100644 (file)
@@ -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 => (