From a6720afe0652ab5efa50980d3b6e85a16f3a38db Mon Sep 17 00:00:00 2001 From: Machiko Yasuda Date: Wed, 20 Sep 2017 10:55:48 -0700 Subject: [PATCH 1/4] fix: if a cart item is in Limited Supply, show the Limited Supply badge in the cart, along with the standard item information. --- .../checkout/client/components/cartItems.js | 34 +++++++++++-------- .../plugins/core/checkout/server/i18n/en.json | 3 ++ .../default-theme/client/styles/badge.less | 5 +++ 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/imports/plugins/core/checkout/client/components/cartItems.js b/imports/plugins/core/checkout/client/components/cartItems.js index 374176d0ded..bcfd44c4d42 100644 --- a/imports/plugins/core/checkout/client/components/cartItems.js +++ b/imports/plugins/core/checkout/client/components/cartItems.js @@ -1,5 +1,6 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; +import { i18next } from "/client/api"; import { registerComponent } from "@reactioncommerce/reaction-components"; class CartItems extends Component { @@ -30,7 +31,16 @@ class CartItems extends Component { } = this.props; return ( -
+
+ {handleLowInventory(item) && +
+ { i18next.t("cartDrawerItems.limitedSupply", { default: "Limited Supply" }) } +
+ }
- {handleLowInventory(item) ? -
!
: -
- {item.quantity} - - {item.title} -
- {item.variants.title} -
-
- } +
+ {item.quantity} + + {item.title} +
+ {item.variants.title} +
+
); diff --git a/imports/plugins/core/checkout/server/i18n/en.json b/imports/plugins/core/checkout/server/i18n/en.json index b89992e7093..e6820facef8 100644 --- a/imports/plugins/core/checkout/server/i18n/en.json +++ b/imports/plugins/core/checkout/server/i18n/en.json @@ -8,6 +8,9 @@ "dashboard": {}, "settings": {} }, + "cartDrawerItems": { + "limitedSupply": "Limited Supply" + }, "cartCompleted": { "yourCart": "Your Cart", "discountTotal": "Discount Total", diff --git a/imports/plugins/included/default-theme/client/styles/badge.less b/imports/plugins/included/default-theme/client/styles/badge.less index fadb7d8860f..44a71ba7550 100644 --- a/imports/plugins/included/default-theme/client/styles/badge.less +++ b/imports/plugins/included/default-theme/client/styles/badge.less @@ -66,6 +66,11 @@ .label-variant(@label-warning-bg); } +.badge-top { + position: absolute; + top: -10px; + left: -10px; +} /* Badge Colors // Contextual variations of badges From c597b03f6b51b2ac29578e8c64f176a567c11fcd Mon Sep 17 00:00:00 2001 From: Machiko Yasuda Date: Wed, 20 Sep 2017 10:55:56 -0700 Subject: [PATCH 2/4] auto linting fix --- lib/collections/transform/cartOrder.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/collections/transform/cartOrder.js b/lib/collections/transform/cartOrder.js index 152b3431149..bb023fe8021 100644 --- a/lib/collections/transform/cartOrder.js +++ b/lib/collections/transform/cartOrder.js @@ -1,6 +1,5 @@ import accounting from "accounting-js"; import _ from "lodash"; -import { Meteor } from "meteor/meteor"; import { Shops } from "/lib/collections"; From d96bc6ad3f2ca036872d8bbde1536f1d3cddb75e Mon Sep 17 00:00:00 2001 From: Machiko Yasuda Date: Fri, 29 Sep 2017 10:42:55 -0700 Subject: [PATCH 3/4] Use Components.Translation instead of i18next --- imports/plugins/core/checkout/client/components/cartItems.js | 5 ++--- imports/plugins/core/checkout/server/i18n/en.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/imports/plugins/core/checkout/client/components/cartItems.js b/imports/plugins/core/checkout/client/components/cartItems.js index bcfd44c4d42..4199e8aa596 100644 --- a/imports/plugins/core/checkout/client/components/cartItems.js +++ b/imports/plugins/core/checkout/client/components/cartItems.js @@ -1,7 +1,6 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { i18next } from "/client/api"; -import { registerComponent } from "@reactioncommerce/reaction-components"; +import { Components, registerComponent } from "@reactioncommerce/reaction-components"; class CartItems extends Component { static propTypes = { @@ -38,7 +37,7 @@ class CartItems extends Component { > {handleLowInventory(item) &&
- { i18next.t("cartDrawerItems.limitedSupply", { default: "Limited Supply" }) } +
} Date: Fri, 29 Sep 2017 10:43:08 -0700 Subject: [PATCH 4/4] Style rule: Sentence case Limited supplyg --- private/data/i18n/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/private/data/i18n/en.json b/private/data/i18n/en.json index f97482deafd..1fdaa1e7b74 100644 --- a/private/data/i18n/en.json +++ b/private/data/i18n/en.json @@ -62,7 +62,7 @@ "showBarcodes": "Show Barcodes", "soldOut": "Sold Out!", "backOrder": "Backorder", - "limitedSupply": "Limited Supply", + "limitedSupply": "Limited supply", "publishProductVisible": "{{product}} is now visible", "publishProductHidden": "{{product}} is now hidden", "startTracking": "Start Tracking",