diff --git a/app/assets/javascripts/admin/addon/components/admin-badges.gjs b/app/assets/javascripts/admin/addon/components/admin-badges.gjs index 385bedad4fbec..9680c7c0227fd 100644 --- a/app/assets/javascripts/admin/addon/components/admin-badges.gjs +++ b/app/assets/javascripts/admin/addon/components/admin-badges.gjs @@ -75,6 +75,7 @@ export default class AdminBadges extends Component { diff --git a/app/assets/javascripts/discourse/app/components/nav-item.gjs b/app/assets/javascripts/discourse/app/components/nav-item.gjs index bbe77b49d3698..6847c544d0a7f 100644 --- a/app/assets/javascripts/discourse/app/components/nav-item.gjs +++ b/app/assets/javascripts/discourse/app/components/nav-item.gjs @@ -3,6 +3,7 @@ import Component from "@glimmer/component"; import { LinkTo } from "@ember/routing"; import { service } from "@ember/service"; import { htmlSafe } from "@ember/template"; +import { isPresent } from "@ember/utils"; import concatClass from "discourse/helpers/concat-class"; import getURL from "discourse/lib/get-url"; import { iconHTML } from "discourse/lib/icon-library"; @@ -24,6 +25,19 @@ export default class NavItem extends Component { return; } + if (isPresent(this.args.currentWhen)) { + const currentWhen = this.args.currentWhen; + if (typeof currentWhen === "boolean") { + return currentWhen; + } else if (typeof currentWhen === "string") { + return currentWhen + .split(" ") + .some((route) => route === this.router.currentRoute.name); + } else { + return false; + } + } + if (this.args.routeParam) { // This is needed because the setting route is underneath /admin/plugins/:plugin_id, // but is not a child route of the plugin routes themselves. E.g. discourse-ai @@ -58,7 +72,10 @@ export default class NavItem extends Component { @current-when={{this.active}} >{{this.contents}} {{else if @route}} - {{this.contents}} + {{this.contents}} {{else}} {{this.contents}} {{/if}}