A platform for community discussion. Free, open, simple.
UX: New feature empty list message (#37835)
Martin Brennan86c5bee7cb80
diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 36912042178..88c0a23bd09 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -6415,7 +6415,8 @@ en:new_features:title: "What's new?"subtitle: "We are releasing new features and improvements all the time. This page covers the highlights, but you can click 'Learn more' to see extensive release notes."- no_new_features_found: "There was an error loading the feed. You can see previous new feature announcements on <a href='%{url}' target='_blank'>the Discourse Meta community</a>."+ no_new_features_found: "There are no items in the feed or your selected filter returned no results. You can see previous new feature announcements on <a href='%{url}' target='_blank'>the Discourse Meta community</a>."+ no_new_features_error: "There was an error loading the feed. You can see previous new feature announcements on <a href='%{url}' target='_blank'>the Discourse Meta community</a>."learn_more: "Learn more..."experimental: "Experimental"only_experiments: "Only show experimental features"diff --git a/frontend/discourse/admin/components/dashboard-new-features.gjs b/frontend/discourse/admin/components/dashboard-new-features.gjsindex 64301ac4503..9777255135c 100644--- a/frontend/discourse/admin/components/dashboard-new-features.gjs+++ b/frontend/discourse/admin/components/dashboard-new-features.gjs@@ -19,6 +19,7 @@ export default class DashboardNewFeatures extends Component {@tracked newFeatures = null;@tracked isLoading = true;+ @tracked feedError = false;@tracked onlyExperiments = false;constructor() {@@ -30,6 +31,7 @@ export default class DashboardNewFeatures extends Component {async loadNewFeatures(opts = {}) {opts.forceRefresh ||= false;this.isLoading = true;+ this.feedError = false;try {const json = await ajax(@@ -50,6 +52,7 @@ export default class DashboardNewFeatures extends Component {return acc;}, {});} catch (err) {+ this.feedError = true;popupAjaxError(err);} finally {this.isLoading = false;@@ -75,6 +78,22 @@ export default class DashboardNewFeatures extends Component {.filter((item) => item != null);}+ get emptyLabel() {+ if (this.feedError) {+ return i18n("admin.dashboard.new_features.no_new_features_error", {+ url: "https://meta.discourse.org/tags/c/announcements/67/release-notes",+ });+ }++ if (this.groupedNewFeatures.length === 0) {+ return i18n("admin.dashboard.new_features.no_new_features_found", {+ url: "https://meta.discourse.org/tags/c/announcements/67/release-notes",+ });+ }++ return "";+ }+@bindshowFeature(feature) {if (!this.onlyExperiments) {@@ -119,12 +138,7 @@ export default class DashboardNewFeatures extends Component {</:content></AdminConfigAreaCard>{{else}}- <AdminConfigAreaEmptyList- @emptyLabelTranslated={{i18n- "admin.dashboard.new_features.no_new_features_found"- url="https://meta.discourse.org/tags/c/announcements/67/release-notes"- }}- />+ <AdminConfigAreaEmptyList @emptyLabelTranslated={{this.emptyLabel}} />{{/each}}</ConditionalLoadingSpinner></div>diff --git a/spec/system/admin_whats_new_spec.rb b/spec/system/admin_whats_new_spec.rbindex 42b058c5adf..d2b62abc6ff 100644--- a/spec/system/admin_whats_new_spec.rb+++ b/spec/system/admin_whats_new_spec.rb@@ -17,7 +17,11 @@ describe "Admin What's New Page", type: :system doit "shows an error message when the backend returns an empty list" doset_new_features_payload(nil)whats_new_page.visit- expect(whats_new_page).to have_content("There was an error loading the feed.")+ expect(whats_new_page).to have_content(+ html_translation_to_text(+ I18n.t("admin_js.admin.dashboard.new_features.no_new_features_found"),+ ),+ )endit "displays a new feature indicator on the sidebar and clears it when navigating to what's new" do