gatsby-core-theme 40.0.29 → 40.0.30
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 +22 -0
- package/package.json +1 -1
- package/src/components/molecules/search/index.js +5 -5
- package/src/components/molecules/search/search.test.js +13 -19
- package/src/components/organisms/anchor/template-one/index.js +4 -3
- package/src/helpers/getPrioritySortedKeys.js +11 -0
- package/src/helpers/getPrioritySortedKeys.test.js +92 -0
- package/src/helpers/processor/index.mjs +1 -1
- package/src/helpers/processor/modules.mjs +4 -3
- package/src/helpers/schema.js +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## [40.0.30](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v40.0.29...v40.0.30) (2024-11-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add tets for prioritysortedkeys function ([808a44f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/808a44fb56ab77d5ed6e2a82a2ed2ed588af0c53))
|
|
7
|
+
* checked with template ([da6a1b1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/da6a1b10b776df5751dd914513bafbf533b7ce1b))
|
|
8
|
+
* get latst changes ([86aa9bd](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/86aa9bd30d2f721780d7128e29525e9d23f8a452))
|
|
9
|
+
* remove breadcrumbs and webPage schema on tracker ([d2da70a](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d2da70a673cf50c2c904de7cfe017faf81e642a3))
|
|
10
|
+
* resolve conflicts ([3547eb2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/3547eb2df7185c15ca3f3ca10685bdcfb27c6f8d))
|
|
11
|
+
* revert back changes ([67fab31](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/67fab3151e99266bc265761b9ac62caf13592dda))
|
|
12
|
+
* transaltion data ([5430b90](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/5430b90bed91a20c01d3a0b14df87a0eb60dbc7b))
|
|
13
|
+
* unique selling points ([fb8813e](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/fb8813eee68b036c1cadbb2c7c2a5433e415041f))
|
|
14
|
+
* update search logic so the first tabs and items to appear to be the operator and game ([f95d9fd](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/f95d9fd62bf6744f33bf898416d5e83bbf9bcbcc))
|
|
15
|
+
* update tests ([7ab4ce0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/7ab4ce07b620030bf826bc9515eb872c76811a85))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
* Merge branch 'translation-page-description' into 'master' ([3f5632a](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/3f5632abfed9e927947c400e41f81fc4d605bbe9))
|
|
19
|
+
* Merge branch 'tm-4878-search-page' into 'master' ([4d6b3c4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/4d6b3c440d2df4d33388b4a5664724bbdebbb751))
|
|
20
|
+
* Merge branch 'tm-4917-schema' into 'master' ([545e278](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/545e2786b5acb1f76a1a7eb255bd7edace7af2be))
|
|
21
|
+
* Merge branch 'master' into tm-4917-schema ([db5e910](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/db5e9105bcbbeedabf9a0755901e345336d3c524))
|
|
22
|
+
|
|
1
23
|
## [40.0.29](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v40.0.28...v40.0.29) (2024-11-04)
|
|
2
24
|
|
|
3
25
|
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import ModuleTitle from '~atoms/module-title';
|
|
|
9
9
|
import Archive from '~organisms/archive';
|
|
10
10
|
import keygen from '~helpers/keygen';
|
|
11
11
|
import { sortDateOn, sortIntOn, sortStringOn } from '~helpers/search';
|
|
12
|
+
import { getOrderedKeys } from '../../../helpers/getPrioritySortedKeys';
|
|
12
13
|
import CustomSelect from '~atoms/custom-select';
|
|
13
14
|
import Tabs from '~hooks/tabs';
|
|
14
15
|
|
|
@@ -27,7 +28,7 @@ const Search = ({
|
|
|
27
28
|
|
|
28
29
|
const marketPrefix = activeMarket?.path_prefix || '/';
|
|
29
30
|
const showAll = useTranslate('showAll', "showAll");
|
|
30
|
-
|
|
31
|
+
|
|
31
32
|
const sortHandle = (field, name, type) => {
|
|
32
33
|
// eslint-disable-next-line array-callback-return
|
|
33
34
|
Object.keys(searchData).map((item) => {
|
|
@@ -45,9 +46,8 @@ const Search = ({
|
|
|
45
46
|
});
|
|
46
47
|
setSearchData({ ...searchData });
|
|
47
48
|
};
|
|
48
|
-
|
|
49
|
-
const typeTabs = searchData ? [showAll, ...
|
|
50
|
-
|
|
49
|
+
|
|
50
|
+
const typeTabs = searchData ? [showAll, ...getOrderedKeys(searchData)] : [];
|
|
51
51
|
const getItems = (item) => {
|
|
52
52
|
const titleObj = pageSearchOptions.archiveOptions.titles.find((title) => title.type === item);
|
|
53
53
|
const items = {
|
|
@@ -133,7 +133,7 @@ const Search = ({
|
|
|
133
133
|
|
|
134
134
|
return (
|
|
135
135
|
<div results={data.length} label={item} tabId="scas" key={keygen()}>
|
|
136
|
-
{
|
|
136
|
+
{getOrderedKeys(searchData).map((item2) => getItems(item2))}
|
|
137
137
|
</div>
|
|
138
138
|
);
|
|
139
139
|
})}
|
|
@@ -65,7 +65,7 @@ describe('Search Component', () => {
|
|
|
65
65
|
/>
|
|
66
66
|
);
|
|
67
67
|
|
|
68
|
-
expect(getByText('Search For: casino')).
|
|
68
|
+
expect(getByText('Search For: casino')).toBeInTheDocument();
|
|
69
69
|
const input = container.querySelectorAll('input');
|
|
70
70
|
expect(input).toHaveLength(1);
|
|
71
71
|
expect(input[0].getAttribute('placeholder')).toEqual('casino');
|
|
@@ -74,34 +74,28 @@ describe('Search Component', () => {
|
|
|
74
74
|
expect(container.querySelectorAll('.tab-content > div h2').length).toBe(8);
|
|
75
75
|
expect(container.querySelectorAll('.tabList ol li').length).toBe(2);
|
|
76
76
|
|
|
77
|
-
//
|
|
78
|
-
expect(getByText('
|
|
79
|
-
expect(getByText('
|
|
80
|
-
expect(getByText('
|
|
77
|
+
// Operator pages re-ordered
|
|
78
|
+
expect(getByText('VIPArabClub Casino Review 2024')).toBeInTheDocument();
|
|
79
|
+
expect(getByText('Casombie Casino Review 2024')).toBeInTheDocument();
|
|
80
|
+
expect(getByText('Playfina Casino Review 2024')).toBeInTheDocument();
|
|
81
81
|
|
|
82
82
|
const button = container.querySelector('.tabList ol li:nth-child(2) button');
|
|
83
83
|
fireEvent.click(button);
|
|
84
84
|
|
|
85
|
-
//
|
|
86
|
-
expect(getByText('
|
|
87
|
-
expect(getByText('
|
|
88
|
-
expect(getByText('
|
|
85
|
+
// Article Cards
|
|
86
|
+
expect(getByText('Best Online Casino Payment Methods For Arab Players In 2024')).toBeInTheDocument();
|
|
87
|
+
expect(getByText('Real Money Online Casinos for Arab Players 2024')).toBeInTheDocument();
|
|
88
|
+
expect(getByText('VIP Online Casinos for Arab Players 2024')).toBeInTheDocument();
|
|
89
|
+
|
|
89
90
|
|
|
90
91
|
const button2 = container.querySelector('.customSelectContainer ol li:nth-child(2) button');
|
|
91
92
|
fireEvent.click(button2);
|
|
92
93
|
|
|
93
94
|
// Default Pages
|
|
94
|
-
expect(getByText('
|
|
95
|
-
expect(getByText('
|
|
96
|
-
expect(getByText('
|
|
97
|
-
|
|
98
|
-
const button3 = container.querySelector('.customSelectContainer ol li:last-child button');
|
|
99
|
-
fireEvent.click(button3);
|
|
95
|
+
expect(getByText('Best Arabic Online Casinos 2024')).toBeInTheDocument();
|
|
96
|
+
expect(getByText('Best Online Casino Payment Methods For Arab Players In 2024')).toBeInTheDocument();
|
|
97
|
+
expect(getByText('Best Online Casinos in Algeria 2024')).toBeInTheDocument();
|
|
100
98
|
|
|
101
|
-
// Payment pages re-ordered
|
|
102
|
-
expect(getByText('10bet Casino Review 2024')).toBeTruthy();
|
|
103
|
-
expect(getByText('Megapari Casino Review 2024')).toBeTruthy();
|
|
104
|
-
expect(getByText('Lucky Dreams Casino 2024')).toBeTruthy();
|
|
105
99
|
});
|
|
106
100
|
});
|
|
107
101
|
});
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
/* eslint-disable react/no-array-index-key */
|
|
2
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
3
1
|
/* eslint-disable no-nested-ternary */
|
|
4
2
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
5
3
|
/* eslint-disable no-unused-expressions */
|
|
6
4
|
/* eslint-disable prefer-destructuring */
|
|
7
5
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
8
|
-
import React, { useRef, useState } from
|
|
6
|
+
import React, { useRef, useState } from "react";
|
|
9
7
|
import PropTypes from 'prop-types';
|
|
10
8
|
import { IoIosArrowBack } from '@react-icons/all-files/io/IoIosArrowBack';
|
|
11
9
|
import { IoIosArrowForward } from '@react-icons/all-files/io/IoIosArrowForward';
|
|
@@ -124,6 +122,7 @@ function Anchor({
|
|
|
124
122
|
const sticky = isFixed && isSticky(stickyOffset, setActiveAnchor, anchorContainerRef);
|
|
125
123
|
|
|
126
124
|
const anchorItems = anchorList?.map((item, index) => (
|
|
125
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
127
126
|
<li key={index} className={styles.anchorItem || ''}>
|
|
128
127
|
<a
|
|
129
128
|
className={`${styles.link || ''} anchor-carousel-gtm anchor-menu-gtm`}
|
|
@@ -133,6 +132,7 @@ function Anchor({
|
|
|
133
132
|
ref={(el) => (itemsRef.current[index] = el)}
|
|
134
133
|
href={`#${item?.id && item.id}`}
|
|
135
134
|
>
|
|
135
|
+
{/* eslint-disable-next-line react-hooks/rules-of-hooks */}
|
|
136
136
|
{useTranslate(item.slug, item.label)}
|
|
137
137
|
{icon}
|
|
138
138
|
</a>
|
|
@@ -143,6 +143,7 @@ function Anchor({
|
|
|
143
143
|
<div className={styles.containerAnchor || ''} ref={anchorContainerRef}>
|
|
144
144
|
{showTitle && (
|
|
145
145
|
<div className={`${styles.anchorTitle || ''}`}>
|
|
146
|
+
{/* eslint-disable-next-line react-hooks/rules-of-hooks */}
|
|
146
147
|
<span>{useTranslate('anchor_title', 'Table of Contents')}</span>
|
|
147
148
|
</div>
|
|
148
149
|
)}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
2
|
+
export const getOrderedKeys = (incomingData) => {
|
|
3
|
+
const priority = ["operator", "game"];
|
|
4
|
+
return Object.keys(incomingData).sort((a, b) => {
|
|
5
|
+
const aIndex = priority.indexOf(a);
|
|
6
|
+
const bIndex = priority.indexOf(b);
|
|
7
|
+
if (aIndex === -1) return 1;
|
|
8
|
+
if (bIndex === -1) return -1;
|
|
9
|
+
return aIndex - bIndex;
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { getOrderedKeys } from "./getPrioritySortedKeys";
|
|
2
|
+
|
|
3
|
+
describe("getOrderedKeys", () => {
|
|
4
|
+
test("sorts keys with priority items appearing first", () => {
|
|
5
|
+
const incomingData = {
|
|
6
|
+
game: "game value",
|
|
7
|
+
operator: "operator value",
|
|
8
|
+
article: "article value",
|
|
9
|
+
page: "default value",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const result = getOrderedKeys(incomingData);
|
|
13
|
+
expect(result).toEqual(["operator", "game", "article", "page"]);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test("returns non-priority items in original order after priority items", () => {
|
|
17
|
+
const incomingData = {
|
|
18
|
+
page: "default value",
|
|
19
|
+
article: "article value",
|
|
20
|
+
operator: "operator value",
|
|
21
|
+
game: "game value",
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const result = getOrderedKeys(incomingData);
|
|
25
|
+
expect(result).toEqual(["operator", "game", "page", "article"]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("returns all keys in the order if no priority keys are present", () => {
|
|
29
|
+
const incomingData = {
|
|
30
|
+
page: "default value",
|
|
31
|
+
article: "article value",
|
|
32
|
+
news: "news value",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const result = getOrderedKeys(incomingData);
|
|
36
|
+
expect(result).toEqual(["page", "article", "news"]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("returns only priority keys if they are the only keys present", () => {
|
|
40
|
+
const incomingData = {
|
|
41
|
+
game: "game value",
|
|
42
|
+
operator: "operator value",
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const result = getOrderedKeys(incomingData);
|
|
46
|
+
expect(result).toEqual(["operator", "game"]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("returns empty array if incomingData is empty", () => {
|
|
50
|
+
const incomingData = {};
|
|
51
|
+
|
|
52
|
+
const result = getOrderedKeys(incomingData);
|
|
53
|
+
expect(result).toEqual([]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("places multiple non-priority keys after priority keys in the original order", () => {
|
|
57
|
+
const incomingData = {
|
|
58
|
+
game: "game value",
|
|
59
|
+
article: "article value",
|
|
60
|
+
page: "default value",
|
|
61
|
+
operator: "operator value",
|
|
62
|
+
news: "news value",
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const result = getOrderedKeys(incomingData);
|
|
66
|
+
expect(result).toEqual(["operator", "game", "article", "page", "news"]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("places priority key correctly if only one is present, in this case only operator", () => {
|
|
70
|
+
const incomingData = {
|
|
71
|
+
article: "article value",
|
|
72
|
+
page: "default value",
|
|
73
|
+
operator: "operator value",
|
|
74
|
+
news: "news value",
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const result = getOrderedKeys(incomingData);
|
|
78
|
+
expect(result).toEqual(["operator", "article", "page", "news"]);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test("places priority key correctly if only one is present, in this case only game", () => {
|
|
82
|
+
const incomingData = {
|
|
83
|
+
article: "article value",
|
|
84
|
+
page: "default value",
|
|
85
|
+
game: "game value",
|
|
86
|
+
news: "news value",
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const result = getOrderedKeys(incomingData);
|
|
90
|
+
expect(result).toEqual(["game", "article", "page", "news"]);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -307,7 +307,8 @@ export function processTopListModule(
|
|
|
307
307
|
pages,
|
|
308
308
|
markets,
|
|
309
309
|
data,
|
|
310
|
-
toplists
|
|
310
|
+
toplists,
|
|
311
|
+
translations
|
|
311
312
|
) {
|
|
312
313
|
module.items = module.items.map((listItem) => {
|
|
313
314
|
const { type } = listItem;
|
|
@@ -358,7 +359,7 @@ export function processTopListModule(
|
|
|
358
359
|
operatorRelation.selling_points =
|
|
359
360
|
item.selling_points && item.selling_points.length === 0
|
|
360
361
|
? operatorRelation.selling_points
|
|
361
|
-
: item.selling_points;
|
|
362
|
+
: item.selling_points.map(sellingPoint => translations ? translations[sellingPoint] : sellingPoint);
|
|
362
363
|
}
|
|
363
364
|
|
|
364
365
|
const operatorPage =
|
|
@@ -479,7 +480,7 @@ export function processModule(
|
|
|
479
480
|
markets,
|
|
480
481
|
data,
|
|
481
482
|
toplists,
|
|
482
|
-
|
|
483
|
+
translations
|
|
483
484
|
);
|
|
484
485
|
} else if (module.name === "spotlights") {
|
|
485
486
|
processSpotlightModule(module, content);
|
package/src/helpers/schema.js
CHANGED
|
@@ -486,16 +486,17 @@ export function templateSchemas(page, pageImage) {
|
|
|
486
486
|
|
|
487
487
|
export function schemaGenerator(page = {}, pageImage) {
|
|
488
488
|
const isHomepage = page.path === '/';
|
|
489
|
-
|
|
489
|
+
const tracker = page?.template === 'tracker';
|
|
490
|
+
|
|
490
491
|
const jsonSchema = [
|
|
491
492
|
// Page Schema
|
|
492
493
|
...(page.seo_json_schemas && page.seo_json_schemas.length
|
|
493
494
|
? page.seo_json_schemas
|
|
494
495
|
: [page.seo_json_schema]),
|
|
495
496
|
// Breadcrumbs Schema
|
|
496
|
-
!isHomepage ? breadcrumbsSchema(page) : null,
|
|
497
|
+
(!isHomepage && !tracker) ? breadcrumbsSchema(page) : null,
|
|
497
498
|
// Modules Schemas
|
|
498
|
-
|
|
499
|
+
!tracker ? webPageSchema(page, pageImage): null,
|
|
499
500
|
organizationSchema(page, pageImage),
|
|
500
501
|
templateSchemas(page, pageImage),
|
|
501
502
|
...(page.sections?.main?.modules
|