UX: Improve empty state copy on the activity/topics page (#17746)

This commit is contained in:
Andrei Prigorshnev 2022-08-05 18:37:06 +04:00 committed by GitHub
parent 4283cef2ed
commit 8f66d57b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View File

@ -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 };
},
@action

View File

@ -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: "Its always best to <a href='%{searchUrl}'>search</a> for existing topics of conversation before starting a new one, but if youre confident the topic you want isnt 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 havent read any topics yet"
no_read_topics_body: "Once you start reading discussions, youll 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}"