From 1f39ce87a5204344b5f02c6b2cbac417f0482458 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Thu, 19 Dec 2024 12:06:02 +0100 Subject: [PATCH] DEV: removes caret from notifications-tracking on mobile (#30369) We never want to show this caret on mobile. --- .../app/components/notifications-tracking.gjs | 7 +++++-- .../components/notifications-tracking-test.gjs | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/notifications-tracking.gjs b/app/assets/javascripts/discourse/app/components/notifications-tracking.gjs index ac5ff309a49..ac803db2337 100644 --- a/app/assets/javascripts/discourse/app/components/notifications-tracking.gjs +++ b/app/assets/javascripts/discourse/app/components/notifications-tracking.gjs @@ -1,6 +1,7 @@ import Component from "@glimmer/component"; import { fn, hash } from "@ember/helper"; import { action } from "@ember/object"; +import { service } from "@ember/service"; import DButton from "discourse/components/d-button"; import DropdownMenu from "discourse/components/dropdown-menu"; import PluginOutlet from "discourse/components/plugin-outlet"; @@ -21,12 +22,14 @@ function constructKey(prefix, level, suffix, key) { } class NotificationsTrackingTrigger extends Component { + @service site; + get showFullTitle() { return this.args.showFullTitle ?? true; } get showCaret() { - return this.args.showCaret ?? true; + return this.site.desktopView && (this.args.showCaret ?? true); } get title() { @@ -48,7 +51,7 @@ class NotificationsTrackingTrigger extends Component { {{/if}} {{#if this.showCaret}} - {{icon "angle-down"}} + {{icon "angle-down" class="notifications-tracking-btn__caret"}} {{/if}} } diff --git a/app/assets/javascripts/discourse/tests/integration/components/notifications-tracking-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/notifications-tracking-test.gjs index a76026f0c4b..357818486c3 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/notifications-tracking-test.gjs +++ b/app/assets/javascripts/discourse/tests/integration/components/notifications-tracking-test.gjs @@ -78,4 +78,22 @@ module("Integration | Component | TopicTracking", function (hooks) { ); }); }); + + test("caret", async function (assert) { + await render(); + + assert.dom(".notifications-tracking-btn__caret").exists(); + }); +}); + +module("Integration | Component | TopicTracking - Mobile", function (hooks) { + setupRenderingTest(hooks); + + test("no caret", async function (assert) { + this.site.desktopView = false; + + await render(); + + assert.dom(".notifications-tracking-btn__caret").doesNotExist(); + }); });