gatsby-core-theme 41.1.30 → 41.1.32
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
|
+
## [41.1.32](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.31...v41.1.32) (2025-01-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* sports data ([25dd87c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/25dd87c8fb284b12fda130787aa2252ab32661a5))
|
|
7
|
+
|
|
8
|
+
## [41.1.31](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.30...v41.1.31) (2025-01-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* featured events and multi market event paths ([8a7cb12](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/8a7cb1222a17cd08283c6ba77df99a0ad9600d44))
|
|
14
|
+
|
|
1
15
|
## [41.1.30](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.29...v41.1.30) (2025-01-21)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -18,12 +18,17 @@ export function extractParticipantIds(participantsData) {
|
|
|
18
18
|
.filter((id) => id !== null);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
function modifyMarketEvents(sportsMarketData, data, market) {
|
|
22
|
+
const events = cloneDeep(sportsMarketData.events);
|
|
23
|
+
|
|
24
|
+
if (data.site_markets[market].path_prefix) {
|
|
25
|
+
Object.keys(events).map((eventkey) => {
|
|
26
|
+
events[
|
|
27
|
+
eventkey
|
|
28
|
+
].path = `${data.site_markets[market].path_prefix}/${events[eventkey].path}`;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return events;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
// eslint-disable-next-line import/prefer-default-export
|
|
@@ -40,28 +45,30 @@ export const processSportsRelations = (
|
|
|
40
45
|
|
|
41
46
|
const teams = cloneDeep(data.relations.sports_data.teams);
|
|
42
47
|
const sportsMarketData = data.relations.sports_data.markets[page.market];
|
|
48
|
+
let events = null;
|
|
43
49
|
|
|
44
50
|
if (page.template === "homepage_sports") {
|
|
45
51
|
relation.teams = cloneDeep(teams);
|
|
46
|
-
|
|
47
|
-
relation.events =
|
|
52
|
+
events = modifyMarketEvents(sportsMarketData, data, market);
|
|
53
|
+
relation.events = events;
|
|
48
54
|
relation.tournaments = cloneDeep(sportsMarketData.tournaments);
|
|
49
55
|
relation.schedule = filterScheduleByDate(
|
|
50
56
|
cloneDeep(sportsMarketData.schedule)
|
|
51
57
|
);
|
|
52
|
-
relation.featured_events = Object.keys(
|
|
53
|
-
(id) =>
|
|
58
|
+
relation.featured_events = Object.keys(events).filter(
|
|
59
|
+
(id) => events[id].featured === 1
|
|
54
60
|
);
|
|
55
61
|
transformedPages[market][pageType][index].relation = relation;
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
switch (page.template) {
|
|
59
65
|
case "event":
|
|
66
|
+
events = modifyMarketEvents(sportsMarketData, data, market);
|
|
60
67
|
if (
|
|
61
68
|
transformedPages[market][pageType][index].relation_id &&
|
|
62
|
-
|
|
69
|
+
events[page.relation_id]
|
|
63
70
|
) {
|
|
64
|
-
const event = cloneDeep(
|
|
71
|
+
const event = cloneDeep(events[page.relation_id]);
|
|
65
72
|
|
|
66
73
|
const tournament = sportsMarketData.tournaments[event.tournament]
|
|
67
74
|
? cloneDeep(sportsMarketData.tournaments[event.tournament])
|
|
@@ -95,7 +102,8 @@ export const processSportsRelations = (
|
|
|
95
102
|
case "tournament":
|
|
96
103
|
const tournaments = [];
|
|
97
104
|
const tournamentIds = [];
|
|
98
|
-
|
|
105
|
+
events = modifyMarketEvents(sportsMarketData, data, market);
|
|
106
|
+
|
|
99
107
|
if (
|
|
100
108
|
Array.isArray(transformedPages[market][pageType][index].relation_id)
|
|
101
109
|
) {
|
|
@@ -105,9 +113,7 @@ export const processSportsRelations = (
|
|
|
105
113
|
cloneDeep(sportsMarketData.tournaments[tournament])
|
|
106
114
|
);
|
|
107
115
|
if (sportsMarketData.tournaments[tournament]) {
|
|
108
|
-
tournamentIds.push(
|
|
109
|
-
sportsMarketData.tournaments[tournament].id
|
|
110
|
-
);
|
|
116
|
+
tournamentIds.push(sportsMarketData.tournaments[tournament].id);
|
|
111
117
|
}
|
|
112
118
|
}
|
|
113
119
|
);
|
|
@@ -131,12 +137,11 @@ export const processSportsRelations = (
|
|
|
131
137
|
|
|
132
138
|
if (schedule.soccer) {
|
|
133
139
|
Object.entries(schedule.soccer).forEach(([date, value]) => {
|
|
134
|
-
|
|
135
140
|
Object.entries(value.tournaments).forEach(([tournamentId, value]) => {
|
|
136
141
|
if (!tournamentIds.includes(parseInt(tournamentId))) {
|
|
137
142
|
delete schedule.soccer[date].tournaments[tournamentId];
|
|
138
143
|
}
|
|
139
|
-
})
|
|
144
|
+
});
|
|
140
145
|
|
|
141
146
|
if (Object.keys(schedule.soccer[date].tournaments).length === 0) {
|
|
142
147
|
delete schedule.soccer[date];
|
|
@@ -145,12 +150,19 @@ export const processSportsRelations = (
|
|
|
145
150
|
}
|
|
146
151
|
|
|
147
152
|
relation.teams = cloneDeep(data.relations.sports_data.teams);
|
|
148
|
-
relation.events =
|
|
153
|
+
relation.events = events;
|
|
149
154
|
relation.schedule = filterScheduleByDate(schedule);
|
|
150
155
|
relation.tournaments = tournaments;
|
|
151
|
-
|
|
156
|
+
|
|
157
|
+
const allFeaturedEvents = Object.keys(sportsMarketData.events).filter(
|
|
152
158
|
(id) => sportsMarketData.events[id].featured === 1
|
|
153
159
|
);
|
|
160
|
+
|
|
161
|
+
relation.featured_events = allFeaturedEvents.filter((id) =>
|
|
162
|
+
tournaments.length > 0
|
|
163
|
+
? tournaments[0].events.includes(parseInt(id))
|
|
164
|
+
: false
|
|
165
|
+
);
|
|
154
166
|
transformedPages[market][pageType][index].relation = relation;
|
|
155
167
|
break;
|
|
156
168
|
default:
|
|
@@ -31,6 +31,11 @@ describe("processSportsRelations function", () => {
|
|
|
31
31
|
};
|
|
32
32
|
market = "market1";
|
|
33
33
|
data = {
|
|
34
|
+
site_markets: {
|
|
35
|
+
market1: {
|
|
36
|
+
path_prefix: null
|
|
37
|
+
}
|
|
38
|
+
},
|
|
34
39
|
relations: {
|
|
35
40
|
sports_data: {
|
|
36
41
|
teams: { 1: { id: 1, name: "Team 1" }, 2: { id: 2, name: "Team 2" } },
|
|
@@ -51,7 +56,7 @@ describe("processSportsRelations function", () => {
|
|
|
51
56
|
"2024-01-01": { tournaments: { 1: { events: [1] } } },
|
|
52
57
|
},
|
|
53
58
|
},
|
|
54
|
-
tournaments: { 1: { id: 1, stage_id: "stage1", teams: [1, 2] } },
|
|
59
|
+
tournaments: { 1: { id: 1, stage_id: "stage1", teams: [1, 2], events: [1] } },
|
|
55
60
|
},
|
|
56
61
|
},
|
|
57
62
|
},
|