gatsby-matrix-theme 53.23.0 → 53.25.0
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 +21 -0
- package/gatsby-node.js +4 -1
- package/gatsby-ssr.js +92 -0
- package/package.json +1 -1
- package/src/components/molecules/sportstake/fixtures/index.js +19 -17
- package/src/components/molecules/sportstake/results/index.js +11 -17
- package/src/components/molecules/sportstake/results/table/index.js +7 -21
- package/src/components/molecules/sportstake/table/index.js +2 -2
- package/src/gatsby-core-theme/components/molecules/module/module-constants.js +6 -14
- package/src/gatsby-core-theme/components/molecules/module/module-registry.js +5 -2
- package/src/gatsby-core-theme/constants/sportstake.js +0 -12
- package/src/gatsby-core-theme/helpers/lotto.js +3 -17
- package/src/gatsby-core-theme/helpers/server-data.js +23 -28
- package/src/gatsby-core-theme/helpers/sportstake.js +45 -88
- package/storybook/public/333.41422704.iframe.bundle.js +1 -0
- package/storybook/public/638.b34fff20.iframe.bundle.js +1 -0
- package/storybook/public/650.4228498c.iframe.bundle.js +1 -0
- package/storybook/public/iframe.html +1 -1
- package/storybook/public/main.7e1380dd.iframe.bundle.js +1 -0
- package/storybook/public/project.json +1 -1
- package/storybook/public/{runtime~main.2eb89b2e.iframe.bundle.js → runtime~main.d2ee136d.iframe.bundle.js} +1 -1
- package/storybook/public/333.4e379536.iframe.bundle.js +0 -1
- package/storybook/public/638.7b0237f8.iframe.bundle.js +0 -1
- package/storybook/public/650.0b65f6f2.iframe.bundle.js +0 -1
- package/storybook/public/main.9508d55c.iframe.bundle.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [53.25.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.24.0...v53.25.0) (2026-07-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
* Merge branch 'EN-574/update-lottery-api' into 'master' ([3d24359](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/3d24359cb39c9ec8d592e6bb83d7cf04124821d0))
|
|
5
|
+
* Merge branch 'master' of gitlab.com:g2m-gentoo/team-floyd/themes/matrix-theme into EN-574/update-lottery-api ([5e77ea7](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/5e77ea7b15a7298f11f10b3b4d258227c1fa4f95))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* replace sportstake api with matchplay ([f2e3410](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/f2e34100aa28cecf371abd16e9f6e10d87ff20fa))
|
|
11
|
+
|
|
12
|
+
# [53.24.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.23.0...v53.24.0) (2026-07-02)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
* Merge branch 'critical-css-ssr' into 'master' ([5115877](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/511587745fa68b230b04f579251690bb8434e2fe))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* inject render-blocking module css on ssr routes ([aa36c7c](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/aa36c7c57be4f6eba6981cb1c1f55462eacbf871))
|
|
21
|
+
|
|
1
22
|
# [53.23.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.22.4...v53.23.0) (2026-06-29)
|
|
2
23
|
|
|
3
24
|
|
package/gatsby-node.js
CHANGED
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* Critical-CSS split (default OFF; enable per-site via options.criticalCss.enabled):
|
|
5
5
|
* 1. onCreateWebpackConfig — split CSS so only initial-chunk CSS stays inlined; lazy-module CSS
|
|
6
6
|
* goes to separate cacheable chunks.
|
|
7
|
-
* 2. onPostBuild — make each page's own chunks render-blocking (no async => no FOUC/CLS).
|
|
7
|
+
* 2. onPostBuild — make each STATIC page's own chunks render-blocking (no async => no FOUC/CLS).
|
|
8
|
+
*
|
|
9
|
+
* SSR routes (no static HTML; listed in options.criticalCss.skipRoutes) are handled by the SSR
|
|
10
|
+
* counterpart in ./gatsby-ssr.js, which injects the full module CSS render-blocking at request time.
|
|
8
11
|
*
|
|
9
12
|
* All hooks are guarded so a failure degrades gracefully and never breaks a consumer build.
|
|
10
13
|
*/
|
package/gatsby-ssr.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gatsby-matrix-theme — SSR-side half of the critical-CSS split (default OFF; enabled per-site via
|
|
3
|
+
* options.criticalCss.enabled).
|
|
4
|
+
*
|
|
5
|
+
* The split (see gatsby-node.js) moves lazy-module CSS into async chunks. On STATIC pages,
|
|
6
|
+
* `onPostBuild` re-links the chunks each page needs render-blocking by rewriting the emitted HTML.
|
|
7
|
+
* SSR routes (app-ssr.js + getServerData, e.g. the search page `/s`) have no static HTML on disk,
|
|
8
|
+
* so `onPostBuild` cannot touch them — it explicitly `skipRoutes` them — and their module CSS would
|
|
9
|
+
* otherwise load async at hydration => FOUC/CLS.
|
|
10
|
+
*
|
|
11
|
+
* This hook is the SSR counterpart: for exactly the `skipRoutes` (the dynamic/SSR routes) it injects
|
|
12
|
+
* every module CSS chunk render-blocking at request time, restoring the pre-split "full CSS at first
|
|
13
|
+
* paint" behaviour. That is precisely what `skipRoutes` documents — "route prefixes to leave with
|
|
14
|
+
* default (full) inlining" — so one config list drives both halves of the feature:
|
|
15
|
+
* - onPostBuild -> static pages: detect + render-block per page
|
|
16
|
+
* - onRenderBody -> skipRoutes (SSR) pages: render-block the full module set
|
|
17
|
+
*
|
|
18
|
+
* Matches on the first path segment, so `/s` and `/preview` are covered without touching static
|
|
19
|
+
* pages. (SSR templates that live at arbitrary slugs — settings.app_ssr: event/tournament/… — are
|
|
20
|
+
* NOT segment-addressable; covering those needs a build-emitted SSR-path manifest, a later change.)
|
|
21
|
+
*
|
|
22
|
+
* Fully guarded — a failure degrades to split-only (no worse than before) and never breaks SSR.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
const path = require('path');
|
|
27
|
+
const React = require('react');
|
|
28
|
+
const { resolveConfig } = require('./critical-css/config');
|
|
29
|
+
|
|
30
|
+
// module chunks = every emitted stylesheet except the base (`styles.*`) and route shells
|
|
31
|
+
// (`component---*`), which Gatsby already inlines render-blocking for the matched route.
|
|
32
|
+
const isModuleChunk = (f) =>
|
|
33
|
+
f.endsWith('.css') && !/^styles\./.test(f) && !/^component---/.test(f);
|
|
34
|
+
|
|
35
|
+
let cachedLinks; // built once per server process (public/ is immutable for a given build)
|
|
36
|
+
|
|
37
|
+
// Resolve the consumer site's build output dir at request time (cwd is the site root under
|
|
38
|
+
// `gatsby serve` / gatsby-plugin-fastify). chunk-map.json marks a real Gatsby public/ dir.
|
|
39
|
+
function resolvePublicDir() {
|
|
40
|
+
const candidates = [path.join(process.cwd(), 'public'), path.join(__dirname, 'public')];
|
|
41
|
+
for (const dir of candidates) {
|
|
42
|
+
try {
|
|
43
|
+
if (fs.existsSync(path.join(dir, 'chunk-map.json'))) return dir;
|
|
44
|
+
} catch (e) {
|
|
45
|
+
/* try next */
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function getModuleCssLinks() {
|
|
52
|
+
// only cache a non-empty success; retry on failure (dir may not be resolvable on an early call)
|
|
53
|
+
if (cachedLinks && cachedLinks.length) return cachedLinks;
|
|
54
|
+
try {
|
|
55
|
+
const dir = resolvePublicDir();
|
|
56
|
+
if (!dir) return [];
|
|
57
|
+
const files = fs.readdirSync(dir).filter(isModuleChunk);
|
|
58
|
+
cachedLinks = files.map((f) =>
|
|
59
|
+
React.createElement('link', {
|
|
60
|
+
key: f,
|
|
61
|
+
rel: 'stylesheet',
|
|
62
|
+
href: `/${f}`,
|
|
63
|
+
'data-crit-ssr': f,
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
return cachedLinks;
|
|
67
|
+
} catch (e) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function firstSegment(pathname) {
|
|
73
|
+
return (
|
|
74
|
+
String(pathname || '')
|
|
75
|
+
.split('?')[0]
|
|
76
|
+
.split('/')
|
|
77
|
+
.filter(Boolean)[0] || ''
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
exports.onRenderBody = ({ setHeadComponents, pathname }, pluginOptions) => {
|
|
82
|
+
try {
|
|
83
|
+
const cfg = resolveConfig(pluginOptions);
|
|
84
|
+
if (!cfg.enabled) return;
|
|
85
|
+
if (!cfg.skipRoutes.includes(firstSegment(pathname))) return;
|
|
86
|
+
|
|
87
|
+
const links = getModuleCssLinks();
|
|
88
|
+
if (links.length) setHeadComponents(links);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
/* never break SSR over a CSS optimisation */
|
|
91
|
+
}
|
|
92
|
+
};
|
package/package.json
CHANGED
|
@@ -24,10 +24,9 @@ const Fixtures = ({ module, serverData }) => {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const isCricket = moduleName.includes('cricket');
|
|
28
|
-
const isSportstake4 = moduleName.includes('sportstake4');
|
|
29
|
-
const hasTwoTables = moduleName.includes('sportstake8') || isSportstake4;
|
|
30
27
|
const query = getApiQueryParams(moduleName);
|
|
28
|
+
const isMatchplay8 = query.lotteryName === 'matchplay8';
|
|
29
|
+
const hasTwoTables = query.lotteryName === 'matchplay8' || query.lotteryName === 'matchplay14';
|
|
31
30
|
|
|
32
31
|
const headerList = tableHeader.slice(0, 4);
|
|
33
32
|
|
|
@@ -69,7 +68,7 @@ const Fixtures = ({ module, serverData }) => {
|
|
|
69
68
|
const { games } = activeFixture?.drawDetails || {};
|
|
70
69
|
|
|
71
70
|
const firstTableGames = games
|
|
72
|
-
? hasTwoTables
|
|
71
|
+
? hasTwoTables
|
|
73
72
|
? Object.values(games).slice(...query.firstTable)
|
|
74
73
|
: Object.values(games)
|
|
75
74
|
: [];
|
|
@@ -94,11 +93,11 @@ const Fixtures = ({ module, serverData }) => {
|
|
|
94
93
|
return (
|
|
95
94
|
<div label={label} results={results} key={res} className={`${styles.sportstake} ${hasTwoTables && styles.twoHalfs}`}>
|
|
96
95
|
<SportstakeHeader fixture={activeFixture} />
|
|
97
|
-
{
|
|
96
|
+
{isMatchplay8 && <h3>1st half</h3>}
|
|
98
97
|
<Table headerList={headerList} rowList={firstTableGames} />
|
|
99
98
|
{hasTwoTables && (
|
|
100
99
|
<>
|
|
101
|
-
<h3>{!
|
|
100
|
+
<h3>{!isMatchplay8 ? '2nd Half' : 'Full Time'}</h3>
|
|
102
101
|
<Table headerList={headerList} rowList={secondTableGames} />
|
|
103
102
|
</>
|
|
104
103
|
)}
|
|
@@ -121,15 +120,18 @@ Fixtures.propTypes = {
|
|
|
121
120
|
module_introduction: PropTypes.string,
|
|
122
121
|
}).isRequired,
|
|
123
122
|
pageContext: PropTypes.shape({}),
|
|
124
|
-
serverData: PropTypes.
|
|
125
|
-
PropTypes.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
serverData: PropTypes.shape({
|
|
124
|
+
data: PropTypes.objectOf(
|
|
125
|
+
PropTypes.arrayOf(
|
|
126
|
+
PropTypes.shape({
|
|
127
|
+
_id: PropTypes.string,
|
|
128
|
+
drawDate: PropTypes.string,
|
|
129
|
+
drawDetails: PropTypes.shape({
|
|
130
|
+
games: PropTypes.shape({}),
|
|
131
|
+
divs: PropTypes.shape({}),
|
|
132
|
+
}),
|
|
133
|
+
})
|
|
134
|
+
)
|
|
135
|
+
),
|
|
136
|
+
}),
|
|
135
137
|
};
|
|
@@ -5,11 +5,8 @@ import React, {useState} from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Tabs from 'gatsby-core-theme/src/hooks/tabs';
|
|
7
7
|
import { getResultsById } from '../../../../gatsby-core-theme/helpers/services';
|
|
8
|
-
import { getApiQueryParams } from '../../../../gatsby-core-theme/helpers/sportstake';
|
|
9
|
-
import {
|
|
10
|
-
tableHeader,
|
|
11
|
-
tableHeaderCricket,
|
|
12
|
-
} from '../../../../gatsby-core-theme/constants/sportstake';
|
|
8
|
+
import { getApiQueryParams, formatMatchResult } from '../../../../gatsby-core-theme/helpers/sportstake';
|
|
9
|
+
import { tableHeader } from '../../../../gatsby-core-theme/constants/sportstake';
|
|
13
10
|
import SportstakeHeader from './header';
|
|
14
11
|
import SportstakeTable from './table';
|
|
15
12
|
import Table from '../table';
|
|
@@ -29,11 +26,10 @@ const Results = ({ module, serverData }) => {
|
|
|
29
26
|
setTabData(response);
|
|
30
27
|
}
|
|
31
28
|
|
|
32
|
-
const isCricket = moduleName.includes('cricket');
|
|
33
|
-
const isSportstake4 = moduleName.includes('sportstake4');
|
|
34
|
-
const hasTwoTables = moduleName.includes('sportstake8') || isSportstake4;
|
|
35
29
|
const query = getApiQueryParams(moduleName);
|
|
36
|
-
const
|
|
30
|
+
const isMatchplay8 = query.lotteryName === 'matchplay8';
|
|
31
|
+
const hasTwoTables = query.lotteryName === 'matchplay8' || query.lotteryName === 'matchplay14';
|
|
32
|
+
const headerList = tableHeader;
|
|
37
33
|
|
|
38
34
|
if(!serverData?.data[moduleName]) return;
|
|
39
35
|
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
@@ -51,10 +47,8 @@ const Results = ({ module, serverData }) => {
|
|
|
51
47
|
awayTeam: element.awayTeam,
|
|
52
48
|
toss: element.toss_winner || element.toss,
|
|
53
49
|
dateTime: element.eventDate || element.dateTime || fallbackDate,
|
|
54
|
-
score:
|
|
55
|
-
|
|
56
|
-
: element.score || fallbackScore,
|
|
57
|
-
results: element.result || element.results,
|
|
50
|
+
score: element.score || fallbackScore,
|
|
51
|
+
results: formatMatchResult(element.result ?? element.results),
|
|
58
52
|
};
|
|
59
53
|
});
|
|
60
54
|
};
|
|
@@ -73,7 +67,7 @@ const Results = ({ module, serverData }) => {
|
|
|
73
67
|
const { games } = activeFixture?.drawDetails || {};
|
|
74
68
|
|
|
75
69
|
const firstTableGames = games
|
|
76
|
-
? hasTwoTables
|
|
70
|
+
? hasTwoTables
|
|
77
71
|
? Object.values(games).slice(...query.firstTable)
|
|
78
72
|
: Object.values(games)
|
|
79
73
|
: [];
|
|
@@ -98,15 +92,15 @@ const Results = ({ module, serverData }) => {
|
|
|
98
92
|
return (
|
|
99
93
|
<div label={label} results={results} key={res} className={`${styles.sportstake} ${hasTwoTables && styles.twoHalfs}`}>
|
|
100
94
|
<SportstakeHeader fixture={activeFixture} />
|
|
101
|
-
{
|
|
95
|
+
{isMatchplay8 && <h3>1st half</h3>}
|
|
102
96
|
<Table headerList={headerList} rowList={firstTableGames} isResult />
|
|
103
97
|
{hasTwoTables && (
|
|
104
98
|
<>
|
|
105
|
-
<h3>{!
|
|
99
|
+
<h3>{!isMatchplay8 ? '2nd Half' : 'Full Time'}</h3>
|
|
106
100
|
<Table headerList={headerList} rowList={secondTableGames} isResult />
|
|
107
101
|
</>
|
|
108
102
|
)}
|
|
109
|
-
<SportstakeTable fixture={activeFixture} query={query}
|
|
103
|
+
<SportstakeTable fixture={activeFixture} query={query} />
|
|
110
104
|
</div>
|
|
111
105
|
);
|
|
112
106
|
})}
|
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Table from '../../table';
|
|
7
|
-
import { divHeader
|
|
7
|
+
import { divHeader } from '../../../../../gatsby-core-theme/constants/sportstake';
|
|
8
8
|
import { commaSeperate } from '../../../../../gatsby-core-theme/helpers/lotto';
|
|
9
9
|
import styles from '../results.module.scss';
|
|
10
10
|
|
|
11
|
-
const SportstakeTable = ({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (!fixture) {return;}
|
|
11
|
+
const SportstakeTable = ({ fixture, query }) => {
|
|
12
|
+
if (!fixture) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
17
16
|
const { divs } = fixture?.drawDetails || {};
|
|
18
17
|
const { winnerData } = fixture?.more_info || {};
|
|
19
18
|
const { totalPrizePool, estimatedJackpot, nextEstimatedJackpotAmt } = fixture?.more_info || {};
|
|
@@ -56,15 +55,6 @@ const SportstakeTable = ({
|
|
|
56
55
|
isDivTable
|
|
57
56
|
resultTableNumber={query.secondTableStart}
|
|
58
57
|
/>
|
|
59
|
-
|
|
60
|
-
{isCricket && fixture?.toss_results?.winnerData && (
|
|
61
|
-
<Table
|
|
62
|
-
headerList={tossResultsHeader}
|
|
63
|
-
rowList={fixture?.toss_results?.winnerData}
|
|
64
|
-
isDivTable
|
|
65
|
-
resultTableNumber={query.secondTableStart}
|
|
66
|
-
/>
|
|
67
|
-
)}
|
|
68
58
|
</div>
|
|
69
59
|
{(totalPrizePoolValue !== null || nextEstimatedJackpotValue !== null) && (
|
|
70
60
|
<div className={styles.jackpotDiv}>
|
|
@@ -97,14 +87,10 @@ SportstakeTable.propTypes = {
|
|
|
97
87
|
divs: PropTypes.shape({}),
|
|
98
88
|
}),
|
|
99
89
|
more_info: PropTypes.shape({}),
|
|
100
|
-
toss_results: PropTypes.shape({
|
|
101
|
-
winnerData: PropTypes.arrayOf(PropTypes.shape({})),
|
|
102
|
-
}),
|
|
103
90
|
winnerData: PropTypes.arrayOf(PropTypes.shape({})),
|
|
104
91
|
}),
|
|
105
92
|
query: PropTypes.shape({
|
|
106
|
-
|
|
93
|
+
secondTableStart: PropTypes.number,
|
|
107
94
|
}).isRequired,
|
|
108
|
-
isCricket: PropTypes.bool
|
|
109
95
|
};
|
|
110
96
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { commaSeperate, formatDate } from '../../../../gatsby-core-theme/helpers/lotto';
|
|
5
|
-
import { formatScore, formatLowerCase } from '../../../../gatsby-core-theme/helpers/sportstake';
|
|
5
|
+
import { formatScore, formatLowerCase, formatMatchResult } from '../../../../gatsby-core-theme/helpers/sportstake';
|
|
6
6
|
import styles from './table.module.scss';
|
|
7
7
|
|
|
8
8
|
const Table = ({
|
|
@@ -13,7 +13,7 @@ const Table = ({
|
|
|
13
13
|
resultTableNumber = 0,
|
|
14
14
|
}) => {
|
|
15
15
|
const getIcon = (result) => {
|
|
16
|
-
switch (result
|
|
16
|
+
switch (formatMatchResult(result)) {
|
|
17
17
|
case 'home':
|
|
18
18
|
case 'home win':
|
|
19
19
|
return (
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
export const SPORTSTAKE_FIXTURE_MODULES = [
|
|
2
|
-
'
|
|
3
|
-
'
|
|
4
|
-
'
|
|
5
|
-
'sportstake13fixturesmidweek',
|
|
6
|
-
'sportstake13fixturesweekend',
|
|
7
|
-
'sportstakecricketfixturesweekend',
|
|
8
|
-
'sportstakerugbyfixturesweekend',
|
|
2
|
+
'matchplay8fixtures',
|
|
3
|
+
'matchplay14fixtures',
|
|
4
|
+
'matchplay13fixtures',
|
|
9
5
|
];
|
|
10
6
|
|
|
11
7
|
export const SPORTSTAKE_RESULT_MODULES = [
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'sportstake13resultsmidweek',
|
|
16
|
-
'sportstake13resultsweekend',
|
|
17
|
-
'sportstakecricketresultsweekend',
|
|
18
|
-
'sportstakerugbyresultsweekend',
|
|
8
|
+
'matchplay8results',
|
|
9
|
+
'matchplay14results',
|
|
10
|
+
'matchplay13results',
|
|
19
11
|
];
|
|
20
12
|
|
|
21
13
|
export const SPORTSTAKE_MODULES = [...SPORTSTAKE_FIXTURE_MODULES, ...SPORTSTAKE_RESULT_MODULES];
|
|
@@ -21,12 +21,15 @@ import {
|
|
|
21
21
|
getSportstakeResultProps,
|
|
22
22
|
} from './module-props';
|
|
23
23
|
|
|
24
|
+
const hasSportstakeServerData = (dataKey) => (module, ctx) =>
|
|
25
|
+
Boolean(ctx.serverData?.[dataKey]?.data?.[module?.name]?.length);
|
|
26
|
+
|
|
24
27
|
const sportstakeFixtureEntries = Object.fromEntries(
|
|
25
28
|
SPORTSTAKE_FIXTURE_MODULES.map((name) => [
|
|
26
29
|
name,
|
|
27
30
|
{
|
|
28
31
|
load: () => import('../../../../components/molecules/sportstake/fixtures'),
|
|
29
|
-
shouldRender: (
|
|
32
|
+
shouldRender: hasSportstakeServerData('fixtures'),
|
|
30
33
|
getProps: getSportstakeFixtureProps,
|
|
31
34
|
sportstakeSuspense: true,
|
|
32
35
|
},
|
|
@@ -38,7 +41,7 @@ const sportstakeResultEntries = Object.fromEntries(
|
|
|
38
41
|
name,
|
|
39
42
|
{
|
|
40
43
|
load: () => import('../../../../components/molecules/sportstake/results'),
|
|
41
|
-
shouldRender: (
|
|
44
|
+
shouldRender: hasSportstakeServerData('results'),
|
|
42
45
|
getProps: getSportstakeResultProps,
|
|
43
46
|
sportstakeSuspense: true,
|
|
44
47
|
},
|
|
@@ -1,15 +1,3 @@
|
|
|
1
1
|
export const tableHeader = ['Fixture', 'Home Team', 'Away Team', 'Date', 'Score', 'Result'];
|
|
2
2
|
|
|
3
|
-
export const tableHeaderCricket = [
|
|
4
|
-
'Fixture',
|
|
5
|
-
'Home Team',
|
|
6
|
-
'Away Team',
|
|
7
|
-
'Toss',
|
|
8
|
-
'Date',
|
|
9
|
-
'Score',
|
|
10
|
-
'Result',
|
|
11
|
-
];
|
|
12
|
-
|
|
13
3
|
export const divHeader = ['DIV', 'Matches', 'Number of Winners', 'Payout per Winner'];
|
|
14
|
-
|
|
15
|
-
export const tossResultsHeader = ['DIV', 'Toss Results', 'Number of Winners', 'Payout per Winner'];
|
|
@@ -108,23 +108,9 @@ export const generateCustomHeadings = (moduleName, title = '') => {
|
|
|
108
108
|
case 'daily_lotto':
|
|
109
109
|
todaysDate.setDate(todaysDate.getDate() - 1);
|
|
110
110
|
return `Daily Lotto Results for ${formatDate(todaysDate, 'dd/MMM/yy')}`;
|
|
111
|
-
case '
|
|
112
|
-
const
|
|
113
|
-
return `${title} for ${formatDate(
|
|
114
|
-
}
|
|
115
|
-
case 'sportstake-cricket': {
|
|
116
|
-
const sportstakeCricketDates = [getLastWeekday(6)];
|
|
117
|
-
return `${title} for ${formatDate(
|
|
118
|
-
sportstakeCricketDates.sort((a, b) => b - a)[0],
|
|
119
|
-
'dd/MMM/yy'
|
|
120
|
-
)}`;
|
|
121
|
-
}
|
|
122
|
-
case 'sportstake-rugby': {
|
|
123
|
-
const sportstakeRugbyDates = [getLastWeekday(6)];
|
|
124
|
-
return `${title} for ${formatDate(
|
|
125
|
-
sportstakeRugbyDates.sort((a, b) => b - a)[0],
|
|
126
|
-
'dd/MMM/yy'
|
|
127
|
-
)}`;
|
|
111
|
+
case 'matchplay-8': {
|
|
112
|
+
const matchplay8Dates = [getLastWeekday(6), getLastWeekday(3)];
|
|
113
|
+
return `${title} for ${formatDate(matchplay8Dates.sort((a, b) => b - a)[0], 'dd/MMM/yy')}`;
|
|
128
114
|
}
|
|
129
115
|
default:
|
|
130
116
|
return null;
|
|
@@ -123,20 +123,12 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
const sportstakeTemplateBlocks = [
|
|
126
|
-
'
|
|
127
|
-
'
|
|
128
|
-
'
|
|
129
|
-
'
|
|
130
|
-
'
|
|
131
|
-
'
|
|
132
|
-
'sportstakerugbyresultsweekend',
|
|
133
|
-
'sportstake4fixturesmidweek',
|
|
134
|
-
'sportstake8fixturesmidweek',
|
|
135
|
-
'sportstake8fixturesweekend',
|
|
136
|
-
'sportstake13fixturesmidweek',
|
|
137
|
-
'sportstake13fixturesweekend',
|
|
138
|
-
'sportstakecricketfixturesweekend',
|
|
139
|
-
'sportstakerugbyfixturesweekend',
|
|
126
|
+
'matchplay8results',
|
|
127
|
+
'matchplay14results',
|
|
128
|
+
'matchplay13results',
|
|
129
|
+
'matchplay8fixtures',
|
|
130
|
+
'matchplay14fixtures',
|
|
131
|
+
'matchplay13fixtures',
|
|
140
132
|
'lotto',
|
|
141
133
|
'daily_lotto',
|
|
142
134
|
'powerball',
|
|
@@ -157,15 +149,22 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
157
149
|
(page?.categories &&
|
|
158
150
|
page?.categories.filter((category) => category.short_name === 'lotto_uk_49')) ||
|
|
159
151
|
[];
|
|
152
|
+
const sportstakeModules =
|
|
153
|
+
page?.sections?.main?.modules?.filter(
|
|
154
|
+
(x) => x.value_type === 'template_block' && sportstakeTemplateBlocks.includes(x.name)
|
|
155
|
+
) || [];
|
|
156
|
+
const hasFixtureModules = sportstakeModules.some((m) => m.name.includes('fixtures'));
|
|
157
|
+
const hasResultModules = sportstakeModules.some((m) => m.name.includes('results'));
|
|
158
|
+
const hasLottoModules = sportstakeModules.some((m) =>
|
|
159
|
+
['lotto', 'daily_lotto', 'powerball'].includes(m.name)
|
|
160
|
+
);
|
|
160
161
|
let responseFixtures = {};
|
|
161
162
|
let responseResults = {};
|
|
162
163
|
let responseLotto = {};
|
|
163
164
|
let lottoUK49 = [];
|
|
164
165
|
|
|
165
|
-
if (containsFixtures.length >= 1) {
|
|
166
|
-
const filteredArray =
|
|
167
|
-
(x) => x.value_type === 'template_block' && sportstakeTemplateBlocks.includes(x.name)
|
|
168
|
-
);
|
|
166
|
+
if (containsFixtures.length >= 1 || hasFixtureModules) {
|
|
167
|
+
const filteredArray = sportstakeModules;
|
|
169
168
|
|
|
170
169
|
const date = new Date();
|
|
171
170
|
const fixtureData = await Promise.all(
|
|
@@ -213,13 +212,11 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
213
212
|
data: Object.assign({}, ...fixtureData.filter(Boolean)),
|
|
214
213
|
};
|
|
215
214
|
} else {
|
|
216
|
-
responseFixtures = { data:
|
|
215
|
+
responseFixtures = { data: {} };
|
|
217
216
|
}
|
|
218
217
|
|
|
219
|
-
if (containsResults.length >= 1) {
|
|
220
|
-
const filteredArray =
|
|
221
|
-
(x) => x.value_type === 'template_block' && sportstakeTemplateBlocks.includes(x.name)
|
|
222
|
-
);
|
|
218
|
+
if (containsResults.length >= 1 || hasResultModules) {
|
|
219
|
+
const filteredArray = sportstakeModules;
|
|
223
220
|
|
|
224
221
|
const date = new Date();
|
|
225
222
|
const resultData = await Promise.all(
|
|
@@ -268,13 +265,11 @@ export async function getAPIData(page, url, header, preview) {
|
|
|
268
265
|
data: Object.assign({}, ...resultData.filter(Boolean)),
|
|
269
266
|
};
|
|
270
267
|
} else {
|
|
271
|
-
responseResults = { data:
|
|
268
|
+
responseResults = { data: {} };
|
|
272
269
|
}
|
|
273
270
|
|
|
274
|
-
if (containsLotto.length >= 1) {
|
|
275
|
-
const filteredArray =
|
|
276
|
-
(x) => x.value_type === 'template_block' && sportstakeTemplateBlocks.includes(x.name)
|
|
277
|
-
);
|
|
271
|
+
if (containsLotto.length >= 1 || hasLottoModules) {
|
|
272
|
+
const filteredArray = sportstakeModules;
|
|
278
273
|
|
|
279
274
|
const responseArray = await Promise.all(
|
|
280
275
|
filteredArray.map(async (module) => {
|