UX: strip text from PM bookmark and share buttons

Also organize priorities in an easier to reason about way and
shift bookmark topic so it is after link. (consistent with posts)
This commit is contained in:
Sam Saffron 2020-05-20 16:46:49 +10:00
parent b031e3220a
commit e97cb20c2a
No known key found for this signature in database
GPG Key ID: B9606168D2FFD9F5
1 changed files with 22 additions and 9 deletions

View File

@ -3,6 +3,13 @@ import showModal from "discourse/lib/show-modal";
import { registerTopicFooterButton } from "discourse/lib/register-topic-footer-button";
import { formattedReminderTime } from "discourse/lib/bookmark";
const SHARE_PRIORITY = 1000;
const BOOKMARK_PRIORITY = 900;
const ARCHIVE_PRIORITY = 800;
const FLAG_PRIORITY = 700;
const EDIT_MESSAGE_PRIORITY = 600;
const DEFER_PRIORITY = 500;
export default {
name: "topic-footer-buttons",
@ -11,8 +18,12 @@ export default {
registerTopicFooterButton({
id: "share-and-invite",
icon: "link",
priority: 999,
label: "topic.share.title",
priority: SHARE_PRIORITY,
label() {
if (!this.get("topic.isPrivateMessage") || this.site.mobileView) {
return "topic.share.title";
}
},
title: "topic.share.help",
action() {
const panels = [
@ -67,7 +78,7 @@ export default {
registerTopicFooterButton({
id: "flag",
icon: "flag",
priority: 998,
priority: FLAG_PRIORITY,
label: "topic.flag_topic.title",
title: "topic.flag_topic.help",
action: "showFlagTopic",
@ -93,14 +104,16 @@ export default {
}
return "bookmark";
},
priority: 1000,
priority: BOOKMARK_PRIORITY,
classNames() {
const bookmarked = this.get("topic.bookmarked");
return bookmarked ? ["bookmark", "bookmarked"] : ["bookmark"];
},
label() {
if (!this.get("topic.isPrivateMessage") || this.site.mobileView) {
const bookmarked = this.get("topic.bookmarked");
return bookmarked ? "bookmarked.clear_bookmarks" : "bookmarked.title";
}
},
translatedTitle() {
const bookmarked = this.get("topic.bookmarked");
@ -126,7 +139,7 @@ export default {
registerTopicFooterButton({
id: "archive",
priority: 996,
priority: ARCHIVE_PRIORITY,
icon() {
return this.archiveIcon;
},
@ -155,7 +168,7 @@ export default {
registerTopicFooterButton({
id: "edit-message",
priority: 750,
priority: EDIT_MESSAGE_PRIORITY,
icon: "pencil-alt",
label: "topic.edit_message.title",
title: "topic.edit_message.help",
@ -170,7 +183,7 @@ export default {
registerTopicFooterButton({
id: "defer",
icon: "circle",
priority: 300,
priority: DEFER_PRIORITY,
label: "topic.defer.title",
title: "topic.defer.help",
action: "deferTopic",