gatsby-core-theme 10.0.1 → 11.0.1

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/.ci.yml CHANGED
@@ -14,9 +14,9 @@ Theme Tests:
14
14
  - gatsby-theme/coverage/
15
15
  coverage: /All files\s*\|\s*([\d\.]+)/
16
16
  rules:
17
- - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
17
+ - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "beta"'
18
18
  - if: '$CI_COMMIT_BRANCH == "master" && $PIPELINE == "automated"'
19
- - if: '$CI_PIPELINE_SOURCE == "push" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" && $PIPELINE == "automated"'
19
+ - if: '$CI_PIPELINE_SOURCE == "push" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "beta") && $PIPELINE == "automated"'
20
20
 
21
21
  Theme Publish:
22
22
  image: git.ilcd.rocks:4567/team-floyd/themes/gatsby-themes:node14
@@ -39,3 +39,25 @@ Theme Publish:
39
39
  - master
40
40
  variables:
41
41
  - $PIPELINE != "content-trigger"
42
+
43
+ Theme Beta Publish:
44
+ image: git.ilcd.rocks:4567/team-floyd/themes/gatsby-themes:node14
45
+ stage: publish-beta
46
+ tags:
47
+ - floyd-runner-test
48
+ before_script:
49
+ - git config --global http.sslverify false
50
+ - git config --global user.email "floyd@gig.com"
51
+ - git config --global user.name "floyd"
52
+ script:
53
+ - export HUSKY=0
54
+ - yarn config set cache-folder .yarn
55
+ - yarn
56
+ - cd gatsby-theme/
57
+ - npx semantic-release
58
+ when: manual
59
+ only:
60
+ refs:
61
+ - beta
62
+ variables:
63
+ - $PIPELINE != "content-trigger"
@@ -5,6 +5,7 @@ module.exports = {
5
5
  '../../**/**/src/**/*.stories.@(js|jsx|ts|tsx)',
6
6
  ],
7
7
  addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
8
+ framework: '@storybook/react',
8
9
  core: {
9
10
  builder: 'webpack5',
10
11
  },
@@ -47,11 +48,11 @@ module.exports = {
47
48
  'gatsby-page-utils': path.resolve(__dirname, '../../node_modules/gatsby-page-utils/dist'),
48
49
  };
49
50
 
50
- // config.resolve.alias['$virtual/lazy-client-sync-requires'] = path.resolve(
51
- // `./__mocks__/virtual-lazy-client-sync-requires.js`
52
- // );
51
+ config.resolve.alias['$virtual/lazy-client-sync-requires'] = path.resolve(
52
+ `./__mocks__/virtual-lazy-client-sync-requires.js`
53
+ );
53
54
 
54
- // config.resolve.mainFields = ['browser', 'module', 'main'];
55
+ config.resolve.mainFields = ['browser', 'module', 'main'];
55
56
  return config;
56
57
  },
57
58
  };
package/CHANGELOG.md CHANGED
@@ -1,3 +1,63 @@
1
+ ## [11.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v11.0.0...v11.0.1) (2022-08-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add filed in main section for feedback counter ([ff3f8d6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ff3f8d67e3eaf968ac39b8a3a5eb243a6d3edeed))
7
+ * aithor box ([7e01efc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7e01efc0683664102bf31fa9f9a517433fc993d3))
8
+ * aithor box ([a6fe211](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a6fe211c04d8e9aab0f1c9e0538a1d4907b92cd9))
9
+ * api urls changes ([26a005c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/26a005c19bbe18a6197c124213fa8de996750402))
10
+ * changed site ([802a65d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/802a65de7f800cf0dfe24078509e94ce5dc1a7f8))
11
+ * changed site to irishluck ([905495f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/905495febf58fb0d729e76047214033de4c8d513))
12
+ * publish beta pipeline ([adf73e8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/adf73e89ff71d9d610d98f0b6e898ad12192834e))
13
+ * publish beta pipeline ([9cd3923](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9cd3923d690b6e7ab846fd3fc6aaf7b81c776ae6))
14
+ * publish beta pipeline ([fe158b3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fe158b3908b53a489d48a76ba53f8dd979983e51))
15
+ * publish beta pipeline ([e0ba3e6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e0ba3e61fb80906de6563199d09a51eff1db9c65))
16
+ * publish beta pipeline ([b6bf4a0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b6bf4a0b5ab08c276fbfb95039f40e81b22e1245))
17
+ * publish beta pipeline ([edbd377](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/edbd3777ca3a86edb5517969a6de875f8ab39915))
18
+ * remove the extra / ([ce57259](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ce572598c753605b1237d639ea8d409bb7c07da4))
19
+ * tests fixes after upgrade ([d43145a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d43145a5fbbb69f9b07489399dc4d07b97ced7e6))
20
+ * update gatsby api url and url during build ([ba554dd](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ba554ddaa25c34bdd396250c615521c1c2e97259))
21
+ * updated gatsby version ([7cc884b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7cc884b8fba89c62374d4ada6895daec25a4ad8b))
22
+ * upgrade tests fix ([6b42efb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6b42efb251d96430a7318ca129e7b3118a219f4a))
23
+ * upgraded gatsby, storbook ([d499750](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d49975004563aab2e7f0b5a7eea6b815bdff086c))
24
+
25
+
26
+ * Merge branch 'tm-3034-change-hercules-sorted-api' into 'master' ([942bd61](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/942bd61b7b3311af50b31a28e19ae8c8fc549f2e))
27
+ * Merge branch 'tm-2987-gatsby-upgrade' into 'master' ([d808d42](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d808d429c3bc69c57b5cf3e5d03a25b8f3553944))
28
+ * Merge branch 'tm-2815-do-you-recommend' into 'master' ([ed5d1a2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ed5d1a24974c1251590ddf8b3c6fa364ba0a2109))
29
+ * Merge branch 'master' into tm-2987-gatsby-upgrade ([b91fe5f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b91fe5f544d4364762fa04331952782b958f9179))
30
+
31
+ # [11.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v10.0.1...v11.0.0) (2022-08-17)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * add a check in modules in order to avoid the error ([8336e0f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8336e0fc75ed225db5bc36f5658a04d615f29cc7))
37
+ * add a test for manually filtering inactive casinos ([b6c3277](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b6c3277d34394445d5dbd0baaa8fabd11235199f))
38
+ * archive load more translation ([913b7ed](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/913b7eddb4eb31b0e0bec3ee7d2e8f394dd6dcab))
39
+ * publish beta pipeline ([6b9c7b1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6b9c7b180ff314c903fd5f7efd835bb5f47a2fe8))
40
+ * publish beta pipeline ([b87e75e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b87e75e771a1cdc7dbcd2cb7eb99cb88165189a7))
41
+ * remove tag when we dont have data and make style ([980c7c1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/980c7c176c92287d7d9214e390818aff8f5dafbc))
42
+ * 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))
43
+ * update tests ([0bd6ab8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0bd6ab82ede9a4415dddfdb80688bef48e022e83))
44
+ * update the logic for cardv2 filtering manually ([c54f41a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c54f41a988f280a10d75286585309d968bf99682))
45
+
46
+
47
+ ### Code Refactoring
48
+
49
+ * bug fixes on anchor module ([04372b3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/04372b345f1523e52b17dbeae5865b77fc354aeb))
50
+ * set active anchor if available ([5bfcc97](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5bfcc97f0aabb4524d62d8275035e0a7dc5dd393))
51
+
52
+
53
+ * Merge branch 'tm-2970-cardv2-module' into 'master' ([5361b56](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5361b56ee79497fe4d956c0c1a0625057e48849c))
54
+ * Merge branch 'master' into 'tm-2970-cardv2-module' ([c78d173](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c78d173563117a8764e316caf88007ec5ded31e4))
55
+ * Merge branch 'tm-2943-anchor-module' into 'master' ([185de44](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/185de443a8da578512cdf1b58ce9ed23f08a465d))
56
+ * Merge branch 'master' into tm-2943-anchor-module ([e61c128](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e61c1281a96b35206d15788482475f9c260dc168))
57
+ * Merge branch 'tm-2971-updating-core' into 'master' ([0212134](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0212134aeaefcaa2950ae13e0683453d43eb0dc8))
58
+ * Merge branch 'master' into tm-2943-anchor-module ([07450d5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/07450d564e5256b52478d2360a15c7f4cada2e4d))
59
+ * Merge branch 'fix-small-issues' into 'master' ([4b5165e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4b5165e9f8df9c7453a1b6b28f80c6d16b3cf5fc))
60
+
1
61
  ## [10.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v10.0.0...v10.0.1) (2022-08-09)
2
62
 
3
63
 
package/gatsby-config.js CHANGED
@@ -23,7 +23,6 @@ module.exports = {
23
23
  disable: true,
24
24
  },
25
25
  },
26
- `gatsby-plugin-react-helmet`,
27
26
  {
28
27
  resolve: `gatsby-plugin-manifest`,
29
28
  options: {
@@ -42,7 +41,7 @@ module.exports = {
42
41
  ],
43
42
  },
44
43
  },
45
- `gatsby-plugin-preact`,
44
+ // `gatsby-plugin-preact`,
46
45
  `gatsby-plugin-image`,
47
46
  ],
48
47
  };
@@ -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),
package/jest.config.js CHANGED
@@ -30,7 +30,7 @@ module.exports = {
30
30
  'src/components/app.js',
31
31
  // ''
32
32
  ],
33
- transformIgnorePatterns: [`node_modules/(?!(gatsby|gatsby-script)/)`],
33
+ transformIgnorePatterns: [`node_modules/(?!(gatsby|gatsby-script|gatsby-link)/)`],
34
34
  globals: {
35
35
  __PATH_PREFIX__: ``,
36
36
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "10.0.1",
3
+ "version": "11.0.1",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -29,14 +29,13 @@
29
29
  "dotenv": "^8.2.0",
30
30
  "eslint": "^7.20.0",
31
31
  "esm": "^3.2.25",
32
- "gatsby": "^4.17.0",
32
+ "gatsby": "^4.20.0",
33
33
  "gatsby-image": "^3.11.0",
34
34
  "gatsby-plugin-image": "^2.10.1",
35
35
  "gatsby-plugin-loadable-components-ssr": "^4.2.0",
36
36
  "gatsby-plugin-manifest": "^4.10.2",
37
37
  "gatsby-plugin-postcss": "^5.11.0",
38
- "gatsby-plugin-preact": "^6.10.1",
39
- "gatsby-plugin-react-helmet": "^5.10.0",
38
+ "gatsby-plugin-preact": "^6.20.0",
40
39
  "gatsby-plugin-sass": "^5.11.0",
41
40
  "gatsby-plugin-sharp": "^4.10.2",
42
41
  "gatsby-plugin-sitemap": "^5.10.2",
@@ -48,13 +47,12 @@
48
47
  "lodash": "^4.17.15",
49
48
  "normalize.css": "^8.0.1",
50
49
  "postcss": "^8.2.10",
51
- "preact": "^10.7.0",
52
- "preact-render-to-string": "^5.1.20",
50
+ "preact": "^10.10.2",
51
+ "preact-render-to-string": "^5.2.1",
53
52
  "prop-types": "15.7.2",
54
- "react": "^17.0.2",
55
- "react-dom": "^17.0.2",
53
+ "react": "^18.2.0",
54
+ "react-dom": "^18.2.0",
56
55
  "react-google-recaptcha": "^2.1.0",
57
- "react-helmet": "^6.0.0",
58
56
  "react-lazyload": "^3.2.0",
59
57
  "react-masonry-css": "^1.0.16",
60
58
  "sass": "^1.49.9"
@@ -69,12 +67,12 @@
69
67
  "@semantic-release/gitlab-config": "^8.0.0",
70
68
  "@semantic-release/npm": "^7.1.3",
71
69
  "@semantic-release/release-notes-generator": "^9.0.3",
72
- "@storybook/addon-actions": "^6.4.20",
73
- "@storybook/addon-essentials": "^6.4.20",
74
- "@storybook/addon-links": "^6.4.20",
75
- "@storybook/builder-webpack5": "^6.4.20",
76
- "@storybook/manager-webpack5": "^6.4.20",
77
- "@storybook/react": "^6.4.20",
70
+ "@storybook/addon-actions": "^6.5.10",
71
+ "@storybook/addon-essentials": "^6.5.10",
72
+ "@storybook/addon-links": "^6.5.10",
73
+ "@storybook/builder-webpack5": "^6.5.10",
74
+ "@storybook/manager-webpack5": "^6.5.10",
75
+ "@storybook/react": "^6.5.10",
78
76
  "@testing-library/jest-dom": "^5.16.3",
79
77
  "@testing-library/react": "^12.1.4",
80
78
  "babel-jest": "^26.6.3",
@@ -5,7 +5,7 @@ import loadable from '@loadable/component';
5
5
  import { globalHistory } from '@reach/router';
6
6
  import TranslationsProvider from '~context/TranslationsProvider';
7
7
  import Body from '~pages/body';
8
- import Head from '~organisms/head';
8
+ import MetaData from '~organisms/head';
9
9
 
10
10
  const App = ({ pageContext }) => {
11
11
  const { translations = {}, isTracker, isPreview } = pageContext;
@@ -61,20 +61,39 @@ const App = ({ pageContext }) => {
61
61
 
62
62
  return isTracker ? (
63
63
  <>
64
- <Head page={pageContext.page} siteInfo={pageContext.siteInfo} />
65
64
  <TrackerContent pageContext={pageContext} path={pageContext.page.path} />
66
65
  </>
67
66
  ) : (
68
67
  <TranslationsProvider value={{ translations }}>
69
- <Head
70
- page={isPreview ? previewContext.page : pageContext.page}
71
- siteInfo={isPreview ? previewContext.siteInfo : pageContext.siteInfo}
72
- />
73
68
  <Body pageContext={isPreview ? previewContext : pageContext} />
74
69
  </TranslationsProvider>
75
70
  );
76
71
  };
77
72
 
73
+ // eslint-disable-next-line react/prop-types
74
+ export function Head({ pageContext }) {
75
+ // eslint-disable-next-line react/prop-types
76
+ const { isPreview } = pageContext;
77
+
78
+ // eslint-disable-next-line react/prop-types
79
+ return isPreview ? <></> : <MetaData page={pageContext.page} siteInfo={pageContext.siteInfo} />;
80
+ }
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
+
78
97
  App.propTypes = {
79
98
  pageContext: PropTypes.shape({
80
99
  siteName: PropTypes.string,
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-nested-ternary */
1
2
  /* eslint-disable jsx-a11y/label-has-associated-control */
2
3
  /* eslint-disable react/no-danger */
3
4
  /* eslint-disable camelcase */
@@ -32,7 +33,7 @@ const Spotlights = ({ module, themeStyles = {} }) => {
32
33
  src={imageSrc}
33
34
  />
34
35
  )}
35
- <label>{item.label}</label>
36
+ {item?.label && <label>{item.label}</label>}
36
37
  {item.subtitle && <span>{item.subtitle}</span>}
37
38
  </>
38
39
  );
@@ -83,7 +84,7 @@ const Spotlights = ({ module, themeStyles = {} }) => {
83
84
  {mode === 'image_text' &&
84
85
  (item.link && item.link.value ? (
85
86
  <div className={styles.spotlightsTextCTA}>
86
- <div dangerouslySetInnerHTML={{ __html: item.text }} />
87
+ {item?.text && <div dangerouslySetInnerHTML={{ __html: item.text }} />}
87
88
  {item.link.type === 'external' ? (
88
89
  <a
89
90
  href={item.link.value}
@@ -109,7 +110,7 @@ const Spotlights = ({ module, themeStyles = {} }) => {
109
110
  )}
110
111
  </div>
111
112
  ) : (
112
- <div dangerouslySetInnerHTML={{ __html: item.text }} />
113
+ item.text && <div dangerouslySetInnerHTML={{ __html: item.text }} />
113
114
  ))}
114
115
  </li>
115
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
  }
@@ -9,7 +9,7 @@ const Main = ({ section = {}, pageContext = {} }) => {
9
9
  const { page } = pageContext;
10
10
  const SearchPage = page.path === 's' ? loadable(() => import(`~pages/search`)) : null;
11
11
  const HtmlSitemap = page.path === 'sitemap' ? loadable(() => import(`~atoms/sitemap`)) : null;
12
- const AuthorBox = page.author ? loadable(() => import(`~atoms/author-box`)) : null;
12
+ const AuthorBox = page.author_id ? loadable(() => import(`~atoms/author-box`)) : null;
13
13
  const NotFound = page?.path?.includes('404') ? loadable(() => import(`~atoms/not-found`)) : null;
14
14
 
15
15
  return (
@@ -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
- anchorListRef.current.scrollLeft =
82
- elementOffsetWidth + elementOffsetLeft + 5 - anchorContainerRef.current.offsetWidth;
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);
@@ -1,17 +1,19 @@
1
1
  /* eslint-disable no-nested-ternary */
2
- import React, { useState, useEffect } from 'react';
2
+ import React, { useState, useContext, useEffect } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
 
5
5
  import Pagination from '~molecules/pagination';
6
6
  import Items from '~atoms/archive/items';
7
7
  import Button from '~atoms/button';
8
8
  import { translate } from '~helpers/getters';
9
+ import { Context } from '~context/TranslationsProvider';
9
10
  import styles from './archive.module.scss';
10
11
 
11
12
  const Archive = ({ module, PaginationComponent, page, loadMore, gtmClass = '' }) => {
12
13
  const [moduleItems, setModuleItems] = useState([...module.items]);
13
14
  const updatedModule = { ...module };
14
15
  const hasLoadMore = module.pagination_type === 'load_more';
16
+ const { translations } = useContext(Context) || {};
15
17
 
16
18
  useEffect(() => {
17
19
  if (module.pagination_type === 'load_more') {
@@ -40,7 +42,7 @@ const Archive = ({ module, PaginationComponent, page, loadMore, gtmClass = '' })
40
42
  module.items.length > updatedModule.items.length && (
41
43
  <div className={styles.loadMoreWrapper}>
42
44
  <Button
43
- btnText={translate(page?.translations, 'load_more', 'Load More')}
45
+ btnText={translate(translations, 'load_more', 'Load More')}
44
46
  onClick={loadMoreHandler}
45
47
  isButton
46
48
  primaryColor
@@ -71,6 +73,7 @@ Archive.propTypes = {
71
73
  rootPath: PropTypes.string,
72
74
  currentPage: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
73
75
  numOfPages: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
76
+ // eslint-disable-next-line react/forbid-prop-types
74
77
  items: PropTypes.arrayOf(PropTypes.object),
75
78
  pagination_type: PropTypes.string,
76
79
  num_of_items: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
@@ -56,7 +56,7 @@ describe('Head Component', () => {
56
56
  expect(container).toBeTruthy();
57
57
  await waitFor(() => {
58
58
  expect(document.title).toEqual('my meta title');
59
- expect(document.documentElement.lang).toEqual('en');
59
+ // expect(document.documentElement.lang).toEqual('en');
60
60
  expect(document.querySelectorAll('link[rel=preconnect]')).toHaveLength(3);
61
61
  expect(document.getElementsByTagName('meta')[0].getAttribute('content')).toEqual(
62
62
  'my meta description'
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { Helmet } from 'react-helmet';
3
2
  import PropTypes from 'prop-types';
4
3
 
5
4
  import { schemaGenerator } from '~helpers/schema';
@@ -41,7 +40,7 @@ const Head = ({ page = {}, siteInfo }) => {
41
40
  const pageImage = getPageImage(page) ? getPageImage(page) : imagePrettyUrl(siteInfo?.site_logo);
42
41
  // When google re-indexes dev NSA and IRL, remove lines 28, 41, 42, 43 and process.env.GATSBY_ACTIVE_ENV !== 'development' from lines 24, 25, 27, 29, 43
43
42
  return (
44
- <Helmet>
43
+ <>
45
44
  <title>{page.meta_title}</title>
46
45
  <html lang={getLanguage(page.language)} />
47
46
  <meta name="description" content={page.meta_description} />
@@ -76,7 +75,7 @@ const Head = ({ page = {}, siteInfo }) => {
76
75
  </script>
77
76
  )
78
77
  )}
79
- </Helmet>
78
+ </>
80
79
  );
81
80
  };
82
81
 
@@ -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(`${PREVIEW_URL}?site_name=${siteName}&path=${page}&preview=1`, basicAuth)
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/sites/pages/sorted?site_name=${siteName}`;
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
- processCardsV2(moduleData, null, groupBy(getPageDataList(pagesNum), 'id', true));
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
 
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  // eslint-disable-next-line import/no-extraneous-dependencies
3
- import GatsbyLink from 'gatsby-link';
3
+ import { Link } from 'gatsby';
4
4
  import { navigate } from '@reach/router';
5
5
  import PropTypes from 'prop-types';
6
6
  import { previewFormat, previewPath, formatPath } from '~helpers/path';
7
7
 
8
- function Link({
8
+ function LinkCustom({
9
9
  children = <></>,
10
10
  to = '',
11
11
  activeClassName = '',
@@ -36,20 +36,20 @@ function Link({
36
36
  {children}
37
37
  </a>
38
38
  ) : (
39
- <GatsbyLink
39
+ <Link
40
40
  to={formatPath(to)}
41
41
  activeClassName={activeClassName}
42
42
  partiallyActive={partiallyActive}
43
43
  {...other}
44
44
  >
45
45
  {children}
46
- </GatsbyLink>
46
+ </Link>
47
47
  )}
48
48
  </>
49
49
  );
50
50
  }
51
51
 
52
- Link.propTypes = {
52
+ LinkCustom.propTypes = {
53
53
  to: PropTypes.string.isRequired,
54
54
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.element, PropTypes.any]),
55
55
  activeClassName: PropTypes.string,
@@ -57,4 +57,4 @@ Link.propTypes = {
57
57
  gtmClass: PropTypes.string,
58
58
  };
59
59
 
60
- export default Link;
60
+ export default LinkCustom;
package/storybook/.ci.yml CHANGED
@@ -16,9 +16,9 @@ Storybook Build:
16
16
  paths:
17
17
  - gatsby-theme/storybook/public/
18
18
  rules:
19
- - if: '$CI_COMMIT_BRANCH == "master" && $PIPELINE == "automated"'
20
- - if: '$CI_PIPELINE_SOURCE == "push" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" && $PIPELINE == "automated"'
21
- - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" && $PIPELINE == "automated"'
19
+ - if: '($CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "beta") && $PIPELINE == "automated"'
20
+ - if: '$CI_PIPELINE_SOURCE == "push" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "beta") && $PIPELINE == "automated"'
21
+ - if: '($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "beta") && $PIPELINE == "automated"'
22
22
  - if: '$PIPELINE == "development"'
23
23
 
24
24
  Storybook Deploy:
@@ -45,9 +45,9 @@ Storybook Deploy:
45
45
  - demo/node_modules/
46
46
  policy: pull
47
47
  rules:
48
- - if: '$CI_COMMIT_BRANCH == "master" && $PIPELINE == "automated"'
49
- - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" && $PIPELINE == "automated"'
48
+ - if: '($CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "beta") && $PIPELINE == "automated"'
49
+ - if: '($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "beta") && $PIPELINE == "automated"'
50
50
  when: manual
51
51
  allow_failure: true
52
- - if: '$CI_PIPELINE_SOURCE == "push" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" && $PIPELINE == "automated"'
52
+ - if: '$CI_PIPELINE_SOURCE == "push" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "beta") && $PIPELINE == "automated"'
53
53
  - if: '$PIPELINE == "development"'