gatsby-core-theme 10.0.2-beta.1 → 11.0.2
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/CHANGELOG.md +50 -5
- package/gatsby-node.esm.js +1 -3
- package/package.json +1 -1
- package/src/components/app.js +0 -15
- package/src/components/atoms/spotlights/index.js +3 -3
- package/src/components/atoms/spotlights/spotlights.module.scss +4 -10
- package/src/components/organisms/anchor/index.js +13 -3
- package/src/helpers/api.js +6 -21
- package/src/helpers/processor/index.js +11 -0
- package/src/helpers/processor/modules.js +3 -1
- package/src/helpers/processor/modules.test.js +41 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,27 +1,72 @@
|
|
|
1
|
-
## [
|
|
1
|
+
## [11.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v11.0.1...v11.0.2) (2022-08-23)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
+
* added noindex nofollow to sports tracker pages ([44daaff](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/44daaffb912832db11afb93cc55c6ed9a3416c52))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* Merge branch 'tm-3035-helmet-fixes' into 'master' ([2870a87](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2870a875733f43f753ac39ca968f0bd976720472))
|
|
10
|
+
|
|
11
|
+
## [11.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v11.0.0...v11.0.1) (2022-08-23)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* add filed in main section for feedback counter ([ff3f8d6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ff3f8d67e3eaf968ac39b8a3a5eb243a6d3edeed))
|
|
6
17
|
* aithor box ([7e01efc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7e01efc0683664102bf31fa9f9a517433fc993d3))
|
|
7
18
|
* aithor box ([a6fe211](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a6fe211c04d8e9aab0f1c9e0538a1d4907b92cd9))
|
|
8
|
-
*
|
|
19
|
+
* api urls changes ([26a005c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/26a005c19bbe18a6197c124213fa8de996750402))
|
|
9
20
|
* changed site ([802a65d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/802a65de7f800cf0dfe24078509e94ce5dc1a7f8))
|
|
21
|
+
* changed site to irishluck ([905495f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/905495febf58fb0d729e76047214033de4c8d513))
|
|
10
22
|
* publish beta pipeline ([adf73e8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/adf73e89ff71d9d610d98f0b6e898ad12192834e))
|
|
11
23
|
* publish beta pipeline ([9cd3923](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9cd3923d690b6e7ab846fd3fc6aaf7b81c776ae6))
|
|
12
24
|
* publish beta pipeline ([fe158b3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fe158b3908b53a489d48a76ba53f8dd979983e51))
|
|
13
25
|
* publish beta pipeline ([e0ba3e6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e0ba3e61fb80906de6563199d09a51eff1db9c65))
|
|
14
26
|
* publish beta pipeline ([b6bf4a0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b6bf4a0b5ab08c276fbfb95039f40e81b22e1245))
|
|
15
27
|
* publish beta pipeline ([edbd377](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/edbd3777ca3a86edb5517969a6de875f8ab39915))
|
|
16
|
-
*
|
|
17
|
-
* publish beta pipeline ([b87e75e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b87e75e771a1cdc7dbcd2cb7eb99cb88165189a7))
|
|
28
|
+
* remove the extra / ([ce57259](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ce572598c753605b1237d639ea8d409bb7c07da4))
|
|
18
29
|
* tests fixes after upgrade ([d43145a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d43145a5fbbb69f9b07489399dc4d07b97ced7e6))
|
|
30
|
+
* update gatsby api url and url during build ([ba554dd](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ba554ddaa25c34bdd396250c615521c1c2e97259))
|
|
19
31
|
* updated gatsby version ([7cc884b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7cc884b8fba89c62374d4ada6895daec25a4ad8b))
|
|
20
32
|
* upgrade tests fix ([6b42efb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6b42efb251d96430a7318ca129e7b3118a219f4a))
|
|
21
33
|
* upgraded gatsby, storbook ([d499750](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d49975004563aab2e7f0b5a7eea6b815bdff086c))
|
|
22
34
|
|
|
23
35
|
|
|
24
|
-
* Merge branch 'tm-
|
|
36
|
+
* Merge branch 'tm-3034-change-hercules-sorted-api' into 'master' ([942bd61](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/942bd61b7b3311af50b31a28e19ae8c8fc549f2e))
|
|
37
|
+
* Merge branch 'tm-2987-gatsby-upgrade' into 'master' ([d808d42](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d808d429c3bc69c57b5cf3e5d03a25b8f3553944))
|
|
38
|
+
* Merge branch 'tm-2815-do-you-recommend' into 'master' ([ed5d1a2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ed5d1a24974c1251590ddf8b3c6fa364ba0a2109))
|
|
39
|
+
* Merge branch 'master' into tm-2987-gatsby-upgrade ([b91fe5f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b91fe5f544d4364762fa04331952782b958f9179))
|
|
40
|
+
|
|
41
|
+
# [11.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v10.0.1...v11.0.0) (2022-08-17)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
* add a check in modules in order to avoid the error ([8336e0f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8336e0fc75ed225db5bc36f5658a04d615f29cc7))
|
|
47
|
+
* add a test for manually filtering inactive casinos ([b6c3277](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b6c3277d34394445d5dbd0baaa8fabd11235199f))
|
|
48
|
+
* archive load more translation ([913b7ed](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/913b7eddb4eb31b0e0bec3ee7d2e8f394dd6dcab))
|
|
49
|
+
* publish beta pipeline ([6b9c7b1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6b9c7b180ff314c903fd5f7efd835bb5f47a2fe8))
|
|
50
|
+
* publish beta pipeline ([b87e75e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b87e75e771a1cdc7dbcd2cb7eb99cb88165189a7))
|
|
51
|
+
* remove tag when we dont have data and make style ([980c7c1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/980c7c176c92287d7d9214e390818aff8f5dafbc))
|
|
52
|
+
* update filtering for cardv2 in order to remove closed casinos when using the manual filter ([b26d1f5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b26d1f55cadc296f187c967bd53dd8cc0c3733fe))
|
|
53
|
+
* update tests ([0bd6ab8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0bd6ab82ede9a4415dddfdb80688bef48e022e83))
|
|
54
|
+
* update the logic for cardv2 filtering manually ([c54f41a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c54f41a988f280a10d75286585309d968bf99682))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Code Refactoring
|
|
58
|
+
|
|
59
|
+
* bug fixes on anchor module ([04372b3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/04372b345f1523e52b17dbeae5865b77fc354aeb))
|
|
60
|
+
* set active anchor if available ([5bfcc97](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5bfcc97f0aabb4524d62d8275035e0a7dc5dd393))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
* Merge branch 'tm-2970-cardv2-module' into 'master' ([5361b56](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5361b56ee79497fe4d956c0c1a0625057e48849c))
|
|
64
|
+
* Merge branch 'master' into 'tm-2970-cardv2-module' ([c78d173](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c78d173563117a8764e316caf88007ec5ded31e4))
|
|
65
|
+
* Merge branch 'tm-2943-anchor-module' into 'master' ([185de44](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/185de443a8da578512cdf1b58ce9ed23f08a465d))
|
|
66
|
+
* Merge branch 'master' into tm-2943-anchor-module ([e61c128](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e61c1281a96b35206d15788482475f9c260dc168))
|
|
67
|
+
* Merge branch 'tm-2971-updating-core' into 'master' ([0212134](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0212134aeaefcaa2950ae13e0683453d43eb0dc8))
|
|
68
|
+
* Merge branch 'master' into tm-2943-anchor-module ([07450d5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/07450d564e5256b52478d2360a15c7f4cada2e4d))
|
|
69
|
+
* Merge branch 'fix-small-issues' into 'master' ([4b5165e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4b5165e9f8df9c7453a1b6b28f80c6d16b3cf5fc))
|
|
25
70
|
|
|
26
71
|
## [10.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v10.0.0...v10.0.1) (2022-08-09)
|
|
27
72
|
|
package/gatsby-node.esm.js
CHANGED
|
@@ -116,9 +116,6 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
116
116
|
process.env.GATSBY_SITE_NAME = String(themeOptions.siteName);
|
|
117
117
|
if (process.env.GATSBY_PREVIEW_MODE === 'true') {
|
|
118
118
|
console.log(chalk.magenta('info') + chalk.whiteBright(' preview mode enabled'));
|
|
119
|
-
console.log(
|
|
120
|
-
chalk.magenta('info') + chalk.whiteBright(` preview path: ${process.env.GATSBY_PREVIEW_URL} `)
|
|
121
|
-
);
|
|
122
119
|
createPage({
|
|
123
120
|
path: '/',
|
|
124
121
|
component: require.resolve(appName),
|
|
@@ -290,6 +287,7 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
290
287
|
siteInfo,
|
|
291
288
|
provider,
|
|
292
289
|
isTracker: true,
|
|
290
|
+
meta_robots: ['noindex', 'nofollow'],
|
|
293
291
|
},
|
|
294
292
|
});
|
|
295
293
|
});
|
package/package.json
CHANGED
package/src/components/app.js
CHANGED
|
@@ -79,21 +79,6 @@ export function Head({ pageContext }) {
|
|
|
79
79
|
return isPreview ? <></> : <MetaData page={pageContext.page} siteInfo={pageContext.siteInfo} />;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
// Head.propTypes = {
|
|
83
|
-
// pageContext: PropTypes.shape({
|
|
84
|
-
// isPreview: PropTypes.bool,
|
|
85
|
-
// page: PropTypes.shape({
|
|
86
|
-
// id: PropTypes.number,
|
|
87
|
-
// path: PropTypes.string,
|
|
88
|
-
// }),
|
|
89
|
-
// siteInfo: PropTypes.shape({
|
|
90
|
-
// robots_txt: PropTypes.string,
|
|
91
|
-
// site_logo: PropTypes.string,
|
|
92
|
-
// site_name: PropTypes.string,
|
|
93
|
-
// }),
|
|
94
|
-
// }),
|
|
95
|
-
// };
|
|
96
|
-
|
|
97
82
|
App.propTypes = {
|
|
98
83
|
pageContext: PropTypes.shape({
|
|
99
84
|
siteName: PropTypes.string,
|
|
@@ -33,7 +33,7 @@ const Spotlights = ({ module, themeStyles = {} }) => {
|
|
|
33
33
|
src={imageSrc}
|
|
34
34
|
/>
|
|
35
35
|
)}
|
|
36
|
-
<label>{item.label}</label>
|
|
36
|
+
{item?.label && <label>{item.label}</label>}
|
|
37
37
|
{item.subtitle && <span>{item.subtitle}</span>}
|
|
38
38
|
</>
|
|
39
39
|
);
|
|
@@ -84,7 +84,7 @@ const Spotlights = ({ module, themeStyles = {} }) => {
|
|
|
84
84
|
{mode === 'image_text' &&
|
|
85
85
|
(item.link && item.link.value ? (
|
|
86
86
|
<div className={styles.spotlightsTextCTA}>
|
|
87
|
-
<div dangerouslySetInnerHTML={{ __html: item.text }} />
|
|
87
|
+
{item?.text && <div dangerouslySetInnerHTML={{ __html: item.text }} />}
|
|
88
88
|
{item.link.type === 'external' ? (
|
|
89
89
|
<a
|
|
90
90
|
href={item.link.value}
|
|
@@ -110,7 +110,7 @@ const Spotlights = ({ module, themeStyles = {} }) => {
|
|
|
110
110
|
)}
|
|
111
111
|
</div>
|
|
112
112
|
) : (
|
|
113
|
-
<div dangerouslySetInnerHTML={{ __html: item.text }} />
|
|
113
|
+
item.text && <div dangerouslySetInnerHTML={{ __html: item.text }} />
|
|
114
114
|
))}
|
|
115
115
|
</li>
|
|
116
116
|
))}
|
|
@@ -30,13 +30,16 @@
|
|
|
30
30
|
|
|
31
31
|
img {
|
|
32
32
|
margin: 0 auto;
|
|
33
|
+
margin-bottom: 1rem;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
> a {
|
|
36
|
+
> div > a {
|
|
36
37
|
@include flex-direction(column);
|
|
37
38
|
color: #000;
|
|
38
39
|
font-size: 2rem;
|
|
39
40
|
font-weight: 700;
|
|
41
|
+
margin-top: 1rem;
|
|
42
|
+
width: 100%;
|
|
40
43
|
|
|
41
44
|
label {
|
|
42
45
|
cursor: pointer;
|
|
@@ -47,15 +50,6 @@
|
|
|
47
50
|
display: block;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
.spotlightsTextCTA {
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
flex: 1;
|
|
54
|
-
justify-content: space-between;
|
|
55
|
-
font-size: 1.4rem;
|
|
56
|
-
color: #777;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
53
|
svg {
|
|
60
54
|
display: none;
|
|
61
55
|
}
|
|
@@ -45,7 +45,14 @@ function Anchor({
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
function getWindowDimensions() {
|
|
49
|
+
const { innerWidth: width } = window;
|
|
50
|
+
return width;
|
|
51
|
+
}
|
|
52
|
+
|
|
48
53
|
const setActiveAnchor = () => {
|
|
54
|
+
anchorContainerRef.current && setOffsetTop(anchorContainerRef.current.offsetTop);
|
|
55
|
+
|
|
49
56
|
// get element in viewport
|
|
50
57
|
const currentAnchor = anchorList?.map((el) => {
|
|
51
58
|
const element = document.getElementById(el.id);
|
|
@@ -78,8 +85,12 @@ function Anchor({
|
|
|
78
85
|
const elementOffsetLeft = activeElement.offsetLeft;
|
|
79
86
|
|
|
80
87
|
if (elementOffsetLeft > anchorContainerRef.current.offsetWidth - elementOffsetWidth) {
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
if (getWindowDimensions() > 960) {
|
|
89
|
+
anchorListRef.current.scrollLeft =
|
|
90
|
+
elementOffsetWidth + elementOffsetLeft + 5 - anchorContainerRef.current.offsetWidth;
|
|
91
|
+
} else {
|
|
92
|
+
anchorListRef.current.scrollLeft = elementOffsetLeft - 5;
|
|
93
|
+
}
|
|
83
94
|
} else {
|
|
84
95
|
anchorListRef.current.scrollLeft = 0;
|
|
85
96
|
}
|
|
@@ -89,7 +100,6 @@ function Anchor({
|
|
|
89
100
|
};
|
|
90
101
|
|
|
91
102
|
useEffect(() => {
|
|
92
|
-
setOffsetTop(anchorContainerRef.current.offsetTop);
|
|
93
103
|
window.addEventListener('scroll', () => setActiveAnchor());
|
|
94
104
|
|
|
95
105
|
return () => window.removeEventListener('scroll', setActiveAnchor);
|
package/src/helpers/api.js
CHANGED
|
@@ -3,27 +3,18 @@ import chalk from 'chalk';
|
|
|
3
3
|
import processor from './processor';
|
|
4
4
|
|
|
5
5
|
const API_URL = process.env.GATSBY_API_URL;
|
|
6
|
-
const PREVIEW_URL = process.env.GATSBY_PREVIEW_URL;
|
|
7
6
|
|
|
8
7
|
/* eslint no-console: ["error", { allow: ["log"] }] */
|
|
9
8
|
|
|
10
9
|
export async function getPreview(siteName, page = null, themeOptions) {
|
|
11
10
|
return new Promise((resolve, reject) => {
|
|
12
|
-
const basicAuth =
|
|
13
|
-
process.env.GATSBY_ACTIVE_ENV === 'production'
|
|
14
|
-
? {
|
|
15
|
-
auth: {
|
|
16
|
-
username: 'previewpages',
|
|
17
|
-
password: 'YeV3AhJo',
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
: {};
|
|
21
|
-
|
|
22
11
|
axios
|
|
23
|
-
.get(
|
|
12
|
+
.get(
|
|
13
|
+
`${API_URL}/sites/v0.1/pages/sorted?site_name=${siteName}&path=${page}&preview=1&relations=1`
|
|
14
|
+
)
|
|
24
15
|
.then((response) => {
|
|
25
16
|
console.log(response);
|
|
26
|
-
const processed = processor.run(response.data, themeOptions);
|
|
17
|
+
const processed = processor.run(response.data.result, themeOptions);
|
|
27
18
|
const siteMarket = Object.keys(processed.site_markets)[0];
|
|
28
19
|
resolve({
|
|
29
20
|
marketSections: processed.market_sections[siteMarket],
|
|
@@ -37,7 +28,7 @@ export async function getPreview(siteName, page = null, themeOptions) {
|
|
|
37
28
|
}
|
|
38
29
|
|
|
39
30
|
export async function getData(siteName, page = null) {
|
|
40
|
-
let path = `${API_URL}/v0.1/
|
|
31
|
+
let path = `${API_URL}/sites/v0.1/pages/sorted?site_name=${siteName}`;
|
|
41
32
|
|
|
42
33
|
if (page) {
|
|
43
34
|
path += `&path=${page}`;
|
|
@@ -48,13 +39,7 @@ export async function getData(siteName, page = null) {
|
|
|
48
39
|
const start = new Date();
|
|
49
40
|
return new Promise((resolve, reject) => {
|
|
50
41
|
axios
|
|
51
|
-
.get(path
|
|
52
|
-
headers: {
|
|
53
|
-
'Content-Type': 'application/json',
|
|
54
|
-
'X-ID': 'cf16589b8e1ad64dd6e98983f8334e6d',
|
|
55
|
-
'X-Signature': 'FYD7jWimIguFjrg8D9ibS6wIRMK53/bEqh6VrwXbNbc=',
|
|
56
|
-
},
|
|
57
|
-
})
|
|
42
|
+
.get(path)
|
|
58
43
|
.then((response) => {
|
|
59
44
|
const end = new Date() - start;
|
|
60
45
|
console.log(chalk.green('success') + chalk.whiteBright(` calling hercules - %dms`), end);
|
|
@@ -203,6 +203,12 @@ export default {
|
|
|
203
203
|
const languageKey = Object.keys(data.relations.translations)[0];
|
|
204
204
|
const translations = data.relations.translations[languageKey];
|
|
205
205
|
const searchTemplatesAcitve = [];
|
|
206
|
+
let templateFeadbackCounter = null;
|
|
207
|
+
|
|
208
|
+
// create the list of templates that the feedback module will display
|
|
209
|
+
templateFeadbackCounter = Object.keys(data.templates).filter(
|
|
210
|
+
(res) => data.templates[res].feedback_counter
|
|
211
|
+
);
|
|
206
212
|
|
|
207
213
|
// Check what templates should add in the search result
|
|
208
214
|
Object.keys(data.templates).forEach((el) => {
|
|
@@ -305,6 +311,11 @@ export default {
|
|
|
305
311
|
if (!page.sections.main) {
|
|
306
312
|
return;
|
|
307
313
|
}
|
|
314
|
+
|
|
315
|
+
page.sections.main.feedbackCounter = templateFeadbackCounter.includes(
|
|
316
|
+
`${page.template_id}`
|
|
317
|
+
);
|
|
318
|
+
|
|
308
319
|
if (item.value_type === ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET) {
|
|
309
320
|
page.sections.main.modules.push(cloneDeep(prefilledMarketModules[item.value_id]));
|
|
310
321
|
} else {
|
|
@@ -137,6 +137,8 @@ export function processCardsV2(module, pagesCloned, pagesMappedById, pageId) {
|
|
|
137
137
|
// eslint-disable-next-line no-unused-expressions
|
|
138
138
|
pagesMappedById[page_id] && module.items.push(pagesMappedById[page_id]);
|
|
139
139
|
});
|
|
140
|
+
|
|
141
|
+
module.items = filterInactiveOperators(module.items);
|
|
140
142
|
} else if (cardSelector === 'use_filters') {
|
|
141
143
|
let pagesList = [];
|
|
142
144
|
|
|
@@ -247,7 +249,7 @@ export function processTopListModule(module, relations, pages) {
|
|
|
247
249
|
? pages.operator.filter((page) => page.relation_id === item.operator_id)
|
|
248
250
|
: [];
|
|
249
251
|
|
|
250
|
-
if (operatorPage.length >= 1) {
|
|
252
|
+
if (operatorPage.length >= 1 && operatorPage[0].author) {
|
|
251
253
|
clone.authorName = operatorPage[0].author.name;
|
|
252
254
|
clone.authorPath = operatorPage[0].author.profile_page_path;
|
|
253
255
|
}
|
|
@@ -25,7 +25,13 @@ describe('Modules Helper', () => {
|
|
|
25
25
|
test('Cards V2 Manual list', () => {
|
|
26
26
|
const pagesNum = 10;
|
|
27
27
|
const moduleData = getSampleCardsV2ModuleManual();
|
|
28
|
-
|
|
28
|
+
const pageList = getPageDataList(pagesNum);
|
|
29
|
+
|
|
30
|
+
processCardsV2(
|
|
31
|
+
moduleData,
|
|
32
|
+
groupBy(pageList, 'type'),
|
|
33
|
+
groupBy(getPageDataList(pagesNum), 'id', true)
|
|
34
|
+
);
|
|
29
35
|
|
|
30
36
|
expect(moduleData.items).toHaveLength(3);
|
|
31
37
|
|
|
@@ -35,6 +41,39 @@ describe('Modules Helper', () => {
|
|
|
35
41
|
});
|
|
36
42
|
});
|
|
37
43
|
|
|
44
|
+
test('Cards V2 Filter manual list when inactive operator', () => {
|
|
45
|
+
process.env.GATSBY_SITE_NAME = 'irishluck.ie';
|
|
46
|
+
const pagesNum = 13;
|
|
47
|
+
const moduleData = getSampleCardsV2ModuleManual();
|
|
48
|
+
const pageList = getPageDataList(pagesNum).map((page, i) =>
|
|
49
|
+
i % 2
|
|
50
|
+
? { ...page, type: 'operator', relation: { ...page.relation, status: 'inactive' } }
|
|
51
|
+
: { ...page, type: 'operator', relation: { ...page.relation, status: 'active' } }
|
|
52
|
+
);
|
|
53
|
+
// eslint-disable-next-line global-require
|
|
54
|
+
const { processCardsV2: processCardsV2Clean } = require('./modules');
|
|
55
|
+
processCardsV2Clean(moduleData, groupBy(pageList, 'type'), groupBy(pageList, 'id'));
|
|
56
|
+
// console.log(pageList);
|
|
57
|
+
const item = [];
|
|
58
|
+
moduleData.cards_selector_manual_list.forEach((page) => {
|
|
59
|
+
// eslint-disable-next-line camelcase
|
|
60
|
+
const { page_id } = page;
|
|
61
|
+
pageList.map((operator) => {
|
|
62
|
+
// eslint-disable-next-line camelcase
|
|
63
|
+
if (operator.id === page_id) {
|
|
64
|
+
// eslint-disable-next-line no-unused-expressions
|
|
65
|
+
operator.relation.status === 'active' ? item.push(operator) : null;
|
|
66
|
+
}
|
|
67
|
+
return item;
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
item.forEach((element) => {
|
|
71
|
+
expect(element.relation.status).toEqual('active');
|
|
72
|
+
});
|
|
73
|
+
// expect(item.relation.status).toEqual('active');
|
|
74
|
+
expect(moduleData.num_of_items).toEqual(3);
|
|
75
|
+
});
|
|
76
|
+
|
|
38
77
|
test('Cards V2 FIltered list empty', () => {
|
|
39
78
|
const pagesNum = 10;
|
|
40
79
|
const moduleData = getSampleCardsV2Filtered(true);
|
|
@@ -56,6 +95,7 @@ describe('Modules Helper', () => {
|
|
|
56
95
|
? { ...page, type: 'operator', relation: { ...page.relation, status: 'inactive' } }
|
|
57
96
|
: { ...page, type: 'operator', relation: { ...page.relation, status: 'active' } }
|
|
58
97
|
);
|
|
98
|
+
// eslint-disable-next-line global-require
|
|
59
99
|
const { processCardsV2: processCardsV2Clean } = require('./modules');
|
|
60
100
|
processCardsV2Clean(moduleData, groupBy(pageList, 'type'), groupBy(pageList, 'id'));
|
|
61
101
|
|