From d5bd3c3c47a230930a1fb6b9fad54a55dd04d3d4 Mon Sep 17 00:00:00 2001 From: merefield Date: Sun, 24 Sep 2023 11:58:20 +0100 Subject: [PATCH] prettier --- .../components/wizard-mapper-selector.js.es6 | 6 +- .../components/wizard-subscription-badge.hbs | 6 +- .../components/wizard-subscription-badge.js | 18 +++-- .../wizard-subscription-container.hbs | 5 +- .../wizard-subscription-container.js | 10 +-- .../components/wizard-subscription-cta.hbs | 6 +- .../components/wizard-subscription-cta.js | 15 ++-- .../components/wizard-subscription-status.js | 15 ++-- .../discourse/routes/admin-wizards.js.es6 | 2 +- .../discourse/services/subscription.js | 73 ++++++++++--------- 10 files changed, 88 insertions(+), 68 deletions(-) diff --git a/assets/javascripts/discourse/components/wizard-mapper-selector.js.es6 b/assets/javascripts/discourse/components/wizard-mapper-selector.js.es6 index d1aacfb8..8a9e1a6b 100644 --- a/assets/javascripts/discourse/components/wizard-mapper-selector.js.es6 +++ b/assets/javascripts/discourse/components/wizard-mapper-selector.js.es6 @@ -131,7 +131,11 @@ export default Component.extend({ return this.connector === "is"; }), - @discourseComputed("site.groups", "guestGroup", "subscription.subscriptionType") + @discourseComputed( + "site.groups", + "guestGroup", + "subscription.subscriptionType" + ) groups(groups, guestGroup, subscriptionType) { let result = groups; if (!guestGroup) { diff --git a/assets/javascripts/discourse/components/wizard-subscription-badge.hbs b/assets/javascripts/discourse/components/wizard-subscription-badge.hbs index 62a85ba8..6a258385 100644 --- a/assets/javascripts/discourse/components/wizard-subscription-badge.hbs +++ b/assets/javascripts/discourse/components/wizard-subscription-badge.hbs @@ -1,4 +1,8 @@ - + +

{{i18n "admin.wizard.subscription.title"}}

diff --git a/assets/javascripts/discourse/components/wizard-subscription-container.js b/assets/javascripts/discourse/components/wizard-subscription-container.js index 25cb3973..060d7af6 100644 --- a/assets/javascripts/discourse/components/wizard-subscription-container.js +++ b/assets/javascripts/discourse/components/wizard-subscription-container.js @@ -1,4 +1,4 @@ -import Component from '@glimmer/component'; +import Component from "@glimmer/component"; import { computed } from "@ember/object"; import { inject as service } from "@ember/service"; @@ -8,19 +8,19 @@ export default class WizardSubscriptionContainer extends Component { @computed("subscription.subscribed") get subscribedIcon() { return this.subscription.subscribed ? "check" : "times"; - }; + } @computed("subscription.subscribed") get subscribedLabel() { return `admin.wizard.subscription.${ this.subscription.subscribed ? "subscribed" : "not_subscribed" }.label`; - }; + } @computed("subscription.subscribed") get subscribedTitle() { return `admin.wizard.subscription.${ this.subscription.subscribed ? "subscribed" : "not_subscribed" }.title`; - }; -}; + } +} diff --git a/assets/javascripts/discourse/components/wizard-subscription-cta.hbs b/assets/javascripts/discourse/components/wizard-subscription-cta.hbs index 04f5b6a2..cfaecc03 100644 --- a/assets/javascripts/discourse/components/wizard-subscription-cta.hbs +++ b/assets/javascripts/discourse/components/wizard-subscription-cta.hbs @@ -1,3 +1,7 @@ -
+ {{d-icon icon}}{{label}} \ No newline at end of file diff --git a/assets/javascripts/discourse/components/wizard-subscription-cta.js b/assets/javascripts/discourse/components/wizard-subscription-cta.js index ea4990bd..1c9edfe1 100644 --- a/assets/javascripts/discourse/components/wizard-subscription-cta.js +++ b/assets/javascripts/discourse/components/wizard-subscription-cta.js @@ -1,8 +1,7 @@ - import { inject as service } from "@ember/service"; import { action, computed } from "@ember/object"; import I18n from "I18n"; -import Component from '@glimmer/component'; +import Component from "@glimmer/component"; export default class WizardSubscriptionCta extends Component { @service subscription; @@ -12,25 +11,25 @@ export default class WizardSubscriptionCta extends Component { return `admin.wizard.subscription.cta.${ this.subscription.subscribed ? "subscribed" : "none" }`; - }; + } @computed("subscription.subscribed") get icon() { return this.subscription.subscribed ? "far-life-ring" : "external-link-alt"; - }; + } @computed("i18nKey") get title() { return I18n.t(`${this.i18nKey}.title`); - }; + } @computed("i18nKey") get label() { return I18n.t(`${this.i18nKey}.label`); - }; + } @action click() { window.open(this.subscription.subscriptionCtaLink, "_blank").focus(); - }; -}; + } +} diff --git a/assets/javascripts/discourse/components/wizard-subscription-status.js b/assets/javascripts/discourse/components/wizard-subscription-status.js index 22493f9e..43c2cd9b 100644 --- a/assets/javascripts/discourse/components/wizard-subscription-status.js +++ b/assets/javascripts/discourse/components/wizard-subscription-status.js @@ -15,13 +15,14 @@ export default class WizardSubscriptionStatus extends Component { constructor() { super(...arguments); - ajax(`${this.basePath}`).then((result) => { - this.supplierId = result.suppliers[0].id; - this.authorized = result.suppliers[0].authorized; - }) - .finally(() => { - this.subscription.retrieveSubscriptionStatus(); - }); + ajax(`${this.basePath}`) + .then((result) => { + this.supplierId = result.suppliers[0].id; + this.authorized = result.suppliers[0].authorized; + }) + .finally(() => { + this.subscription.retrieveSubscriptionStatus(); + }); } @action diff --git a/assets/javascripts/discourse/routes/admin-wizards.js.es6 b/assets/javascripts/discourse/routes/admin-wizards.js.es6 index c6e728ed..0a704434 100644 --- a/assets/javascripts/discourse/routes/admin-wizards.js.es6 +++ b/assets/javascripts/discourse/routes/admin-wizards.js.es6 @@ -10,7 +10,7 @@ export default DiscourseRoute.extend({ controller.setProperties({ subscribed: model.subscribed, subscriptionType: model.subscription_type, - subscriptionAttributes: model.subscription_attributes + subscriptionAttributes: model.subscription_attributes, }); }, diff --git a/assets/javascripts/discourse/services/subscription.js b/assets/javascripts/discourse/services/subscription.js index ee4c7f5a..25424f47 100644 --- a/assets/javascripts/discourse/services/subscription.js +++ b/assets/javascripts/discourse/services/subscription.js @@ -1,4 +1,4 @@ -import Service from '@ember/service'; +import Service from "@ember/service"; import { getOwner } from "discourse-common/lib/get-owner"; import { tracked } from "@glimmer/tracking"; import { ajax } from "discourse/lib/ajax"; @@ -12,21 +12,22 @@ const MANAGER_CATEGORY = "https://discourse.pluginmanager.org/c/discourse-custom-wizard"; export default class SubscriptionService extends Service { - @tracked subscribed = false; - @tracked subscriptionType = ""; - @tracked businessSubscription = false; - @tracked communitySubscription = false; - @tracked standardSubscription = false; - @tracked subscriptionAttributes = {}; - subscriptionLandingUrl = PRODUCT_PAGE; + @tracked subscribed = false; + @tracked subscriptionType = ""; + @tracked businessSubscription = false; + @tracked communitySubscription = false; + @tracked standardSubscription = false; + @tracked subscriptionAttributes = {}; + subscriptionLandingUrl = PRODUCT_PAGE; - init() { - super.init(...arguments); - this.retrieveSubscriptionStatus(); - } + init() { + super.init(...arguments); + this.retrieveSubscriptionStatus(); + } - retrieveSubscriptionStatus() { - ajax("/admin/wizards/subscription").then(result => { + retrieveSubscriptionStatus() { + ajax("/admin/wizards/subscription") + .then((result) => { this.subscribed = result.subscribed; this.subscriptionType = result.subscription_type; this.subscriptionAttributes = result.subscription_attributes; @@ -35,28 +36,28 @@ export default class SubscriptionService extends Service { this.standardSubscription = equal(this.subscriptionType, "standard"); }) .catch(popupAjaxError); - }; + } - get adminWizards() { - return getOwner(this).lookup("controller:admin-wizards"); - }; + get adminWizards() { + return getOwner(this).lookup("controller:admin-wizards"); + } - get subscriptionLink() { - return this.subscriptionLandingUrl; - }; + get subscriptionLink() { + return this.subscriptionLandingUrl; + } - get subscriptionCtaLink() { - switch (this.subscriptionType) { - case "none": - return PRODUCT_PAGE; - case "standard": - return SUPPORT_MESSAGE; - case "business": - return SUPPORT_MESSAGE; - case "community": - return MANAGER_CATEGORY; - default: - return PRODUCT_PAGE; - } - }; -} \ No newline at end of file + get subscriptionCtaLink() { + switch (this.subscriptionType) { + case "none": + return PRODUCT_PAGE; + case "standard": + return SUPPORT_MESSAGE; + case "business": + return SUPPORT_MESSAGE; + case "community": + return MANAGER_CATEGORY; + default: + return PRODUCT_PAGE; + } + } +}