@griddo/cx 1.75.141 → 1.75.143
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/package.json +3 -3
- package/src/services/navigation.js +17 -11
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.143",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"react-helmet": "^6.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@griddo/eslint-config-back": "^1.75.
|
|
69
|
+
"@griddo/eslint-config-back": "^1.75.143",
|
|
70
70
|
"eslint": "^7.5.0",
|
|
71
71
|
"eslint-plugin-node": "^11.1.0",
|
|
72
72
|
"eslint-plugin-react": "7.14.3",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"publishConfig": {
|
|
99
99
|
"access": "public"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "b29e0e0cdb75ed085de16e4a3f38cff5e67d2c9d"
|
|
102
102
|
}
|
|
@@ -6,7 +6,6 @@ class NavigationService {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
set navigations(navigations) {
|
|
9
|
-
// TODO: Default per language
|
|
10
9
|
this._navigations = navigations;
|
|
11
10
|
this._defaultFooters = this.getDefaultFooters();
|
|
12
11
|
this._defaultHeaders = this.getDefaultHeaders();
|
|
@@ -36,16 +35,23 @@ class NavigationService {
|
|
|
36
35
|
return defaultHeadersByLang;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
38
|
+
getRightLanguage(list, id, language) {
|
|
39
|
+
if (!list || !id) return null;
|
|
40
|
+
const rightLanguageItem = list.find(
|
|
41
|
+
item =>
|
|
42
|
+
item.language === language &&
|
|
43
|
+
item.navigationLanguages?.find(version => version.navigationId === id)
|
|
44
|
+
);
|
|
45
|
+
const result = rightLanguageItem || list.find(item => item.id === id);
|
|
46
|
+
return result ? { ...result } : null;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
getPageHeader(id, language) {
|
|
50
|
+
return this.getRightLanguage(this.navigations.headers, id, language);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
getPageFooter(id, language) {
|
|
54
|
+
return this.getRightLanguage(this.navigations.footers, id, language);
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
getPageNavigations(page) {
|
|
@@ -78,12 +84,12 @@ class NavigationService {
|
|
|
78
84
|
|
|
79
85
|
// Seleccionar navigations
|
|
80
86
|
const header = headerID
|
|
81
|
-
? this.getPageHeader(headerID)
|
|
87
|
+
? this.getPageHeader(headerID, language)
|
|
82
88
|
: headerID === 0
|
|
83
89
|
? null
|
|
84
90
|
: this._defaultHeaders[language];
|
|
85
91
|
const footer = footerID
|
|
86
|
-
? this.getPageFooter(footerID)
|
|
92
|
+
? this.getPageFooter(footerID, language)
|
|
87
93
|
: footerID === 0
|
|
88
94
|
? null
|
|
89
95
|
: this._defaultFooters[language];
|