A platform for community discussion. Free, open, simple.
UX: Count selected topics for Dissmiss buttons in unified new (#40356)
Martin Brennan4033b795c6d9
diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex aad4ba3cde5..ed1068f2565 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -3820,6 +3820,15 @@ en:dismiss_all: "Dismiss all"dismiss_new_topics: "Dismiss new topics"dismiss_new_replies: "Dismiss new replies"+ dismiss_new_topics_with_selected:+ one: "Dismiss (%{count})"+ other: "Dismiss (%{count})"+ dismiss_new_replies_with_selected:+ one: "Dismiss (%{count})"+ other: "Dismiss (%{count})"+ dismiss_all_with_selected:+ one: "Dismiss (%{count})"+ other: "Dismiss (%{count})"dismiss_new_menu: "Dismiss options"dismiss_and_stop_tracking: "Dismiss and stop tracking"dismiss_new: "Dismiss New"diff --git a/frontend/discourse/app/components/topic-dismiss-buttons.gjs b/frontend/discourse/app/components/topic-dismiss-buttons.gjsindex 9e57caef482..8f3774ecde2 100644--- a/frontend/discourse/app/components/topic-dismiss-buttons.gjs+++ b/frontend/discourse/app/components/topic-dismiss-buttons.gjs@@ -33,10 +33,25 @@ export default class TopicDismissButtons extends Component {if (this.currentUser?.new_new_view_enabled) {switch (this.newListSubset) {case "topics":+ if (this.args.selectedTopics.length > 0) {+ return i18n("topics.bulk.dismiss_new_topics_with_selected", {+ count: this.args.selectedTopics.length,+ });+ }return i18n("topics.bulk.dismiss_new_topics");case "replies":+ if (this.args.selectedTopics.length > 0) {+ return i18n("topics.bulk.dismiss_new_replies_with_selected", {+ count: this.args.selectedTopics.length,+ });+ }return i18n("topics.bulk.dismiss_new_replies");default:+ if (this.args.selectedTopics.length > 0) {+ return i18n("topics.bulk.dismiss_all_with_selected", {+ count: this.args.selectedTopics.length,+ });+ }return i18n("topics.bulk.dismiss_all");}}diff --git a/frontend/discourse/tests/integration/components/topic-dismiss-buttons-test.gjs b/frontend/discourse/tests/integration/components/topic-dismiss-buttons-test.gjsindex 4adb096c086..09cda4cf118 100644--- a/frontend/discourse/tests/integration/components/topic-dismiss-buttons-test.gjs+++ b/frontend/discourse/tests/integration/components/topic-dismiss-buttons-test.gjs@@ -178,6 +178,85 @@ module("Integration | Component | topic-dismiss-buttons", function (hooks) {assert.dom("#dismiss-new-menu-bottom").doesNotExist();});+ test("shows count of selected topics in the dismiss new topics button", async function (assert) {+ this.currentUser.new_new_view_enabled = true;+ this.showNewDismissCombo = true;+ this.model.params.subset = "topics";+ this.selectedTopics = [{ id: 1 }, { id: 2 }];++ await render(+ <template>+ <TopicDismissButtons+ @position="top"+ @model={{this.model}}+ @selectedTopics={{this.selectedTopics}}+ @showResetNew={{this.showResetNew}}+ @showNewDismissCombo={{this.showNewDismissCombo}}+ @showDismissRead={{false}}+ @resetNew={{this.resetNew}}+ />+ </template>+ );++ assert+ .dom("#dismiss-new-top")+ .hasText(+ i18n("topics.bulk.dismiss_new_topics_with_selected", { count: 2 })+ );+ });++ test("shows count of selected topics in the dismiss new replies button", async function (assert) {+ this.currentUser.new_new_view_enabled = true;+ this.showNewDismissCombo = true;+ this.model.params.subset = "replies";+ this.selectedTopics = [{ id: 1 }, { id: 2 }];++ await render(+ <template>+ <TopicDismissButtons+ @position="top"+ @model={{this.model}}+ @selectedTopics={{this.selectedTopics}}+ @showResetNew={{this.showResetNew}}+ @showNewDismissCombo={{this.showNewDismissCombo}}+ @showDismissRead={{false}}+ @resetNew={{this.resetNew}}+ />+ </template>+ );++ assert+ .dom("#dismiss-new-top")+ .hasText(+ i18n("topics.bulk.dismiss_new_replies_with_selected", { count: 2 })+ );+ });++ test("shows count of selected topics in the dismiss all button", async function (assert) {+ this.currentUser.new_new_view_enabled = true;+ this.showNewDismissCombo = true;+ this.model.params.subset = "all";+ this.selectedTopics = [{ id: 1 }, { id: 2 }];++ await render(+ <template>+ <TopicDismissButtons+ @position="top"+ @model={{this.model}}+ @selectedTopics={{this.selectedTopics}}+ @showResetNew={{this.showResetNew}}+ @showNewDismissCombo={{this.showNewDismissCombo}}+ @showDismissRead={{false}}+ @resetNew={{this.resetNew}}+ />+ </template>+ );++ assert+ .dom("#dismiss-new-top")+ .hasText(i18n("topics.bulk.dismiss_all_with_selected", { count: 2 }));+ });+test("keeps the legacy dismiss new button outside the experimental new view", async function (assert) {await render(<template>diff --git a/themes/horizon/scss/desktop-horizon-fixes.scss b/themes/horizon/scss/desktop-horizon-fixes.scssindex 12496bd0329..fe816c0ccd8 100644--- a/themes/horizon/scss/desktop-horizon-fixes.scss+++ b/themes/horizon/scss/desktop-horizon-fixes.scss@@ -57,8 +57,9 @@.bulk-select-topics {position: absolute;- right: 0;- background: var(--secondary);+ right: var(--space-2);+ top: var(--space-2);+ background: transparent;border-radius: var(--d-border-radius);display: flex;gap: 0.5rem;