gatsby-core-theme 37.0.0 → 37.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
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [37.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v37.0.1...v37.0.2) (2024-08-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* lazy loading creating delayed menu styling in highly populated menus ([470f7b2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/470f7b2caac43e8ee6b8e743a9ef2f7a060ab636))
|
|
7
|
+
|
|
8
|
+
## [37.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v37.0.0...v37.0.1) (2024-08-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* import lazily recaptcha ([828ed0b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/828ed0b62e061141d6fe61bef8d9da0916276bbe))
|
|
14
|
+
* preview function ([0f6e606](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0f6e6069e925f4465a36c1466ce307bf456abfe1))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
* Merge branch 'update-recaptcha' into 'master' ([846e886](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/846e886ac8ebcc927fef7824895437d6a74e167f))
|
|
18
|
+
|
|
1
19
|
# [37.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v36.0.4...v37.0.0) (2024-08-23)
|
|
2
20
|
|
|
3
21
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/* eslint-disable arrow-body-style */
|
|
2
|
-
import React, { useContext,
|
|
2
|
+
import React, { useContext, useRef } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import
|
|
4
|
+
import MegaItems from 'gatsby-core-theme/src/components/atoms/menu/mega-items';
|
|
5
|
+
import Items from 'gatsby-core-theme/src/components/atoms/menu/items';
|
|
5
6
|
|
|
7
|
+
import MenuIcon from "~atoms/menu/menu-icon";
|
|
6
8
|
import { NavigationContext } from "~organisms/navigation/navigationContext";
|
|
7
9
|
|
|
8
10
|
import styles from "./menu.module.scss";
|
|
@@ -22,9 +24,6 @@ const Menu = ({
|
|
|
22
24
|
enableMegaMenu = false
|
|
23
25
|
}) => {
|
|
24
26
|
let menuObject;
|
|
25
|
-
const Items = enableMegaMenu
|
|
26
|
-
? lazy(() => import('gatsby-core-theme/src/components/atoms/menu/mega-items'))
|
|
27
|
-
: lazy(() => import('gatsby-core-theme/src/components/atoms/menu/items'));
|
|
28
27
|
|
|
29
28
|
const menuListRef = useRef(React.createRef());
|
|
30
29
|
const toplistModule = section?.modules?.find(
|
|
@@ -68,11 +67,21 @@ const Menu = ({
|
|
|
68
67
|
} ${styles[customStyles] || ""}`}
|
|
69
68
|
role="menu"
|
|
70
69
|
>
|
|
71
|
-
{menuObject &&
|
|
70
|
+
{menuObject &&
|
|
72
71
|
menuObject.children.map((child) => {
|
|
73
72
|
const level = 1;
|
|
74
73
|
return (
|
|
75
|
-
|
|
74
|
+
enableMegaMenu ? (
|
|
75
|
+
<MegaItems
|
|
76
|
+
toplist={toplistModule}
|
|
77
|
+
menuListRef={menuListRef}
|
|
78
|
+
gtmClass={gtmClass}
|
|
79
|
+
key={keygen()}
|
|
80
|
+
item={child}
|
|
81
|
+
canOpenAllSubMenus={canOpenAllSubMenus}
|
|
82
|
+
level={level}
|
|
83
|
+
/>
|
|
84
|
+
) : (
|
|
76
85
|
<Items
|
|
77
86
|
toplist={toplistModule}
|
|
78
87
|
menuListRef={menuListRef}
|
|
@@ -82,7 +91,7 @@ const Menu = ({
|
|
|
82
91
|
canOpenAllSubMenus={canOpenAllSubMenus}
|
|
83
92
|
level={level}
|
|
84
93
|
/>
|
|
85
|
-
|
|
94
|
+
)
|
|
86
95
|
);
|
|
87
96
|
})}
|
|
88
97
|
</ul>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
-
import React, { useState, useRef } from
|
|
2
|
+
import React, { lazy, useState, useRef, Suspense } from "react";
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import ReCAPTCHA from 'react-google-recaptcha';
|
|
5
4
|
import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
|
|
6
5
|
import { contactUsForm } from '../../../constants/forms';
|
|
7
6
|
import getField from './fields';
|
|
8
7
|
import styles from './form.module.scss';
|
|
9
8
|
import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
10
9
|
|
|
10
|
+
const ReCAPTCHA = lazy(() => import("react-google-recaptcha"));
|
|
11
|
+
|
|
11
12
|
const FormComponent = ({
|
|
12
13
|
formOptions = Object.values(contactUsForm)[0] || {},
|
|
13
14
|
successMessage = 'Form has sent successfully',
|
|
@@ -162,6 +163,7 @@ const FormComponent = ({
|
|
|
162
163
|
);
|
|
163
164
|
})}
|
|
164
165
|
{formOptions.hasReCAPTCHA && (
|
|
166
|
+
<Suspense fallback={<div>Loading ReCAPTCHA...</div>}>
|
|
165
167
|
<div
|
|
166
168
|
className={`${styles.recaptcha || ''} ${
|
|
167
169
|
(!state.isValid && elements.gRecaptchaResponse === '' && styles.invalid) || ''
|
|
@@ -185,6 +187,7 @@ const FormComponent = ({
|
|
|
185
187
|
</span>
|
|
186
188
|
)}
|
|
187
189
|
</div>
|
|
190
|
+
</Suspense>
|
|
188
191
|
)}
|
|
189
192
|
{hasButton && (
|
|
190
193
|
<button disabled={state.loading} className={styles.formButton || ''} type="submit">
|
package/src/helpers/api.mjs
CHANGED
|
@@ -19,7 +19,7 @@ export async function getPreview(siteName, page = null, marketId, themeOptions)
|
|
|
19
19
|
.then((response) => {
|
|
20
20
|
console.log(response);
|
|
21
21
|
const pagePreview = response.data.result.pages.preview;
|
|
22
|
-
const processed = processor.run(response.data.result, themeOptions);
|
|
22
|
+
const processed = processor.run(response.data.result, themeOptions, null, null, true);
|
|
23
23
|
|
|
24
24
|
const { path } = processed.pages[pagePreview.market].preview[0];
|
|
25
25
|
|
|
@@ -100,7 +100,7 @@ export function transform(response) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
const savedModules = {};
|
|
103
|
-
export function processSections(sections, skipPost = false, page, translations, markets, siteName, data) {
|
|
103
|
+
export function processSections(sections, skipPost = false, page, translations, markets, siteName, data, isPreview) {
|
|
104
104
|
// pagedId we will use it just on operator review pages
|
|
105
105
|
const pageId = page ? page.id : null;
|
|
106
106
|
const relationData = page && page.relation;
|
|
@@ -136,6 +136,7 @@ export function processSections(sections, skipPost = false, page, translations,
|
|
|
136
136
|
{...relationData, siteName, pageTitle: page?.title},
|
|
137
137
|
markets,
|
|
138
138
|
data,
|
|
139
|
+
isPreview
|
|
139
140
|
);
|
|
140
141
|
|
|
141
142
|
sections[sectionKey].modules[key] = module;
|
|
@@ -239,7 +240,7 @@ function updatePlaceholders(page, data, translationsData) {
|
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
export default {
|
|
242
|
-
run(data, themeOptions, fs, translationsData) {
|
|
243
|
+
run(data, themeOptions, fs, translationsData, isPreview = false) {
|
|
243
244
|
const start = new Date();
|
|
244
245
|
const transformedPages = transform(data);
|
|
245
246
|
const allResponsibleGaming = data.relations.responsible_gamings || null;
|
|
@@ -487,7 +488,9 @@ export default {
|
|
|
487
488
|
null,
|
|
488
489
|
translationsData ? translationsData[0] : {},
|
|
489
490
|
data.site_markets,
|
|
490
|
-
data.general.site_name
|
|
491
|
+
data.general.site_name,
|
|
492
|
+
null,
|
|
493
|
+
isPreview
|
|
491
494
|
);
|
|
492
495
|
}
|
|
493
496
|
|
|
@@ -534,7 +537,8 @@ export default {
|
|
|
534
537
|
translationsData ? translationsData[page.language] : {},
|
|
535
538
|
data.site_markets,
|
|
536
539
|
data.general.site_name,
|
|
537
|
-
data
|
|
540
|
+
data,
|
|
541
|
+
isPreview
|
|
538
542
|
),
|
|
539
543
|
});
|
|
540
544
|
}
|
|
@@ -102,7 +102,7 @@ export function filterOperators(pages, selectedProviders, selectedTypes) {
|
|
|
102
102
|
return filterInactiveOperators(pagesFiltered);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
export function processCardsV2(module, pagesCloned, pagesMappedById, pageId) {
|
|
105
|
+
export function processCardsV2(module, pagesCloned, pagesMappedById, pageId, isPreview) {
|
|
106
106
|
const cardType = module.cards_page_type;
|
|
107
107
|
const pageTemplateId = module.cards_page_type_id;
|
|
108
108
|
const sortType = module.cards_selector_filters_sort_by;
|
|
@@ -136,9 +136,12 @@ export function processCardsV2(module, pagesCloned, pagesMappedById, pageId) {
|
|
|
136
136
|
|
|
137
137
|
const allFilters = [cardType, pageTemplateId, selectedAuthors, selectedReviewer, selectedCategories, moduleSelectedProviders, moduleSelectedCategories, moduleSelectedTypes];
|
|
138
138
|
const u8 = new Uint8Array(allFilters);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
let b64 = '';
|
|
140
|
+
if(!isPreview) {
|
|
141
|
+
b64 = Buffer.from(u8).toString('base64');
|
|
142
|
+
} else {
|
|
143
|
+
b64 = (Math.random() + 1).toString(36).substring(7)
|
|
144
|
+
}
|
|
142
145
|
|
|
143
146
|
if (cardType) {
|
|
144
147
|
// Get all pages by the selected page type
|
|
@@ -162,7 +165,7 @@ export function processCardsV2(module, pagesCloned, pagesMappedById, pageId) {
|
|
|
162
165
|
if (pagesList.length > 0) {
|
|
163
166
|
|
|
164
167
|
if(!cardItems[b64]) {
|
|
165
|
-
|
|
168
|
+
const pagesFilteredByAuthor = filterPages(pagesList, selectedAuthors, 'author_id');
|
|
166
169
|
|
|
167
170
|
// Filter by reviewer
|
|
168
171
|
const pagesFilteredByReviewer = filterPages(
|
|
@@ -249,15 +252,6 @@ export function processBonus(module, relations) {
|
|
|
249
252
|
);
|
|
250
253
|
}
|
|
251
254
|
|
|
252
|
-
export function processArchiveModule(module, pages) {
|
|
253
|
-
const modelType = module.model_type;
|
|
254
|
-
const limit = pages[modelType].length > 9 ? 9 : pages[modelType].length;
|
|
255
|
-
const items = cloneDeep(pages[modelType].slice(0, limit));
|
|
256
|
-
module.items = items.map((item) => clonePageForCards(item));
|
|
257
|
-
module.currentPage = 1;
|
|
258
|
-
module.numOfPages = 1;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
255
|
export function processTopListModule(module, relations, pages, markets, data) {
|
|
262
256
|
module.items = module.items.map((listItem) => {
|
|
263
257
|
|
|
@@ -328,6 +322,7 @@ export function processModule(
|
|
|
328
322
|
relationData,
|
|
329
323
|
markets,
|
|
330
324
|
data,
|
|
325
|
+
isPreview
|
|
331
326
|
) {
|
|
332
327
|
module.module_title =
|
|
333
328
|
module.module_title &&
|
|
@@ -336,7 +331,7 @@ export function processModule(
|
|
|
336
331
|
module.title && generatePlaceholderString(module.title, translations, relationData);
|
|
337
332
|
|
|
338
333
|
// See more link
|
|
339
|
-
if (module.see_more_link?.value) {
|
|
334
|
+
if (module.see_more_link?.value && pagesMappedById[module.see_more_link.value]?.path) {
|
|
340
335
|
module.see_more_link.path =
|
|
341
336
|
module.see_more_link?.type === 'page'
|
|
342
337
|
? pagesMappedById[module.see_more_link.value].path
|
|
@@ -344,13 +339,11 @@ export function processModule(
|
|
|
344
339
|
}
|
|
345
340
|
|
|
346
341
|
if (module.name === 'cards_v2') {
|
|
347
|
-
processCardsV2(module, pagesCloned, pagesMappedById, pageId);
|
|
342
|
+
processCardsV2(module, pagesCloned, pagesMappedById, pageId, isPreview);
|
|
348
343
|
} else if (module.name === 'content') {
|
|
349
344
|
processContentModule(module, translations, relationData);
|
|
350
345
|
} else if (module.name === 'bonus') {
|
|
351
346
|
processBonus(module, relations);
|
|
352
|
-
// } else if (module.name === 'archive' && previewMode) {
|
|
353
|
-
// processArchiveModule(module, pages);
|
|
354
347
|
} else if (module.name === 'top_list') {
|
|
355
348
|
processTopListModule(module, relations, pages, markets, data);
|
|
356
349
|
} else if (module.name === 'menu' && menus && menus[module.menu_id]) {
|