A platform for community discussion. Free, open, simple.
UX: Improve empty state copy on the activity/topics page (#17746)
Andrei Prigorshnev8f66d57b8604
diff --git a/app/assets/javascripts/discourse/app/routes/user-activity-topics.js b/app/assets/javascripts/discourse/app/routes/user-activity-topics.jsindex c6b0bb90bfe..7059e4acb8b 100644--- a/app/assets/javascripts/discourse/app/routes/user-activity-topics.js+++ b/app/assets/javascripts/discourse/app/routes/user-activity-topics.js@@ -1,6 +1,8 @@import UserAction from "discourse/models/user-action";import UserTopicListRoute from "discourse/routes/user-topic-list";import { action } from "@ember/object";+import { htmlSafe } from "@ember/template";+import getURL from "discourse-common/lib/get-url";import I18n from "I18n";export default UserTopicListRoute.extend({@@ -30,16 +32,22 @@ export default UserTopicListRoute.extend({emptyState() {const user = this.modelFor("user");- const title = this.isCurrentUser(user)- ? I18n.t("user_activity.no_topics_title")- : I18n.t("user_activity.no_topics_title_others", {- username: user.username,- });+ let title, body;+ if (this.isCurrentUser(user)) {+ title = I18n.t("user_activity.no_topics_title");+ body = htmlSafe(+ I18n.t("user_activity.no_topics_body", {+ searchUrl: getURL("/search"),+ })+ );+ } else {+ title = I18n.t("user_activity.no_topics_title_others", {+ username: user.username,+ });+ body = "";+ }- return {- title,- body: "",- };+ return { title, body };},@actiondiff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex f198fa309d2..af51f82b41c 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -4056,6 +4056,7 @@ en:no_likes_body: "A great way to jump in and start contributing is to start reading conversations that have already taken place, and select the %{heartIcon} on posts that you like!"no_likes_others: "No liked posts."no_topics_title: "You have not started any topics yet"+ no_topics_body: "It’s always best to <a href='%{searchUrl}'>search</a> for existing topics of conversation before starting a new one, but if you’re confident the topic you want isn’t out there already, go ahead and start a new topic of your very own. Look for the <kbd>+ New Topic</kbd> button at the top right of the topic list, category, or tag to begin creating a new topic in that area."no_topics_title_others: "%{username} has not started any topics yet"no_read_topics_title: "You haven’t read any topics yet"no_read_topics_body: "Once you start reading discussions, you’ll see a list here. To start reading, look for topics that interest you in <a href='%{topUrl}'>Top</a> or <a href='%{categoriesUrl}'>Categories</a> or search by keyword %{searchIcon}"