s-platform-landing-section 0.1.36-beta.6 → 0.1.36-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +46 -71
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +46 -71
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -10766,7 +10766,14 @@ var Products2 = function Products2(props) {
|
|
|
10766
10766
|
var _useState2 = useState(false),
|
|
10767
10767
|
canGoNext = _useState2[0],
|
|
10768
10768
|
setCanGoNext = _useState2[1];
|
|
10769
|
-
var
|
|
10769
|
+
var _useState3 = useState({
|
|
10770
|
+
size: 16,
|
|
10771
|
+
isSale: true
|
|
10772
|
+
}),
|
|
10773
|
+
params = _useState3[0];
|
|
10774
|
+
var _ProductController = ProductController(_extends({}, props, {
|
|
10775
|
+
params: params
|
|
10776
|
+
})),
|
|
10770
10777
|
_ProductController$pr = _ProductController.products,
|
|
10771
10778
|
products = _ProductController$pr === void 0 ? [] : _ProductController$pr,
|
|
10772
10779
|
_ProductController$lo = _ProductController.loading,
|
|
@@ -11449,48 +11456,38 @@ var Products11 = function Products11(props) {
|
|
|
11449
11456
|
return (a === null || a === void 0 ? void 0 : (_a$productInfo = a.productInfo) === null || _a$productInfo === void 0 ? void 0 : _a$productInfo.price) - (b === null || b === void 0 ? void 0 : (_b$productInfo = b.productInfo) === null || _b$productInfo === void 0 ? void 0 : _b$productInfo.price);
|
|
11450
11457
|
});
|
|
11451
11458
|
setProductsFilter(productsCopy);
|
|
11452
|
-
} else if ((filterItem === null || filterItem === void 0 ? void 0 : filterItem.value) === "discount") {
|
|
11453
|
-
var _productsCopy2;
|
|
11454
|
-
var _productsCopy = [].concat(products);
|
|
11455
|
-
_productsCopy = (_productsCopy2 = _productsCopy) === null || _productsCopy2 === void 0 ? void 0 : _productsCopy2.filter(function (product) {
|
|
11456
|
-
var _product$productInfo, _product$productInfo2, _product$productInfo3;
|
|
11457
|
-
return (product === null || product === void 0 ? void 0 : (_product$productInfo = product.productInfo) === null || _product$productInfo === void 0 ? void 0 : _product$productInfo.priceBeforeDiscount) && (product === null || product === void 0 ? void 0 : (_product$productInfo2 = product.productInfo) === null || _product$productInfo2 === void 0 ? void 0 : _product$productInfo2.priceBeforeDiscount) !== (product === null || product === void 0 ? void 0 : (_product$productInfo3 = product.productInfo) === null || _product$productInfo3 === void 0 ? void 0 : _product$productInfo3.price);
|
|
11458
|
-
});
|
|
11459
|
-
setProductsFilter(_productsCopy);
|
|
11460
11459
|
} else {
|
|
11461
11460
|
setProductsFilter(products);
|
|
11462
11461
|
}
|
|
11463
11462
|
}, [products, categorySelected]);
|
|
11464
11463
|
var handleFilter = function handleFilter(item) {
|
|
11465
11464
|
setFilterItem(item);
|
|
11466
|
-
if ((item === null || item === void 0 ? void 0 : item.value) === "sortPriceDESC" && !(params !== null && params !== void 0 && params.isHighlight)) {
|
|
11465
|
+
if ((item === null || item === void 0 ? void 0 : item.value) === "sortPriceDESC" && !(params !== null && params !== void 0 && params.isHighlight) && !(params !== null && params !== void 0 && params.isSale)) {
|
|
11467
11466
|
var productsCopy = [].concat(products);
|
|
11468
11467
|
productsCopy === null || productsCopy === void 0 ? void 0 : productsCopy.sort(function (a, b) {
|
|
11469
11468
|
var _a$productInfo2, _b$productInfo2;
|
|
11470
11469
|
return (a === null || a === void 0 ? void 0 : (_a$productInfo2 = a.productInfo) === null || _a$productInfo2 === void 0 ? void 0 : _a$productInfo2.price) - (b === null || b === void 0 ? void 0 : (_b$productInfo2 = b.productInfo) === null || _b$productInfo2 === void 0 ? void 0 : _b$productInfo2.price);
|
|
11471
11470
|
});
|
|
11472
11471
|
setProductsFilter(productsCopy);
|
|
11473
|
-
} else if ((item === null || item === void 0 ? void 0 : item.value) === "discount"
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11472
|
+
} else if ((item === null || item === void 0 ? void 0 : item.value) === "discount") {
|
|
11473
|
+
setParams({
|
|
11474
|
+
page: 0,
|
|
11475
|
+
categoryId: categorySelected === null || categorySelected === void 0 ? void 0 : categorySelected.categoryId,
|
|
11476
|
+
size: 12,
|
|
11477
|
+
isSale: true
|
|
11479
11478
|
});
|
|
11480
|
-
setProductsFilter(_productsCopy3);
|
|
11481
11479
|
} else if ((item === null || item === void 0 ? void 0 : item.value) === "isHighlight") {
|
|
11482
|
-
setParams(
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11480
|
+
setParams({
|
|
11481
|
+
page: 0,
|
|
11482
|
+
categoryId: categorySelected === null || categorySelected === void 0 ? void 0 : categorySelected.categoryId,
|
|
11483
|
+
size: 12,
|
|
11484
|
+
isHighlight: true
|
|
11486
11485
|
});
|
|
11487
11486
|
} else {
|
|
11488
|
-
setParams(
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
size: 12
|
|
11493
|
-
};
|
|
11487
|
+
setParams({
|
|
11488
|
+
page: 0,
|
|
11489
|
+
categoryId: categorySelected === null || categorySelected === void 0 ? void 0 : categorySelected.categoryId,
|
|
11490
|
+
size: 12
|
|
11494
11491
|
});
|
|
11495
11492
|
}
|
|
11496
11493
|
};
|
|
@@ -11788,7 +11785,7 @@ var listFilter$1 = [{
|
|
|
11788
11785
|
}
|
|
11789
11786
|
}];
|
|
11790
11787
|
var ProductSearch1 = function ProductSearch1(props) {
|
|
11791
|
-
var _window, _window$location,
|
|
11788
|
+
var _window, _window$location, _products$slice;
|
|
11792
11789
|
var _props$Link = props.Link,
|
|
11793
11790
|
Link = _props$Link === void 0 ? null : _props$Link,
|
|
11794
11791
|
_props$SectionTitle = props.SectionTitle,
|
|
@@ -11798,21 +11795,18 @@ var ProductSearch1 = function ProductSearch1(props) {
|
|
|
11798
11795
|
shopConfigStyle = props.shopConfigStyle;
|
|
11799
11796
|
var queryParams = new URLSearchParams((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.search);
|
|
11800
11797
|
var keywordValue = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get('tu-khoa');
|
|
11801
|
-
var _useState = useState(
|
|
11802
|
-
productsFilter = _useState[0],
|
|
11803
|
-
setProductsFilter = _useState[1];
|
|
11804
|
-
var _useState2 = useState({
|
|
11798
|
+
var _useState = useState({
|
|
11805
11799
|
productName: keywordValue,
|
|
11806
11800
|
size: 12
|
|
11807
11801
|
}),
|
|
11808
|
-
params =
|
|
11809
|
-
setParams =
|
|
11810
|
-
var
|
|
11811
|
-
isGetMore =
|
|
11812
|
-
setIsGetMore =
|
|
11813
|
-
var
|
|
11814
|
-
isAutoGetList =
|
|
11815
|
-
setIsAutoGetList =
|
|
11802
|
+
params = _useState[0],
|
|
11803
|
+
setParams = _useState[1];
|
|
11804
|
+
var _useState2 = useState(true),
|
|
11805
|
+
isGetMore = _useState2[0],
|
|
11806
|
+
setIsGetMore = _useState2[1];
|
|
11807
|
+
var _useState3 = useState(false),
|
|
11808
|
+
isAutoGetList = _useState3[0],
|
|
11809
|
+
setIsAutoGetList = _useState3[1];
|
|
11816
11810
|
var _ProductController = ProductController(_extends({}, props, {
|
|
11817
11811
|
params: params,
|
|
11818
11812
|
isAutoGetList: isAutoGetList
|
|
@@ -11820,9 +11814,6 @@ var ProductSearch1 = function ProductSearch1(props) {
|
|
|
11820
11814
|
products = _ProductController.products,
|
|
11821
11815
|
loading = _ProductController.loading,
|
|
11822
11816
|
page = _ProductController.page;
|
|
11823
|
-
var _useState5 = useState({}),
|
|
11824
|
-
filterValue = _useState5[0],
|
|
11825
|
-
setFilterValue = _useState5[1];
|
|
11826
11817
|
useEffect(function () {
|
|
11827
11818
|
setIsAutoGetList(true);
|
|
11828
11819
|
setParams(function (prev) {
|
|
@@ -11831,19 +11822,6 @@ var ProductSearch1 = function ProductSearch1(props) {
|
|
|
11831
11822
|
});
|
|
11832
11823
|
});
|
|
11833
11824
|
}, [keywordValue]);
|
|
11834
|
-
useEffect(function () {
|
|
11835
|
-
if ((filterValue === null || filterValue === void 0 ? void 0 : filterValue.value) === "discount") {
|
|
11836
|
-
var _productsCopy;
|
|
11837
|
-
var productsCopy = [].concat(products);
|
|
11838
|
-
productsCopy = (_productsCopy = productsCopy) === null || _productsCopy === void 0 ? void 0 : _productsCopy.filter(function (product) {
|
|
11839
|
-
var _product$productInfo, _product$productInfo2, _product$productInfo3;
|
|
11840
|
-
return (product === null || product === void 0 ? void 0 : (_product$productInfo = product.productInfo) === null || _product$productInfo === void 0 ? void 0 : _product$productInfo.priceBeforeDiscount) && (product === null || product === void 0 ? void 0 : (_product$productInfo2 = product.productInfo) === null || _product$productInfo2 === void 0 ? void 0 : _product$productInfo2.priceBeforeDiscount) !== (product === null || product === void 0 ? void 0 : (_product$productInfo3 = product.productInfo) === null || _product$productInfo3 === void 0 ? void 0 : _product$productInfo3.price);
|
|
11841
|
-
});
|
|
11842
|
-
setProductsFilter(productsCopy);
|
|
11843
|
-
} else {
|
|
11844
|
-
setProductsFilter(products);
|
|
11845
|
-
}
|
|
11846
|
-
}, [products]);
|
|
11847
11825
|
var handleGetMoreProducts = function handleGetMoreProducts() {
|
|
11848
11826
|
setIsGetMore(false);
|
|
11849
11827
|
setParams(function (prev) {
|
|
@@ -11853,20 +11831,17 @@ var ProductSearch1 = function ProductSearch1(props) {
|
|
|
11853
11831
|
});
|
|
11854
11832
|
};
|
|
11855
11833
|
var handleFilter = function handleFilter(item) {
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
var _product$productInfo4, _product$productInfo5, _product$productInfo6;
|
|
11862
|
-
return (product === null || product === void 0 ? void 0 : (_product$productInfo4 = product.productInfo) === null || _product$productInfo4 === void 0 ? void 0 : _product$productInfo4.priceBeforeDiscount) && (product === null || product === void 0 ? void 0 : (_product$productInfo5 = product.productInfo) === null || _product$productInfo5 === void 0 ? void 0 : _product$productInfo5.priceBeforeDiscount) !== (product === null || product === void 0 ? void 0 : (_product$productInfo6 = product.productInfo) === null || _product$productInfo6 === void 0 ? void 0 : _product$productInfo6.price);
|
|
11834
|
+
if ((item === null || item === void 0 ? void 0 : item.value) === "discount") {
|
|
11835
|
+
setParams({
|
|
11836
|
+
size: 12,
|
|
11837
|
+
productName: keywordValue,
|
|
11838
|
+
isSale: true
|
|
11863
11839
|
});
|
|
11864
|
-
setProductsFilter(productsCopy);
|
|
11865
11840
|
} else if ((item === null || item === void 0 ? void 0 : item.value) === "isHighlight") {
|
|
11866
|
-
setParams(
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11841
|
+
setParams({
|
|
11842
|
+
size: 12,
|
|
11843
|
+
productName: keywordValue,
|
|
11844
|
+
isHighlight: true
|
|
11870
11845
|
});
|
|
11871
11846
|
} else {
|
|
11872
11847
|
setParams({
|
|
@@ -11890,15 +11865,15 @@ var ProductSearch1 = function ProductSearch1(props) {
|
|
|
11890
11865
|
onClick: handleFilter
|
|
11891
11866
|
}), loading && isGetMore ? /*#__PURE__*/React__default.createElement("div", {
|
|
11892
11867
|
className: "m-auto mt-20 min-h-32"
|
|
11893
|
-
}, /*#__PURE__*/React__default.createElement(Loading, null)) : (
|
|
11868
|
+
}, /*#__PURE__*/React__default.createElement(Loading, null)) : (products === null || products === void 0 ? void 0 : products.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
11894
11869
|
className: "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-2 gap-y-4 md:gap-4 xl:gap-6"
|
|
11895
|
-
},
|
|
11870
|
+
}, products === null || products === void 0 ? void 0 : (_products$slice = products.slice(0, (params === null || params === void 0 ? void 0 : params.size) - 4)) === null || _products$slice === void 0 ? void 0 : _products$slice.map(function (product, idx) {
|
|
11896
11871
|
return /*#__PURE__*/React__default.createElement(ProductItem, {
|
|
11897
11872
|
Link: Link,
|
|
11898
11873
|
product: product,
|
|
11899
11874
|
key: "htrhr-" + idx
|
|
11900
11875
|
});
|
|
11901
|
-
})) : /*#__PURE__*/React__default.createElement(NotFoundProduct, null), !loading && (
|
|
11876
|
+
})) : /*#__PURE__*/React__default.createElement(NotFoundProduct, null), !loading && (products === null || products === void 0 ? void 0 : products.length) > (params === null || params === void 0 ? void 0 : params.size) - 4 ? /*#__PURE__*/React__default.createElement(Button, {
|
|
11902
11877
|
label: "Xem thêm",
|
|
11903
11878
|
onClick: handleGetMoreProducts,
|
|
11904
11879
|
className: "mx-auto " + (shopConfigStyle === null || shopConfigStyle === void 0 ? void 0 : shopConfigStyle.buttonClass),
|