diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 8c8537a..0000000 --- a/.eslintrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "eslint-config-discourse", - "globals": { - "settings": "readonly", - "themePrefix": "readonly" - } -} diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 1e0f0f5..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("@discourse/lint-configs/eslint-theme"); diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..89ddd35 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +engine-strict = true +auto-install-peers = false diff --git a/.streerc b/.streerc new file mode 100644 index 0000000..5c47737 --- /dev/null +++ b/.streerc @@ -0,0 +1,2 @@ +--print-width=100 +--plugins=plugin/trailing_comma,plugin/disable_auto_ternary diff --git a/about.json b/about.json index 8d9fd3b..11778ed 100644 --- a/about.json +++ b/about.json @@ -3,7 +3,7 @@ "component": true, "about_url": "https://github.com/paviliondev/discourse-dropdown-header", "license_url": "https://github.com/paviliondev/discourse-dropdown-header/blob/main/LICENSE.txt", - "theme_version": "1.0", + "theme_version": "1.1", "assets": {}, "modifiers": { "svg_icons": [ diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..41477ae --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,3 @@ +import DiscourseRecommendedTheme from "@discourse/lint-configs/eslint-theme"; + +export default [...DiscourseRecommendedTheme]; diff --git a/javascripts/discourse/components/custom-header-dropdown.gjs b/javascripts/discourse/components/custom-header-dropdown.gjs deleted file mode 100644 index 210f2b1..0000000 --- a/javascripts/discourse/components/custom-header-dropdown.gjs +++ /dev/null @@ -1,38 +0,0 @@ -import Component from "@ember/component"; -import { fn } from "@ember/helper"; -import { on } from "@ember/modifier"; -import { action } from "@ember/object"; -import { service } from "@ember/service"; -import DiscourseURL from "discourse/lib/url"; -import CustomIcon from "./custom-icon"; - -export default class CustomHeaderDropdown extends Component { - @service site; - @service router; - - @action - redirectToUrl(url, event) { - if (this.site.mobileView) { - this.toggleHeaderLinks(); - } - - DiscourseURL.routeTo(url); - - event.stopPropagation(); - } - - -} diff --git a/javascripts/discourse/components/custom-header-link.gjs b/javascripts/discourse/components/custom-header-link.gjs index fc6f932..f651916 100644 --- a/javascripts/discourse/components/custom-header-link.gjs +++ b/javascripts/discourse/components/custom-header-link.gjs @@ -7,7 +7,6 @@ import { inject as service } from "@ember/service"; import concatClass from "discourse/helpers/concat-class"; import DiscourseURL from "discourse/lib/url"; import dIcon from "discourse-common/helpers/d-icon"; -import CustomHeaderDropdown from "./custom-header-dropdown"; import CustomIcon from "./custom-icon"; export default class CustomHeaderLink extends Component { @@ -65,12 +64,18 @@ export default class CustomHeaderLink extends Component { } @action - redirectToUrl(url) { + redirectToUrl(item) { if (this.site.mobileView) { this.toggleHeaderLinks(); } - DiscourseURL.routeTo(url); + if (item.newTab) { + window.open(item.url, "_blank"); + } else { + DiscourseURL.routeTo(item.url); + } + + event.stopPropagation(); }