@griddo/cx 1.75.37 → 1.75.38
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/gatsby-node.js +2 -5
- package/package.json +3 -3
- package/src/utils/index.js +17 -15
package/gatsby-node.js
CHANGED
|
@@ -29,10 +29,7 @@ const BUILD_MODE = process.env.CXBRANCH;
|
|
|
29
29
|
let updatedSites;
|
|
30
30
|
let createdPages = [];
|
|
31
31
|
let buildProcessData = {};
|
|
32
|
-
const {
|
|
33
|
-
componentsVersion,
|
|
34
|
-
griddoVersion,
|
|
35
|
-
} = getComponentsVersion();
|
|
32
|
+
const { componentsVersion, griddoVersion } = getComponentsVersion();
|
|
36
33
|
|
|
37
34
|
const renderId = process.env.RENDERID || new Date().valueOf();
|
|
38
35
|
|
|
@@ -201,7 +198,7 @@ exports.createPages = async ({ actions }) => {
|
|
|
201
198
|
|
|
202
199
|
additionalInfo.navigations = NavService.getPageNavigations(page);
|
|
203
200
|
|
|
204
|
-
const isList =
|
|
201
|
+
const isList = page?.mode === 'list';
|
|
205
202
|
|
|
206
203
|
const multiPageElements = await helpers.getMultiPageElements(
|
|
207
204
|
distributorTemplate
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/cx",
|
|
3
3
|
"description": "Griddo SSG based on Gatsby",
|
|
4
|
-
"version": "1.75.
|
|
4
|
+
"version": "1.75.38",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"react-helmet": "^6.0.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@griddo/eslint-config-back": "^1.75.
|
|
68
|
+
"@griddo/eslint-config-back": "^1.75.38",
|
|
69
69
|
"eslint": "^7.5.0",
|
|
70
70
|
"eslint-plugin-node": "^11.1.0",
|
|
71
71
|
"eslint-plugin-react": "7.14.3",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "bfcb7e9af57ed37884e7dd5e77e48fd89cc82ab8"
|
|
101
101
|
}
|
package/src/utils/index.js
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
const pageUtils = require(
|
|
1
|
+
const pageUtils = require('./pages.js');
|
|
2
2
|
|
|
3
|
-
const getPagePath = (site, fullPath) => `${site}${fullPath}
|
|
3
|
+
const getPagePath = (site, fullPath) => `${site}${fullPath}`;
|
|
4
4
|
|
|
5
5
|
const getPage = (itemsPerPage, pages, page) =>
|
|
6
|
-
pages
|
|
6
|
+
pages?.slice(itemsPerPage * (page - 1), itemsPerPage * page);
|
|
7
7
|
|
|
8
8
|
const getPageCluster = (itemsPerPage, items) => {
|
|
9
|
-
|
|
9
|
+
let totalPagesCount = Math.ceil(items?.length / itemsPerPage) || 1;
|
|
10
10
|
// pageNumbers returns [1, 2, 3, 4, n]
|
|
11
|
+
// TODO: Ver por qué pasa esto...
|
|
12
|
+
if (totalPagesCount < 0) {
|
|
13
|
+
totalPagesCount = 0;
|
|
14
|
+
}
|
|
11
15
|
const pageNumbers = Array(totalPagesCount)
|
|
12
16
|
.fill(0)
|
|
13
|
-
.map((x, idx) => idx + 1)
|
|
17
|
+
.map((x, idx) => idx + 1);
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
const result = pageNumbers.map(x => getPage(itemsPerPage, items, x))
|
|
19
|
+
const result = pageNumbers?.map(x => getPage(itemsPerPage, items, x));
|
|
17
20
|
return result;
|
|
18
|
-
}
|
|
21
|
+
};
|
|
19
22
|
|
|
20
23
|
const getList = distributorTemplate => {
|
|
21
|
-
const allItems = distributorTemplate
|
|
24
|
+
const allItems = distributorTemplate?.queriedItems;
|
|
22
25
|
// get itemsPerPage from templaet info
|
|
23
|
-
const itemsPerPage = distributorTemplate
|
|
26
|
+
const itemsPerPage = distributorTemplate?.itemsPerPage;
|
|
24
27
|
// return an array of array pages
|
|
25
28
|
// [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]
|
|
26
29
|
// each array [1, 2, 3] represent a queriedItems
|
|
27
|
-
const pageClusters = getPageCluster(itemsPerPage, allItems)
|
|
28
|
-
|
|
29
|
-
return pageClusters
|
|
30
|
-
}
|
|
30
|
+
const pageClusters = getPageCluster(itemsPerPage, allItems);
|
|
31
31
|
|
|
32
|
+
return pageClusters;
|
|
33
|
+
};
|
|
32
34
|
|
|
33
35
|
exports.default = {
|
|
34
36
|
getPagePath,
|
|
35
37
|
getList,
|
|
36
38
|
renderPage: pageUtils.renderPage,
|
|
37
39
|
renderListPages: pageUtils.renderListPages,
|
|
38
|
-
}
|
|
40
|
+
};
|