gatsby-core-theme 44.10.11 → 44.10.12-beta.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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [44.10.12-beta.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.10.11...v44.10.12-beta.1) (2025-12-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fix error ([2339ad7](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2339ad741f0c581fd71ed63e8d894d7b1340f18d))
|
|
7
|
+
* inp optimization ([df31d2c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/df31d2c071c5496c57a7b7db6a2da69e74ebda8b))
|
|
8
|
+
* test partytown ([c7cd7c9](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c7cd7c9a910c8b2d05fbd3b566add043bb824651))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* Merge remote-tracking branch 'origin/EN-279-INP-optimization' into beta ([b477a63](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b477a635e85b47f4c43043d366da4c8bd613e251))
|
|
12
|
+
* Merge remote-tracking branch 'origin/master' into beta ([924dd7b](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/924dd7b43084d71fe89f549a6d47caf17ad5fec8))
|
|
13
|
+
* Merge branch 'partytown-test' into 'beta' ([c2f1784](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c2f1784e77b298c77a8dfe6f4c6e029c2aa09f4f))
|
|
14
|
+
|
|
1
15
|
## [44.10.11](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.10.10...v44.10.11) (2025-12-24)
|
|
2
16
|
|
|
3
17
|
|
package/gatsby-browser.js
CHANGED
|
@@ -16,148 +16,6 @@ require('./src/styles/base/_reset.scss');
|
|
|
16
16
|
require('./src/styles/base/_spacing.scss');
|
|
17
17
|
require('./src/styles/layouts/_grid.scss');
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
window.gtmDidInit = true; // flag to ensure script does not get added to DOM more than once.
|
|
25
|
-
const trackingLink = `https://www.googletagmanager.com/gtm.js?id=${process.env.GA_TRACKING_ID}`;
|
|
26
|
-
|
|
27
|
-
const script = document.createElement('script');
|
|
28
|
-
script.type = 'text/javascript';
|
|
29
|
-
script.async = true;
|
|
30
|
-
script.src = trackingLink;
|
|
31
|
-
|
|
32
|
-
script.onload = () => {
|
|
33
|
-
// eslint-disable-next-line no-undef
|
|
34
|
-
dataLayer.push({
|
|
35
|
-
// ensure PageViews are always tracked
|
|
36
|
-
event: 'gtm.js',
|
|
37
|
-
'gtm.start': new Date().getTime(),
|
|
38
|
-
'gtm.uniqueEventId': 0,
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
document.head.appendChild(script);
|
|
42
|
-
|
|
43
|
-
const noscript = document.createElement('noscript');
|
|
44
|
-
const iframe = document.createElement('iframe');
|
|
45
|
-
iframe.src = trackingLink;
|
|
46
|
-
iframe.style.display = 'none';
|
|
47
|
-
iframe.style.visibility = 'hidden';
|
|
48
|
-
iframe.height = 0;
|
|
49
|
-
iframe.width = 0;
|
|
50
|
-
noscript.innerHTML += iframe.outerHTML;
|
|
51
|
-
document.body.appendChild(noscript);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function optinMonster() {
|
|
55
|
-
const script = document.createElement('script');
|
|
56
|
-
script.id = 'optin-monstr';
|
|
57
|
-
script.setAttribute('data-user', process.env.OPTINMONSTR_USER);
|
|
58
|
-
script.setAttribute('data-account', process.env.OPTINMONSTR_ACC);
|
|
59
|
-
script.src = 'https://a.omappapi.com/app/js/api.min.js';
|
|
60
|
-
script.async = true;
|
|
61
|
-
document.head.appendChild(script);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const loadFacebookPixel = () => {
|
|
66
|
-
!(function (f, b, e, v, n, t, s) {
|
|
67
|
-
// eslint-disable-next-line no-multi-assign
|
|
68
|
-
if (f.fbq) return;
|
|
69
|
-
n = f.fbq = function () {
|
|
70
|
-
n.callMethod
|
|
71
|
-
? // eslint-disable-next-line prefer-spread, prefer-rest-params
|
|
72
|
-
n.callMethod.apply(n, arguments)
|
|
73
|
-
: n.queue.push(arguments);
|
|
74
|
-
};
|
|
75
|
-
if (!f._fbq) f._fbq = n;
|
|
76
|
-
n.push = n;
|
|
77
|
-
n.loaded = !0;
|
|
78
|
-
n.version = '2.0';
|
|
79
|
-
n.queue = [];
|
|
80
|
-
t = b.createElement(e);
|
|
81
|
-
t.async = !0;
|
|
82
|
-
t.id = 'pixel-code';
|
|
83
|
-
t.src = v;
|
|
84
|
-
s = b.getElementsByTagName(e)[0];
|
|
85
|
-
s.parentNode.insertBefore(t, s);
|
|
86
|
-
})(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const microsoftAdvertising = () => {
|
|
90
|
-
(function (w, d, t, r, u) {
|
|
91
|
-
var f, n, i;
|
|
92
|
-
(w[u] = w[u] || []),
|
|
93
|
-
(f = function () {
|
|
94
|
-
var o = { ti: '187106455', enableAutoSpaTracking: true };
|
|
95
|
-
(o.q = w[u]), (w[u] = new UET(o)), w[u].push('pageLoad');
|
|
96
|
-
}),
|
|
97
|
-
(n = d.createElement(t)),
|
|
98
|
-
(n.src = r),
|
|
99
|
-
(n.async = 1),
|
|
100
|
-
(n.id = 'microsoft-code'),
|
|
101
|
-
(n.onload = n.onreadystatechange =
|
|
102
|
-
function () {
|
|
103
|
-
var s = this.readyState;
|
|
104
|
-
(s && s !== 'loaded' && s !== 'complete') ||
|
|
105
|
-
(f(), (n.onload = n.onreadystatechange = null));
|
|
106
|
-
}),
|
|
107
|
-
(i = d.getElementsByTagName(t)[0]),
|
|
108
|
-
i.parentNode.insertBefore(n, i);
|
|
109
|
-
})(window, document, 'script', '//bat.bing.com/bat.js', 'uetq');
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const piguard = () =>{
|
|
113
|
-
if (window.loadGTM === false) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const script = document.createElement('script');
|
|
118
|
-
script.id = 'piguard';
|
|
119
|
-
script.src = `https://pg.${process.env.GATSBY_SITE_NAME}/analytics.js?tid=PP-${process.env.PIGUARD_ID}`;
|
|
120
|
-
script.async = true;
|
|
121
|
-
document.head.appendChild(script);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function scrollEvent(event) {
|
|
125
|
-
initGTM();
|
|
126
|
-
|
|
127
|
-
if (!document.getElementById('piguard') && process.env.ENABLE_PIGUARD === 'true') {
|
|
128
|
-
piguard();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (process.env.ENABLE_MICROSOFT === 'true' && !document.getElementById('microsoft-code'))
|
|
132
|
-
microsoftAdvertising();
|
|
133
|
-
|
|
134
|
-
if (process.env.ENABLE_OPTINMONSTR === 'true' && !document.getElementById('optin-monstr'))
|
|
135
|
-
optinMonster();
|
|
136
|
-
if (process.env.ENABLE_PIXEL === 'true' && !document.getElementById('pixel-code')) {
|
|
137
|
-
if (
|
|
138
|
-
typeof window !== 'undefined' &&
|
|
139
|
-
window.location.pathname !== process.env.PAGE_EXCLUDE_PIXEL
|
|
140
|
-
) {
|
|
141
|
-
loadFacebookPixel();
|
|
142
|
-
|
|
143
|
-
fbq('init', process.env.PIXEL_ID);
|
|
144
|
-
|
|
145
|
-
// Initialize and track the PageView event
|
|
146
|
-
fbq('track', 'PageView');
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (event) {
|
|
151
|
-
event.currentTarget.removeEventListener(event.type, scrollEvent); // remove the event listener that got triggered
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
exports.onClientEntry = () => {
|
|
156
|
-
if (process.env.PPC === 'true') {
|
|
157
|
-
scrollEvent(null);
|
|
158
|
-
} else {
|
|
159
|
-
document.addEventListener('scroll', scrollEvent, { passive: true });
|
|
160
|
-
document.addEventListener('mousemove', scrollEvent, { passive: true });
|
|
161
|
-
document.addEventListener('touchstart', scrollEvent, { passive: true });
|
|
162
|
-
}
|
|
163
|
-
};
|
|
19
|
+
// Note: GTM, Facebook Pixel, Microsoft Advertising, OptinMonster, and Piguard
|
|
20
|
+
// are now loaded via Partytown in gatsby-ssr.js for better performance.
|
|
21
|
+
// They run in a web worker instead of the main thread.
|
package/gatsby-node.mjs
CHANGED
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
import loadash from "lodash/index.js";
|
|
10
10
|
import chalk from "chalk";
|
|
11
11
|
import fs from "fs";
|
|
12
|
-
import { dirname } from "path";
|
|
12
|
+
import nodePath, { dirname } from "path";
|
|
13
13
|
import { fileURLToPath } from "url";
|
|
14
|
+
import { copyLibFiles } from "@qwik.dev/partytown/utils";
|
|
14
15
|
import keygen from "./src/helpers/keygen.mjs";
|
|
15
16
|
import { getTranslations } from "./src/services/api.mjs";
|
|
16
17
|
import { fetchSiteSettings } from "./src/services/fetch.mjs";
|
|
@@ -357,6 +358,10 @@ export const onCreatePage = async ({ page, actions }) => {
|
|
|
357
358
|
};
|
|
358
359
|
|
|
359
360
|
export const onPreBootstrap = async (options, themeOptions) => {
|
|
361
|
+
// Copy Partytown library files to static directory
|
|
362
|
+
console.log(chalk.magenta("info") + chalk.whiteBright(" copying Partytown library files"));
|
|
363
|
+
await copyLibFiles(nodePath.join(__dirname, "static", "~partytown"));
|
|
364
|
+
|
|
360
365
|
// Get Data from Hercules
|
|
361
366
|
({
|
|
362
367
|
siteSettingsData,
|
package/gatsby-ssr.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
2
|
+
/* eslint-disable react/jsx-filename-extension */
|
|
3
|
+
import React from "react";
|
|
4
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
|
+
import { Partytown } from "@qwik.dev/partytown/react";
|
|
6
|
+
|
|
7
|
+
export const onRenderBody = ({ setHeadComponents, setPreBodyComponents }) => {
|
|
8
|
+
const gaTrackingId = process.env.GA_TRACKING_ID;
|
|
9
|
+
const enableGTM = process.env.DISABLE_GTM !== "true";
|
|
10
|
+
const enablePixel = process.env.ENABLE_PIXEL === "true";
|
|
11
|
+
const pixelId = process.env.PIXEL_ID;
|
|
12
|
+
const enableMicrosoft = process.env.ENABLE_MICROSOFT === "true";
|
|
13
|
+
const enableOptinMonster = process.env.ENABLE_OPTINMONSTR === "true";
|
|
14
|
+
const optinMonsterUser = process.env.OPTINMONSTR_USER;
|
|
15
|
+
const optinMonsterAcc = process.env.OPTINMONSTR_ACC;
|
|
16
|
+
const enablePiguard = process.env.ENABLE_PIGUARD === "true";
|
|
17
|
+
const piguardId = process.env.PIGUARD_ID;
|
|
18
|
+
const siteName = process.env.GATSBY_SITE_NAME;
|
|
19
|
+
|
|
20
|
+
// Configure Partytown with forwarding for all analytics
|
|
21
|
+
const forwardConfig = ["dataLayer.push"];
|
|
22
|
+
|
|
23
|
+
if (enablePixel) {
|
|
24
|
+
forwardConfig.push("fbq");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (enableMicrosoft) {
|
|
28
|
+
forwardConfig.push("uetq.push");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const headComponents = [
|
|
32
|
+
<Partytown
|
|
33
|
+
key="partytown"
|
|
34
|
+
debug={process.env.NODE_ENV === "development"}
|
|
35
|
+
forward={forwardConfig}
|
|
36
|
+
/>,
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
// Add Google Tag Manager script with Partytown
|
|
40
|
+
if (enableGTM && gaTrackingId) {
|
|
41
|
+
headComponents.push(
|
|
42
|
+
<script
|
|
43
|
+
key="gtm-init"
|
|
44
|
+
type="text/partytown"
|
|
45
|
+
dangerouslySetInnerHTML={{
|
|
46
|
+
__html: `
|
|
47
|
+
window.dataLayer = window.dataLayer || [];
|
|
48
|
+
window.dataLayer.push({
|
|
49
|
+
'gtm.start': new Date().getTime(),
|
|
50
|
+
event: 'gtm.js'
|
|
51
|
+
});
|
|
52
|
+
`,
|
|
53
|
+
}}
|
|
54
|
+
/>,
|
|
55
|
+
<script
|
|
56
|
+
key="gtm"
|
|
57
|
+
type="text/partytown"
|
|
58
|
+
src={`https://www.googletagmanager.com/gtm.js?id=${gaTrackingId}`}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Add Facebook Pixel script with Partytown
|
|
64
|
+
if (enablePixel && pixelId) {
|
|
65
|
+
headComponents.push(
|
|
66
|
+
<script
|
|
67
|
+
key="fb-pixel"
|
|
68
|
+
type="text/partytown"
|
|
69
|
+
dangerouslySetInnerHTML={{
|
|
70
|
+
__html: `
|
|
71
|
+
!function(f,b,e,v,n,t,s)
|
|
72
|
+
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
|
73
|
+
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
|
74
|
+
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
|
75
|
+
n.queue=[];t=b.createElement(e);t.async=!0;
|
|
76
|
+
t.src=v;s=b.getElementsByTagName(e)[0];
|
|
77
|
+
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
|
78
|
+
'https://connect.facebook.net/en_US/fbevents.js');
|
|
79
|
+
fbq('init', '${pixelId}');
|
|
80
|
+
fbq('track', 'PageView');
|
|
81
|
+
`,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Add Microsoft Advertising (UET) script with Partytown
|
|
88
|
+
if (enableMicrosoft) {
|
|
89
|
+
headComponents.push(
|
|
90
|
+
<script
|
|
91
|
+
key="microsoft-uet"
|
|
92
|
+
type="text/partytown"
|
|
93
|
+
dangerouslySetInnerHTML={{
|
|
94
|
+
__html: `
|
|
95
|
+
(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"187106455",enableAutoSpaTracking:true};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");
|
|
96
|
+
`,
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Add OptinMonster script with Partytown
|
|
103
|
+
if (enableOptinMonster && optinMonsterUser && optinMonsterAcc) {
|
|
104
|
+
headComponents.push(
|
|
105
|
+
<script
|
|
106
|
+
key="optinmonster"
|
|
107
|
+
type="text/partytown"
|
|
108
|
+
data-user={optinMonsterUser}
|
|
109
|
+
data-account={optinMonsterAcc}
|
|
110
|
+
src="https://a.omappapi.com/app/js/api.min.js"
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Add Piguard script with Partytown
|
|
116
|
+
if (enablePiguard && piguardId && siteName) {
|
|
117
|
+
headComponents.push(
|
|
118
|
+
<script
|
|
119
|
+
key="piguard"
|
|
120
|
+
type="text/partytown"
|
|
121
|
+
src={`https://pg.${siteName}/analytics.js?tid=PP-${piguardId}`}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
setHeadComponents(headComponents);
|
|
127
|
+
|
|
128
|
+
// Add GTM noscript fallback to body
|
|
129
|
+
if (enableGTM && gaTrackingId) {
|
|
130
|
+
setPreBodyComponents([
|
|
131
|
+
<noscript
|
|
132
|
+
key="gtm-noscript"
|
|
133
|
+
dangerouslySetInnerHTML={{
|
|
134
|
+
__html: `
|
|
135
|
+
<iframe src="https://www.googletagmanager.com/ns.html?id=${gaTrackingId}" height="0" width="0"
|
|
136
|
+
style="display:none;visibility:hidden"></iframe>
|
|
137
|
+
`,
|
|
138
|
+
}}
|
|
139
|
+
/>,
|
|
140
|
+
]);
|
|
141
|
+
}
|
|
142
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-core-theme",
|
|
3
|
-
"version": "44.10.
|
|
3
|
+
"version": "44.10.12-beta.1",
|
|
4
4
|
"description": "Gatsby Theme NPM Package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"build-storybook": "cross-env STORYBOOK_IMAGE_CDN_URL=https://cdn.irishluck.ie STORYBOOK_GATSBY_SITE_NAME=norskespilleautomater.com STORYBOOK_TRACKER_LINK_FORMAT_NON_MAIN=[no],[visit],short_name STORYBOOK_TRACKER_LINK_FORMAT_MAIN=[no],[visit],short_name build-storybook"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
+
"@qwik.dev/partytown": "^0.11.2",
|
|
21
22
|
"@reach/router": "^1.3.3",
|
|
22
23
|
"@gigmedia/enigma-utils": "^1.20.0",
|
|
23
24
|
"@react-icons/all-files": "^4.1.0",
|
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
import React, { useState, createContext } from 'react';
|
|
1
|
+
import React, { useState, createContext, startTransition } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
|
|
3
4
|
export const NavigationContext = createContext(false);
|
|
4
5
|
|
|
5
|
-
const NavigationProvider = (
|
|
6
|
+
const NavigationProvider = ({ children }) => {
|
|
6
7
|
const [showMenu, setShowMenu] = useState(false);
|
|
7
8
|
const [showSearch, setShowSearch] = useState(false);
|
|
8
9
|
|
|
10
|
+
const setShowMenuTransition = (value) => {
|
|
11
|
+
startTransition(() => {
|
|
12
|
+
setShowMenu(value);
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const setShowSearchTransition = (value) => {
|
|
17
|
+
startTransition(() => {
|
|
18
|
+
setShowSearch(value);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
9
22
|
return (
|
|
10
|
-
<NavigationContext.Provider
|
|
11
|
-
{
|
|
23
|
+
<NavigationContext.Provider
|
|
24
|
+
value={{
|
|
25
|
+
showMenu,
|
|
26
|
+
setShowMenu: setShowMenuTransition,
|
|
27
|
+
showSearch,
|
|
28
|
+
setShowSearch: setShowSearchTransition,
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
12
32
|
</NavigationContext.Provider>
|
|
13
33
|
);
|
|
14
34
|
};
|
|
15
35
|
|
|
16
36
|
export default NavigationProvider;
|
|
37
|
+
|
|
38
|
+
NavigationProvider.propTypes = {
|
|
39
|
+
children: PropTypes.node.isRequired,
|
|
40
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-unused-expressions */
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
4
|
-
import React, { useRef, useState, useEffect } from "react";
|
|
4
|
+
import React, { useRef, useState, useEffect, startTransition } from "react";
|
|
5
5
|
import PropTypes from "prop-types";
|
|
6
6
|
import { BiSearchAlt } from "@react-icons/all-files/bi/BiSearchAlt";
|
|
7
7
|
import { IoIosArrowForward } from "@react-icons/all-files/io/IoIosArrowForward";
|
|
@@ -34,6 +34,7 @@ const SearchForm = ({
|
|
|
34
34
|
const topSearches =
|
|
35
35
|
pageContext?.marketSections?.top_searches?.modules?.[0]?.items;
|
|
36
36
|
const [localSearch, setLocalSearch] = useState(false);
|
|
37
|
+
const [showVariableComponent, setShowVariableComponent] = useState(false);
|
|
37
38
|
|
|
38
39
|
const loadedCounts = {
|
|
39
40
|
page: loadAutoComplete,
|
|
@@ -63,14 +64,25 @@ const SearchForm = ({
|
|
|
63
64
|
const searchFormRef = useRef();
|
|
64
65
|
|
|
65
66
|
const handleOnSearchIconClick = () => {
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
setLocalSearch(!localSearch);
|
|
68
|
+
toggleScroll("search");
|
|
69
|
+
|
|
70
|
+
// Defer VariableComponent rendering to reduce processing duration on first click
|
|
71
|
+
// This allows the overlay to appear immediately, then render the heavy component
|
|
72
|
+
if (!localSearch) {
|
|
73
|
+
startTransition(() => {
|
|
74
|
+
setShowVariableComponent(true);
|
|
75
|
+
});
|
|
76
|
+
} else {
|
|
77
|
+
setShowVariableComponent(false);
|
|
78
|
+
}
|
|
68
79
|
};
|
|
69
80
|
|
|
70
81
|
const handleOverlayClickClose = (event) => {
|
|
71
82
|
if (event.target.classList.contains(styles.searchForm)) {
|
|
72
83
|
toggleScroll("search");
|
|
73
84
|
setLocalSearch(false);
|
|
85
|
+
setShowVariableComponent(false);
|
|
74
86
|
}
|
|
75
87
|
};
|
|
76
88
|
|
|
@@ -126,6 +138,7 @@ const SearchForm = ({
|
|
|
126
138
|
!searchFormRef.current.contains(event.target)
|
|
127
139
|
) {
|
|
128
140
|
setLocalSearch(false);
|
|
141
|
+
setShowVariableComponent(false);
|
|
129
142
|
toggleScroll("search");
|
|
130
143
|
}
|
|
131
144
|
};
|
|
@@ -275,7 +288,7 @@ const SearchForm = ({
|
|
|
275
288
|
)}
|
|
276
289
|
</div>
|
|
277
290
|
)}
|
|
278
|
-
{(showRecommendedCasinos || showTopSearches) && (!filteredData || filteredData.length === 0) && !autoCompleteLoading && (
|
|
291
|
+
{(showRecommendedCasinos || showTopSearches) && (!filteredData || filteredData.length === 0) && !autoCompleteLoading && showVariableComponent && (
|
|
279
292
|
<VariableComponent
|
|
280
293
|
recommendedCasinos={recommendedCasinos}
|
|
281
294
|
topSearches={topSearches}
|