Skip to content

Commit

Permalink
Remove inline alert (#2690)
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-wanja committed Sep 14, 2017
1 parent 3bf8f95 commit bcffc1e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import { Tags, Media, Cart } from "/lib/collections";
import { ProductDetail } from "../components";
import { SocialContainer, VariantListContainer } from "./";
import { DragDropProvider, TranslationProvider } from "/imports/plugins/core/ui/client/providers";
import { ProductVariant } from "/lib/collections/schemas/products";
import { Validation } from "@reactioncommerce/reaction-collections";

const wrapComponent = (Comp) => (
class ProductDetailContainer extends Component {
Expand All @@ -26,7 +24,6 @@ const wrapComponent = (Comp) => (
constructor(props) {
super(props);

this.validation = new Validation(ProductVariant);

this.animationTimeOut = null;
this.textTimeOut = null;
Expand All @@ -37,24 +34,6 @@ const wrapComponent = (Comp) => (
};
}

componentDidMount = () => {
this.variantValidation();
}

// Alert when variant is not valid
variantValidation = () => {
const currentVariant = ReactionProduct.selectedVariant();
const validationStatus = this.validation.validate(currentVariant);
if (validationStatus.isValid === false) {
Alerts.inline("Fill the Label option in order to publish product successfully", "error", {
placement: "productDetail",
i18nKey: "productDetail.variantValidation",
autoHide: 10000
});
}
return [];
}

handleCartQuantityChange = (event, quantity) => {
this.setState({
cartQuantity: Math.max(quantity, 1)
Expand Down
3 changes: 1 addition & 2 deletions private/data/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@
"addBarcode": "Add Barcode",
"quantity": "Quantity",
"quantityGreaterThanZero": "Error: Quantity must be greater than zero",
"dropFiles": "Drop files to upload",
"variantValidation": "Fill the Label option in order to publish product successfully"
"dropFiles": "Drop files to upload"
},
"productDetailEdit": {
"title": "Title",
Expand Down

0 comments on commit bcffc1e

Please sign in to comment.