Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UX: Improve usability of purchase page #54

Merged
merged 2 commits into from Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,6 +1,14 @@
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) {
Expand Down
Expand Up @@ -24,5 +24,5 @@ export default Helper.helper(function (params) {
currencySign = "$";
}

return currencySign + params.map((p) => p.toUpperCase()).join(" ");
return currencySign + params[1];
});
Expand Up @@ -3,7 +3,7 @@
</p>

<div class="subscribe-buttons">
{{#each plans as |plan|}}
{{#each orderedPlans as |plan|}}
{{payment-plan plan=plan selectedPlan=selectedPlan clickPlan=(action "clickPlan")}}
{{/each}}
</div>
1 change: 1 addition & 0 deletions assets/stylesheets/common/subscribe.scss
Expand Up @@ -3,6 +3,7 @@
justify-content: space-around;

.btn-discourse-subscriptions-subscribe {
flex-direction: column;
padding: 10px 20px;
div {
margin-bottom: 5px;
Expand Down
2 changes: 1 addition & 1 deletion test/javascripts/components/payment-plan-test.js.es6
Expand Up @@ -36,7 +36,7 @@ componentTest("Payment plan subscription button rendered", {
find(".btn-discourse-subscriptions-subscribe:first-child .amount")
.text()
.trim(),
"$AUD 44.99",
"$44.99",
"The plan amount and currency is shown"
);
},
Expand Down