gatsby-core-theme 7.0.1 → 7.0.4

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,51 @@
1
+ ## [7.0.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v7.0.3...v7.0.4) (2022-05-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fix bug when we don't have the post type what is selected ([e5676fe](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e5676fed6d558caa83edf9a7db70b9f17d29d1f5))
7
+
8
+
9
+ ### Code Refactoring
10
+
11
+ * add loading eager to image ([03f5049](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/03f5049d17ec540f02f779eac0462a941bb0b238))
12
+ * add width and height to lazy image ([3177e0b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3177e0b9e5affe747823fa5ff4044023e6ba1a7d))
13
+ * correction to coming soon casino translation key ([28cbea5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/28cbea5f8a3163c54b524b99fa8955d867400b95))
14
+ * correction to duplicate ([cea1daf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cea1daf727d94a2601e95299aa43f370aa7cdd08))
15
+ * operatorCTA placeholder changes ([b35c777](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b35c777918275fc6153ad38b43eb8fa92d32c547))
16
+ * remove width and height ([8472e2d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8472e2db10981631681e7a3d0c8b4b8987cc8257))
17
+
18
+
19
+ * Merge branch 'tm-2893-operator-img-fix' into 'master' ([17c5061](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/17c5061216dbf8fc72cce6e94906b3821c9c0eb7))
20
+ * Merge branch 'tm-2819-operator-placeholder' into 'master' ([e483605](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e483605921a4d99c92abdf0a0c447c2e3e5c43b2))
21
+ * Merge branch 'tm-2884-archive-module' into 'master' ([935cd5e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/935cd5ec1bed85a616c819e264e98ffb852cd65e))
22
+
23
+ ## [7.0.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v7.0.2...v7.0.3) (2022-05-11)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * page reviewer ([0daf457](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0daf457df31c997333460113ca224e203a801afe))
29
+
30
+
31
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([1ccca2d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1ccca2d8729416b5f5ad8dfb904471cd2cb3c90b))
32
+
33
+ ## [7.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v7.0.1...v7.0.2) (2022-05-11)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * page reviewer ([9da597d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9da597d06663be779246df5980d253de69d23c73))
39
+
40
+
41
+ ### Code Refactoring
42
+
43
+ * responsive ([42584ab](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/42584ab72bd1c21f3281f883b30944a6d96823fa))
44
+ * update preview page schema ([dad9e57](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/dad9e57f66cc415fdece510ae9e345095075f269))
45
+
46
+
47
+ * Merge branch 'tm-2708-update-preview-page-schema' into 'master' ([f35aaef](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f35aaef331cc2dc039624d34c97a7b86531a7660))
48
+
1
49
  ## [7.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v7.0.0...v7.0.1) (2022-05-05)
2
50
 
3
51
 
@@ -45,10 +45,8 @@ function createArchivePage(pageObject, marketSections, prefilledModules, createP
45
45
  }
46
46
  });
47
47
  }
48
-
49
48
  if (!archivePages) {
50
49
  console.log(`Archive for ${pageObject.path} broken`);
51
- return;
52
50
  }
53
51
 
54
52
  if (archiveModule.pagination_type !== 'load_more') {
@@ -57,28 +55,37 @@ function createArchivePage(pageObject, marketSections, prefilledModules, createP
57
55
  const numOfItemsPerPage = Math.sign(archiveModule.num_of_items)
58
56
  ? archiveModule.num_of_items
59
57
  : calDefaultNrOfItems;
60
- const chunked = chunk(cloneDeep(archivePages), numOfItemsPerPage);
61
- const numOfPages = chunked.length;
62
- chunked.forEach((value, index) => {
63
- const page = cloneDeep(pageObject);
64
- const archive = cloneDeep(page.sections.main.modules[archiveModuleIndex]);
65
- archive.currentPage = 1 + index; // 0 skip 0
66
- archive.numOfPages = numOfPages;
67
- archive.rootPath =
68
- pageObject.path.charAt(0) !== '/' ? `/${pageObject.path}` : pageObject.path;
69
- archive.items = value.map((item) => processor.clonePage(item));
70
- page.path =
71
- archive.currentPage === 1
72
- ? pageObject.path
73
- : `${pageObject.path}/page/${archive.currentPage}`;
74
- page.sections.main.modules[archiveModuleIndex] = archive;
58
+ const chunked = archivePages && chunk(cloneDeep(archivePages), numOfItemsPerPage);
59
+ const page = cloneDeep(pageObject);
60
+
61
+ if (chunked) {
62
+ chunked.forEach((value, index) => {
63
+ const numOfPages = chunked.length;
64
+ const archive = cloneDeep(page.sections.main.modules[archiveModuleIndex]);
65
+ archive.currentPage = 1 + index; // 0 skip 0
66
+ archive.numOfPages = numOfPages;
67
+ archive.rootPath =
68
+ pageObject.path.charAt(0) !== '/' ? `/${pageObject.path}` : pageObject.path;
69
+ archive.items = value.map((item) => processor.clonePage(item));
70
+ page.path =
71
+ archive.currentPage === 1
72
+ ? pageObject.path
73
+ : `${pageObject.path}/page/${archive.currentPage}`;
74
+ page.sections.main.modules[archiveModuleIndex] = archive;
75
75
 
76
+ createPage({
77
+ path: page.path,
78
+ component: require.resolve(appName),
79
+ context: { page, marketSections, prefilledModules, siteInfo, translations },
80
+ });
81
+ });
82
+ } else {
76
83
  createPage({
77
84
  path: page.path,
78
85
  component: require.resolve(appName),
79
86
  context: { page, marketSections, prefilledModules, siteInfo, translations },
80
87
  });
81
- });
88
+ }
82
89
  } else {
83
90
  const page = cloneDeep(pageObject);
84
91
  const archive = cloneDeep(page.sections.main.modules[archiveModuleIndex]);
@@ -197,7 +204,10 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
197
204
  const processedPage = page;
198
205
  processedPage.preconnect_links = preconnectLinks;
199
206
 
200
- siteSchema = response.schema[page['market_id']];
207
+ siteSchema =
208
+ page.path === 'preview'
209
+ ? (page.siteSchema = Object.values(response.schema || {})[0])
210
+ : response.schema[page['market_id']];
201
211
  authors = response.authors;
202
212
 
203
213
  page.translations = {};
@@ -222,6 +232,7 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
222
232
  marketSections,
223
233
  prefilledModules,
224
234
  siteInfo,
235
+ siteSchema,
225
236
  translations,
226
237
  authors,
227
238
  ...themeOptions,
@@ -241,7 +252,6 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
241
252
  component: require.resolve('./src/components/app.js'),
242
253
  context: {
243
254
  ...contextData,
244
- siteSchema,
245
255
  isPreview: page.path === 'preview',
246
256
  },
247
257
  });
@@ -255,7 +265,7 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
255
265
  (processed.relations &&
256
266
  processed.relations.sports_data &&
257
267
  processed.relations.sports_data.providers) ||
258
- {}
268
+ {}
259
269
  ).forEach((providerId) => {
260
270
  const provider = processed.relations.sports_data.providers[providerId];
261
271
  const tracker = generateTrackerLink(provider, 'main');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "7.0.1",
3
+ "version": "7.0.4",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -19,6 +19,11 @@ const App = ({ pageContext }) => {
19
19
  !staticPath ? searchParams.get('path') || '/' : staticPath,
20
20
  pageContext
21
21
  ).then((previewResponse) => {
22
+ if (previewResponse.page) {
23
+ // siteInfo and siteSchema are added to page for schemaGenerator()
24
+ previewResponse.page.siteInfo = pageContext.siteInfo;
25
+ previewResponse.page.siteSchema = pageContext.siteSchema;
26
+ }
22
27
  setPreviewContext(previewResponse);
23
28
  setIsLoading(false);
24
29
  });
@@ -85,6 +90,9 @@ App.propTypes = {
85
90
  site_logo: PropTypes.string,
86
91
  site_name: PropTypes.string,
87
92
  }),
93
+ siteSchema: PropTypes.shape({
94
+ site_name: PropTypes.string,
95
+ }),
88
96
  }),
89
97
  };
90
98
 
@@ -57,7 +57,7 @@ const Author = ({
57
57
  )}
58
58
  </div>
59
59
  <div>
60
- {reviewer.name && (
60
+ {reviewer && (
61
61
  <div className={date && styles.reviewer}>
62
62
  <span>Fact checked by</span>
63
63
  {` `}
@@ -9,8 +9,8 @@ import styles from './operator-cta.module.scss';
9
9
 
10
10
  export default function OperatorCta({
11
11
  operator,
12
- placeholderText = 'Coming Soon',
13
- closedCasinoText = 'This Casino has closed',
12
+ placeholderText = 'Soon Available',
13
+ closedCasinoText = 'Not Accepting New Players',
14
14
  playText = 'Visit',
15
15
  translationKey = 'play_now',
16
16
  tracker = 'main',
@@ -21,26 +21,18 @@ export default function OperatorCta({
21
21
  const isPlaceHolder = status === 'coming_soon';
22
22
  const isClosed = status === 'inactive';
23
23
  const renderCta = () => {
24
- if (isPlaceHolder) {
25
- return (
26
- <a
27
- title={placeholderText}
28
- aria-label={placeholderText}
29
- className={`${styles.operatorCtaPlaceholder} ${gtmClass} operator-cta-gtm`}
30
- >
31
- {placeholderText}
32
- </a>
33
- );
34
- }
24
+ if (isPlaceHolder || isClosed) {
25
+ const translateBtn = isPlaceHolder
26
+ ? translate(translations, 'coming_soon', placeholderText)
27
+ : translate(translations, 'closed_casino', closedCasinoText);
35
28
 
36
- if (isClosed) {
37
29
  return (
38
30
  <a
39
- title={closedCasinoText}
40
- aria-label={closedCasinoText}
31
+ title={translateBtn}
32
+ aria-label={translateBtn}
41
33
  className={`${styles.operatorCtaClosed} ${gtmClass} operator-cta-gtm`}
42
34
  >
43
- {closedCasinoText}
35
+ {translateBtn}
44
36
  </a>
45
37
  );
46
38
  }
@@ -39,6 +39,10 @@
39
39
  font-weight: bold;
40
40
  }
41
41
  }
42
+
43
+ @include max(mobile){
44
+ flex-direction: column;
45
+ }
42
46
  }
43
47
  }
44
48
  }
@@ -63,7 +63,7 @@ function Header({ section, content = null, backgroundImage = true }) {
63
63
  name={section.page.author?.name}
64
64
  date={section.page.updated_at ? section.page.updated_at : section.page.created_at}
65
65
  readingTime={section.page.reading_time}
66
- reviewer={section.page.reviewer}
66
+ reviewer={section?.page.reviewer_id && section?.page?.reviewer}
67
67
  />
68
68
  </div>
69
69
  )}
@@ -90,6 +90,7 @@ Header.propTypes = {
90
90
  created_at: PropTypes.string,
91
91
  reading_time: PropTypes.string,
92
92
  reviewer: PropTypes.string,
93
+ reviewer_id: PropTypes.number,
93
94
  author: PropTypes.shape({
94
95
  name: PropTypes.string,
95
96
  profile_page_path: PropTypes.string,
@@ -49,7 +49,13 @@ export default function OperatorBanner({
49
49
  rel="noreferrer"
50
50
  aria-label={`${operator?.name} Link`}
51
51
  >
52
- <LazyImage alt={operator?.name} src={imagePrettyUrl(logo)} />
52
+ <LazyImage
53
+ alt={operator?.name}
54
+ src={imagePrettyUrl(logo)}
55
+ loading="eager"
56
+ height={120}
57
+ width={100}
58
+ />
53
59
  </a>
54
60
  ) : (
55
61
  <div className={styles.nameTitle}>
@@ -249,10 +249,8 @@ export default {
249
249
  }
250
250
 
251
251
  // add reviewer object to page
252
- if (page.reviewer !== null && Object.values(data.authors).length) {
253
- transformedPages[market][pageType][index].reviewer = Object.values(data.authors).find(
254
- (each) => each.name === page.reviewer
255
- );
252
+ if (page.reviewer_id !== null && Object.values(data.authors).length) {
253
+ transformedPages[market][pageType][index].reviewer = data.authors[page.reviewer_id];
256
254
  }
257
255
 
258
256
  // add breadcrumbs array to page