gatsby-core-theme 40.0.3 → 40.0.5

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 CHANGED
@@ -1,3 +1,24 @@
1
+ ## [40.0.5](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v40.0.4...v40.0.5) (2024-10-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * align with the current master ([4c4284a](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/4c4284ab1196266b45f6f30acc84b6ac98c970f4))
7
+ * content module images with data size ([daa7c0f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/daa7c0f5ef0b9a241811ecf2bb0be6bf24d5c95e))
8
+ * new images path ([1b7bfb0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/1b7bfb0569fdd4040373c2a3cb0be7d21789a4b0))
9
+ * preview ([83d0c2f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/83d0c2f6610c926eae74030d12cd19581176a908))
10
+ * preview feature ([37c64ed](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/37c64ed1b1180e9f4258f7d654ace2dbd931f0aa))
11
+
12
+
13
+ * Merge branch 'tm-4346-content-modules' into 'master' ([5392b4f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/5392b4f946755c1219567afa463af6cb99615af1))
14
+
15
+ ## [40.0.4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v40.0.3...v40.0.4) (2024-10-15)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * preview feature ([e01820d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/e01820d1a5a543dd6209c78dd3826d9b13bf3ed4))
21
+
1
22
  ## [40.0.3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v40.0.2...v40.0.3) (2024-10-15)
2
23
 
3
24
 
package/gatsby-node.mjs CHANGED
@@ -248,19 +248,6 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
248
248
  // create every single page
249
249
  Object.keys(processed.site_markets).forEach((siteMarket) => {
250
250
  if (!processed.pages[siteMarket]['page']) processed.pages[siteMarket]['page'] = [];
251
- processed.pages[siteMarket]['page'].push({
252
- meta_title: 'Preview',
253
- relation_type: 'page',
254
- path: 'preview',
255
- template: 'default',
256
- meta_robots: ['noindex', 'nofollow'],
257
- sections: {
258
- main: { modules: [] },
259
- navigation: { modules: [] },
260
- sidebar: { modules: [] },
261
- footer: { modules: [] },
262
- },
263
- });
264
251
  let count = 0;
265
252
  Object.keys(processed.pages[siteMarket]).forEach((pageType) => {
266
253
  processed.pages[siteMarket][pageType].forEach((page) => {
@@ -271,10 +258,7 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
271
258
  const processedPage = page;
272
259
  processedPage.preconnect_links = preconnectLinks;
273
260
 
274
- siteSchema =
275
- page.path === 'preview'
276
- ? (page.siteSchema = Object.values(schemaData || {})[0])
277
- : schemaData[page['market_id']];
261
+ siteSchema = schemaData[page['market_id']];
278
262
  authors = response.authors;
279
263
 
280
264
  // siteInfo, siteSchema and authors are added to page for schemaGenerator()
@@ -329,8 +313,7 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
329
313
  path: `/${page.path}`,
330
314
  component: `${__dirname}/src/components/app-ssr.js`,
331
315
  context: {
332
- ...contextData,
333
- isPreview: page.path === 'preview',
316
+ ...contextData
334
317
  },
335
318
  });
336
319
  } else {
@@ -342,8 +325,7 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
342
325
  path: page.path.charAt(0) === '/' ? page.path : `/${page.path}`,
343
326
  component,
344
327
  context: {
345
- ...contextData,
346
- isPreview: page.path === 'preview',
328
+ ...contextData
347
329
  },
348
330
  });
349
331
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "40.0.3",
3
+ "version": "40.0.5",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -136,7 +136,9 @@ const AdminBar = ({ page, marketSections, menu }) => {
136
136
  )}
137
137
  </li>
138
138
  <li>
139
- <span className={`${styles.label} ${styles.labelBorder}`}>Footer Section</span>
139
+ <span className={`${styles.label} ${styles.labelBorder}`}>
140
+ Footer Section
141
+ </span>
140
142
  </li>
141
143
  {footerExtraFields && getFooterLinks(footerExtraFields)}
142
144
  </ul>
@@ -168,7 +170,12 @@ const AdminBar = ({ page, marketSections, menu }) => {
168
170
  className={`${styles.menuItem} ${styles.preview} ${
169
171
  !preview ? styles.previewOff : ""
170
172
  }`}
171
- href={!preview ? `/preview/?path=${page.path}&market_id=${page.market_id}` : `${page.path}`}
173
+ target={!preview ? "_blank" : ""}
174
+ href={
175
+ !preview
176
+ ? `/preview/?path=${page.path}&market_id=${page.market_id}`
177
+ : `/${page.path}`
178
+ }
172
179
  rel="noreferrer"
173
180
  >
174
181
  {preview ? "Preview Mode On" : "Preview Mode Off"}
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-restricted-syntax */
1
2
  import React from 'react';
2
3
  import { render, cleanup } from '@testing-library/react';
3
4
  import '@testing-library/jest-dom/extend-expect';
@@ -7,17 +8,17 @@ import ContentBox from '.';
7
8
  const info = [
8
9
  {
9
10
  title: 'Fully licensed casinos',
10
- image: '../../../images/content-1.png',
11
+ image: '/images/content-1.png',
11
12
  text: 'We only list and review fully licensed and legally operating casinos so you can be sure where you end up playing will be safe and secure.',
12
13
  },
13
14
  {
14
15
  title: 'Get the most for your money',
15
- image: '../../../images/content-2.png',
16
+ image: '/images/content-2.png',
16
17
  text: 'We list all the features the Casinos have to offer so you can make an educated decision about where to place your money for maximum gains!',
17
18
  },
18
19
  {
19
20
  title: 'Authenticly written articles',
20
- image: '../../../images/content-3.png',
21
+ image: '/images/content-3.png',
21
22
  text: 'All our Authors are professional writers with industry know-how, so you can depend on what we say is the truth!',
22
23
  },
23
24
  ];
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable no-unused-expressions */
2
+ /* eslint-disable no-restricted-syntax */
2
3
  import React from 'react';
3
4
  import { render, cleanup, fireEvent } from '@testing-library/react';
4
5
  import '@testing-library/jest-dom/extend-expect';
@@ -9,10 +10,10 @@ describe('Disclaimer Component', () => {
9
10
  // eslint-disable-next-line global-require
10
11
  const func = require('../../../helpers/device-detect');
11
12
  func.isNativeImageLazyLoadingSupported = jest.fn(() => true);
12
- const { container } = render(<Disclaimer dmcaImage="../../../../../images/dmca.png" />);
13
+ const { container } = render(<Disclaimer dmcaImage="/images/dmca.png" />);
13
14
 
14
15
  expect(container.querySelector('img')).toBeTruthy();
15
- expect(container.querySelector('img')).toHaveAttribute('src', '../../../../../images/dmca.png');
16
+ expect(container.querySelector('img')).toHaveAttribute('src', '/images/dmca.png');
16
17
  expect(container.querySelector('img')).toHaveAttribute('loading', 'eager');
17
18
 
18
19
  const Button = container.querySelector('a');
@@ -22,7 +22,7 @@ const CookieModal = ({
22
22
  title: '',
23
23
  path: '',
24
24
  },
25
- logo = '../../../../../images/logo.svg',
25
+ logo = '/images/logo.svg',
26
26
  templateTwo = false,
27
27
  hide,
28
28
  }) => {
@@ -47,7 +47,7 @@ const Footer = (props) => {
47
47
  const getFooterLogos = () => {
48
48
  let refactoredFooterLogos = { children: [] };
49
49
 
50
- if (footerLogos === null) {
50
+ if (footerLogos === null || !footerLogos.children) {
51
51
  refactoredFooterLogos = {
52
52
  children: [...page?.page?.responsibleGaming],
53
53
  };
@@ -79,8 +79,8 @@ const Footer = (props) => {
79
79
  asSeenOn: getExtraField(section?.extra_fields, 'as_seen_on'),
80
80
  gamblingText: getExtraField(section?.extra_fields, 'gambling_text'),
81
81
  socialIcons: getExtraField(section?.extra_fields, 'social_icons'),
82
- logo: '../../../images/logo.svg',
83
- dmcaImage: '../../../images/dmca.png',
82
+ logo: '/images/logo.svg',
83
+ dmcaImage: '/images/dmca.png',
84
84
  dmcaWidth: 100,
85
85
  dmcaHeight: 30,
86
86
  securityIcon: <Security />,
@@ -25,7 +25,7 @@ const TemplateOne = ({
25
25
  showCopyright,
26
26
  helpText,
27
27
  phoneNum,
28
- logo = '../../../../../images/logo.svg',
28
+ logo = '/images/logo.svg',
29
29
  dmcaImage,
30
30
  dmcaWidth,
31
31
  dmcaHeight,
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-restricted-syntax */
1
2
  import React from 'react';
2
3
  import { render, cleanup, waitFor } from '@testing-library/react';
3
4
  import '@testing-library/jest-dom/extend-expect';
@@ -63,7 +64,7 @@ beforeEach(() => {
63
64
  socialIcons,
64
65
  hasDisclaimer: true,
65
66
  showCopyright: true,
66
- logo: '../../../../../images/logo.svg',
67
+ logo: '/images/logo.svg',
67
68
  securityIcon: <Security />,
68
69
  helpText,
69
70
  phoneNum,
@@ -200,13 +201,13 @@ describe('Show Footer', () => {
200
201
  props = {
201
202
  ...props,
202
203
  showCopyright: false,
203
- dmcaImage: '../../../images/dmca.png',
204
+ dmcaImage: '/images/dmca.png',
204
205
  };
205
206
  const { container } = renderComponent(props);
206
207
  expect(container.querySelector('.logos > a').querySelector('img')).toBeTruthy();
207
208
  expect(container.querySelector('.logos > a').querySelector('img')).toHaveAttribute(
208
209
  'src',
209
- '../../../images/dmca.png'
210
+ '/images/dmca.png'
210
211
  );
211
212
  expect(container.querySelector('.logos > a').querySelector('img')).toHaveAttribute(
212
213
  'loading',
@@ -24,7 +24,7 @@ const TemplateThree = ({
24
24
  showCopyright,
25
25
  helpText,
26
26
  phoneNum,
27
- logo = '../../../../../images/logo.svg',
27
+ logo = '/images/logo.svg',
28
28
  dmcaImage,
29
29
  dmcaWidth,
30
30
  dmcaHeight,
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-restricted-syntax */
1
2
  import React from 'react';
2
3
  import { render, cleanup, waitFor } from '@testing-library/react';
3
4
  import '@testing-library/jest-dom/extend-expect';
@@ -77,7 +78,7 @@ beforeEach(() => {
77
78
  socialIcons,
78
79
  hasDisclaimer: true,
79
80
  showCopyright: true,
80
- logo: '../../../../../images/logo.svg',
81
+ logo: '/images/logo.svg',
81
82
  securityIcon: <Security />,
82
83
  helpText,
83
84
  phoneNum,
@@ -223,13 +224,13 @@ describe('Show template one', () => {
223
224
  props = {
224
225
  ...props,
225
226
  showCopyright: false,
226
- dmcaImage: '../../../../../images/dmca.png',
227
+ dmcaImage: '/images/dmca.png',
227
228
  };
228
229
  const { container } = renderComponent(props);
229
230
  expect(container.querySelector('.logos > a').querySelector('img')).toBeTruthy();
230
231
  expect(container.querySelector('.logos > a').querySelector('img')).toHaveAttribute(
231
232
  'src',
232
- '../../../../../images/dmca.png'
233
+ '/images/dmca.png'
233
234
  );
234
235
  expect(container.querySelector('.logos > a').querySelector('img')).toHaveAttribute(
235
236
  'loading',
@@ -23,7 +23,7 @@ const TemplateTwo = ({
23
23
  showCopyright,
24
24
  helpText,
25
25
  phoneNum,
26
- logo = '../../../../../images/logo.svg',
26
+ logo = '/images/logo.svg',
27
27
  dmcaImage,
28
28
  dmcaWidth,
29
29
  dmcaHeight,
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-restricted-syntax */
1
2
  import React from 'react';
2
3
  import { render, cleanup, waitFor } from '@testing-library/react';
3
4
  import '@testing-library/jest-dom/extend-expect';
@@ -76,7 +77,7 @@ beforeEach(() => {
76
77
  socialIcons,
77
78
  hasDisclaimer: true,
78
79
  showCopyright: true,
79
- logo: '../../../../../images/logo.svg',
80
+ logo: '/images/logo.svg',
80
81
  securityIcon: <Security />,
81
82
  helpText,
82
83
  phoneNum,
@@ -222,13 +223,13 @@ describe('Show template one', () => {
222
223
  props = {
223
224
  ...props,
224
225
  showCopyright: false,
225
- dmcaImage: '../../../../../images/dmca.png',
226
+ dmcaImage: '/images/dmca.png',
226
227
  };
227
228
  const { container } = renderComponent(props);
228
229
  expect(container.querySelector('.logos > a').querySelector('img')).toBeTruthy();
229
230
  expect(container.querySelector('.logos > a').querySelector('img')).toHaveAttribute(
230
231
  'src',
231
- '../../../../../images/dmca.png'
232
+ '/images/dmca.png'
232
233
  );
233
234
  expect(container.querySelector('.logos > a').querySelector('img')).toHaveAttribute(
234
235
  'loading',
@@ -14,7 +14,7 @@ const CookieConsent = ({
14
14
  settingsCookie,
15
15
  children,
16
16
  cookieName = 'CookieConsent',
17
- logo = '../../../../../images/logo.svg',
17
+ logo = '/images/logo.svg',
18
18
  icon = null,
19
19
  }) => {
20
20
  const [showModal, setShowModal] = useState(false);
@@ -25,7 +25,7 @@ const Navigation = ({
25
25
  mobileAnimation = "collapseFull",
26
26
  stopScrollOnOpen = true,
27
27
  canOpenAllSubMenus = true,
28
- logo = "../../../../../images/logo.svg",
28
+ logo = "/images/logo.svg",
29
29
  logoWidth = 200,
30
30
  logoHeight = 31,
31
31
  searchIcon = null,
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable react-hooks/rules-of-hooks */
2
2
  /* eslint-disable react/prop-types */
3
3
  /* eslint-disable react/forbid-prop-types */
4
+ /* eslint-disable no-console */
4
5
  import React, { useEffect } from 'react';
5
6
  import PropTypes from 'prop-types';
6
7
  import Button from '~atoms/button/button';
@@ -19,7 +20,7 @@ const Tracker = ({
19
20
  bgImage = '',
20
21
  bgVideo = '',
21
22
  redirectTimer = 3000,
22
- logo = '../../../../../images/logo.svg',
23
+ logo = '/images/logo.svg',
23
24
  counter = false,
24
25
  isStory = false,
25
26
  operatorLogo = false,
@@ -17,7 +17,7 @@ export default function TrackerGeo({
17
17
  bgImage = '',
18
18
  bgVideo = '',
19
19
  redirectTimer = 5000,
20
- logo = '../../../../../images/logo.svg',
20
+ logo = '/images/logo.svg',
21
21
  counter = false,
22
22
  operatorLogo = false,
23
23
  operatorLogoWidth = 80,
@@ -26,17 +26,38 @@ const processImageNode = (node, moduleWidth = 960, loading) => {
26
26
  stylesClass = 'alignRight';
27
27
  }
28
28
 
29
- const imgWidth = node.attribs.width
30
- ? node.attribs.width > moduleWidth
31
- ? moduleWidth
32
- : node.attribs.width.replace('px', '')
33
- : getValueFromStyle(node?.attribs?.style, 'width') || '';
34
-
35
- const imgHeight = node.attribs.height
36
- ? node.attribs.height === 'auto'
37
- ? '298'
38
- : node.attribs.height.replace('px', '')
39
- : getValueFromStyle(node?.attribs?.style, 'height') || '';
29
+ let imgWidth
30
+
31
+ if (node.attribs.width) {
32
+ imgWidth =
33
+ node.attribs.width > moduleWidth
34
+ ? moduleWidth
35
+ : node.attribs.width.replace('px', '')
36
+ } else if (node?.attribs['data-width']) {
37
+ imgWidth =
38
+ node?.attribs['data-width'] > moduleWidth
39
+ ? moduleWidth
40
+ : node?.attribs['data-width']?.replace('px', '')
41
+ } else {
42
+ imgWidth = getValueFromStyle(node?.attribs?.style, 'width') || ''
43
+ }
44
+
45
+ let imgHeight
46
+
47
+ if (node.attribs.height) {
48
+ imgHeight =
49
+ node.attribs.height === 'auto'
50
+ ? '298'
51
+ : node.attribs.height.replace('px', '')
52
+ } else if (node.attribs['data-height']) {
53
+ imgHeight =
54
+ node.attribs['data-height'] === 'auto'
55
+ ? '298'
56
+ : node.attribs['data-height'].replace('px', '')
57
+ } else {
58
+ imgHeight = getValueFromStyle(node?.attribs?.style, 'height') || ''
59
+ }
60
+
40
61
 
41
62
  const lazyProps = {
42
63
  src: parseContentImageUrl(node.attribs.src, imgWidth, imgHeight),
@@ -8,7 +8,7 @@ import {getData} from '~helpers/api'
8
8
  import processor from "./processor/index.mjs";
9
9
  import { fetchSiteSettings } from './fetch-site-settings.mjs';
10
10
 
11
- export async function getAPIData(page, url, preview) {
11
+ export async function getAPIData(page, url, headers, preview) {
12
12
  if (preview) {
13
13
  try {
14
14
  const siteName = process.env.GATSBY_SITE_NAME;
@@ -37,7 +37,6 @@ const AppSSR = ({serverData }) => {
37
37
  // eslint-disable-next-line react-hooks/exhaustive-deps
38
38
  }, []);
39
39
 
40
-
41
40
  return (
42
41
  <>
43
42
  <MainProvider
@@ -88,8 +87,7 @@ export async function getServerData(props) {
88
87
  // eslint-disable-next-line no-shadow
89
88
  const { pageContext, url, headers } = props;
90
89
  let res = "";
91
- const preview = pageContext.isPreview;
92
- res = await getAPIData(pageContext.page, url, headers, preview);
90
+ res = await getAPIData(pageContext.page, url, headers, true);
93
91
 
94
92
  return res;
95
93
  }