Files
discourse-subscriptions/assets/javascripts/discourse/components/payment-options.js.es6
T
Justin DiRose 7f84cee940 UX: Improve usability of purchase page (#54)
Commit does 3 things:

    Remove the duplicative currency abbreviation in favor of the currency symbol alone
    Reorders plans by the cost in ascending order.
    Fixes a flexbox button bug
2021-02-16 12:07:53 -06:00

24 lines
560 B
JavaScript

import Component from "@ember/component";
import discourseComputed from "discourse-common/utils/decorators";
export default Component.extend({
@discourseComputed("plans")
orderedPlans(plans) {
if (plans) {
return plans.sort((a, b) => (a.unit_amount > b.unit_amount ? 1 : -1));
}
},
didInsertElement() {
this._super(...arguments);
if (this.plans && this.plans.length === 1) {
this.set("selectedPlan", this.plans[0].id);
}
},
actions: {
clickPlan(plan) {
this.set("selectedPlan", plan.id);
},
},
});