gatsby-core-theme 2.0.2 → 2.0.3
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 +15 -0
- package/package.json +1 -1
- package/src/helpers/events.js +29 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [2.0.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.2...v2.0.3) (2021-12-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fixed schedule for rage ppc ([02f910f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/02f910f01b3ac1e9b442a1dc0a3e8f19466bac23))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Code Refactoring
|
|
10
|
+
|
|
11
|
+
* remove unneeded check ([2201e4d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2201e4d14c17684a4f49e2035af99ace83b108b1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
* Merge branch 'fix-build-schedule' into 'master' ([356b451](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/356b451459a126c41a6f27e0b0fcfbd300d45679))
|
|
15
|
+
|
|
1
16
|
## [2.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.1...v2.0.2) (2021-12-17)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
package/src/helpers/events.js
CHANGED
|
@@ -48,30 +48,41 @@ export function convertTimeZone(event) {
|
|
|
48
48
|
return { ...event, ...dateAttrs };
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
function updateSchedule(schedule) {
|
|
52
|
+
if (!schedule) {
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return Object.keys(schedule).reduce((acc, key) => {
|
|
57
|
+
const { tournaments } = schedule[key] || {};
|
|
58
|
+
if (!tournaments && ['soccer', 'handball', 'tennis', 'cricket'].includes(key)) {
|
|
59
|
+
const value = updateSchedule(schedule[key]);
|
|
60
|
+
acc[key] = value;
|
|
61
|
+
return acc;
|
|
62
|
+
}
|
|
63
|
+
// else if schedule is normal format
|
|
64
|
+
const formattedTournaments = Object.keys(tournaments).reduce(
|
|
65
|
+
(tournamentAcc, currentTournamentKey) => {
|
|
66
|
+
const league = tournaments[currentTournamentKey];
|
|
67
|
+
const formattedEvents = league.events.map((event) => convertTimeZone(event));
|
|
68
|
+
|
|
69
|
+
tournamentAcc[currentTournamentKey] = { ...league, events: formattedEvents };
|
|
70
|
+
return tournamentAcc;
|
|
71
|
+
},
|
|
72
|
+
{}
|
|
73
|
+
);
|
|
74
|
+
acc[key] = { ...schedule[key], tournaments: formattedTournaments };
|
|
75
|
+
return acc;
|
|
76
|
+
}, {});
|
|
77
|
+
}
|
|
78
|
+
|
|
51
79
|
export function updateAllTimezones(relation) {
|
|
52
80
|
const relationSchedule = relation?.schedule;
|
|
53
81
|
const relationFeaturedEvents = relation?.featured_events;
|
|
54
82
|
const relationShowcasedEvents = relation?.showcased_events;
|
|
55
83
|
|
|
56
84
|
// formated timezone schedule
|
|
57
|
-
const schedule = relationSchedule
|
|
58
|
-
? Object.keys(relationSchedule).reduce((acc, dateKey) => {
|
|
59
|
-
const { tournaments } = relationSchedule[dateKey] || {};
|
|
60
|
-
|
|
61
|
-
const formattedTournaments = Object.keys(tournaments).reduce(
|
|
62
|
-
(tournamentAcc, currentTournamentKey) => {
|
|
63
|
-
const league = tournaments[currentTournamentKey];
|
|
64
|
-
const formattedEvents = league.events.map((event) => convertTimeZone(event));
|
|
65
|
-
tournamentAcc[currentTournamentKey] = { ...league, events: formattedEvents };
|
|
66
|
-
return tournamentAcc;
|
|
67
|
-
},
|
|
68
|
-
{}
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
acc[dateKey] = { ...relation.schedule[dateKey], tournaments: formattedTournaments };
|
|
72
|
-
return acc;
|
|
73
|
-
}, {})
|
|
74
|
-
: {};
|
|
85
|
+
const schedule = updateSchedule(relationSchedule);
|
|
75
86
|
|
|
76
87
|
// formated timezone featured events
|
|
77
88
|
const featured_events = relationFeaturedEvents?.map((event) => convertTimeZone(event)) || [];
|