gatsby-core-theme 6.1.9 → 7.0.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 CHANGED
@@ -1,3 +1,19 @@
1
+ # [7.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.9...v7.0.0) (2022-05-03)
2
+
3
+
4
+ ### Code Refactoring
5
+
6
+ * add factor checker ([cdc5192](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cdc519230240daf883b1de48ccd7297a88cb81eb))
7
+ * add reviewer object to page and change test script to reflect ([ac16823](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ac16823efc52a33fa3a6e2c613929eb590c1a909))
8
+ * align spotlight links ([235cb3e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/235cb3e8dbdcea6459b23ddaa21ef29b6eaccaf6))
9
+ * remove matrix specific schema and update tests ([4401079](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4401079658c2cb922b0d7a909331c39039667f8e))
10
+
11
+
12
+ * Merge branch 'tm-2801-fact-checker' into 'master' ([03be105](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/03be105386f4462e6b367cb50a858831729f44ba))
13
+ * Merge branch 'tm-2880-spotlight-links' into 'master' ([4f89cfb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4f89cfb955dc9e906f7285835776d8db185d93ec))
14
+ * Merge branch 'master' into tm-2801-fact-checker ([2b769fd](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2b769fd65099798d4edf621dc262db154707e698))
15
+ * Merge branch 'tm-2708-remove-matrix-specific-schema' into 'master' ([cb883ed](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cb883ed7504aaddc24bf25e33d7aef4698097818))
16
+
1
17
  ## [6.1.9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.8...v6.1.9) (2022-04-28)
2
18
 
3
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "6.1.9",
3
+ "version": "7.0.0",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -75,7 +75,7 @@ const Spotlights = ({ module, themeStyles = {} }) => {
75
75
 
76
76
  {mode === 'image_text' &&
77
77
  (item.link.value ? (
78
- <div>
78
+ <div className={styles.spotlightsTextCTA}>
79
79
  <div dangerouslySetInnerHTML={{ __html: item.text }} />
80
80
  {item.link.type === 'external' ? (
81
81
  <a
@@ -47,7 +47,11 @@
47
47
  display: block;
48
48
  }
49
49
 
50
- > div {
50
+ .spotlightsTextCTA {
51
+ display: flex;
52
+ flex-direction: column;
53
+ flex: 1;
54
+ justify-content: space-between;
51
55
  font-size: 1.4rem;
52
56
  color: #777;
53
57
  }
@@ -14,7 +14,7 @@ describe('header component', () => {
14
14
  expect(container.querySelectorAll('.headerContent')).toHaveLength(1);
15
15
 
16
16
  // Inner HTML
17
- expect(container.querySelectorAll('p')).toHaveLength(2);
17
+ expect(container.querySelectorAll('p')).toHaveLength(3);
18
18
  expect(container.querySelectorAll('i')).toHaveLength(1);
19
19
 
20
20
  // Testing image
@@ -75,6 +75,12 @@ function Header({ section, content = null, backgroundImage = true }) {
75
75
  <p className={styles.readingTime}>
76
76
  Reading Time: <span>{section.page.reading_time}</span>
77
77
  </p>
78
+ {section.page.reviewer && (
79
+ <p className={styles.readingTime}>
80
+ Fact checked by:{' '}
81
+ <a href={section.page.reviewer.profile_page_path}>{section.page.reviewer.name}</a>
82
+ </p>
83
+ )}
78
84
  <div className={!content && styles.headerText}>{headerContent()}</div>
79
85
  </div>
80
86
  </header>
@@ -90,10 +96,12 @@ Header.propTypes = {
90
96
  updated_at: PropTypes.string,
91
97
  created_at: PropTypes.string,
92
98
  reading_time: PropTypes.string,
99
+ reviewer: PropTypes.string,
93
100
  author: PropTypes.shape({
94
101
  name: PropTypes.string,
95
102
  profile_page_path: PropTypes.string,
96
103
  }),
104
+ authors: PropTypes.shape([PropTypes.shape({})]),
97
105
  sections: PropTypes.shape({
98
106
  header: PropTypes.shape({
99
107
  extra_fields: PropTypes.shape({
@@ -248,6 +248,13 @@ export default {
248
248
  transformedPages[market][pageType][index].author = data.authors[page.author_id];
249
249
  }
250
250
 
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
+ );
256
+ }
257
+
251
258
  // add breadcrumbs array to page
252
259
  const pageBreadcrumbIds = transformedPages[market][pageType][index].breadcrumb_ids;
253
260
  if (pageBreadcrumbIds) {
@@ -2,45 +2,6 @@ import { getGameRating, getUrl, getLanguage } from './getters';
2
2
  import { cleanHTML } from './strings';
3
3
 
4
4
  /* HardCoded Start */
5
- const isIL = process.env.GATSBY_SITE_NAME === 'irishluck.ie';
6
- const isNSA = process.env.GATSBY_SITE_NAME === 'norskespilleautomater.com';
7
- const publishingPrinciples = isIL
8
- ? 'https://www.irishluck.ie/editorial-principles'
9
- : 'https://www.norskespilleautomater.com/om-oss/prinsipper';
10
- const knowsAbout = [
11
- {
12
- '@type': 'Thing',
13
- name: 'Norway',
14
- sameAs: [
15
- 'https://no.wikipedia.org/wiki/Norge',
16
- 'https://www.google.no/search?q=Norge&pws=0&nord=1&hl=no&gl=NO',
17
- ],
18
- },
19
- {
20
- '@type': 'Thing',
21
- name: 'LottStift',
22
- sameAs: [
23
- 'https://no.wikipedia.org/wiki/Lotteri-_og_stiftelsestilsynet',
24
- 'https://www.google.no/search?q=lottstift&pws=0&nord=1&hl=no&gl=NO',
25
- ],
26
- },
27
- {
28
- '@type': 'Thing',
29
- name: 'Kasino',
30
- sameAs: [
31
- 'https://no.wikipedia.org/wiki/Kasino',
32
- 'https://www.google.no/search?q=Kasino&pws=0&nord=1&hl=no&gl=NO',
33
- ],
34
- },
35
- {
36
- '@type': 'Thing',
37
- name: 'Norsk Tipping Kommisjonær',
38
- sameAs: [
39
- 'https://no.wikipedia.org/wiki/Norsk_Tipping',
40
- 'https://www.google.no/search?q=norsk+tipping&pws=0&nord=1&hl=no&gl=NO',
41
- ],
42
- },
43
- ];
44
5
  const customSchema = {
45
6
  // Matrix
46
7
  'playcasino.co.za': 'Playcasino',
@@ -60,7 +21,6 @@ const customSchema = {
60
21
  'verfutbolonline.net': 'Ver Futbol Online',
61
22
  'watchsport.gr': 'Watch Sport',
62
23
  };
63
- /* HardCoded End */
64
24
 
65
25
  const socialLinks = [
66
26
  'facebook',
@@ -71,6 +31,7 @@ const socialLinks = [
71
31
  'wikipedia',
72
32
  'youtube',
73
33
  ];
34
+ /* HardCoded End */
74
35
 
75
36
  function checkSchemaProp(prop) {
76
37
  return (
@@ -138,8 +99,7 @@ export function webPageSchema(page, pageImage) {
138
99
  name: page.siteSchema?.site_name || '',
139
100
  alternateName: page.siteSchema?.alias_site_name || '',
140
101
  foundingDate: page.siteSchema?.organization_founding_date || '',
141
- publishingPrinciples:
142
- page.siteSchema?.publishing_principles || (isIL || isNSA ? publishingPrinciples : null),
102
+ publishingPrinciples: page.siteSchema?.publishing_principles,
143
103
  logo: {
144
104
  '@type': 'ImageObject',
145
105
  url: pageImage,
@@ -154,7 +114,7 @@ export function webPageSchema(page, pageImage) {
154
114
  sameAs: socialLinks
155
115
  .map((socialLink) => page.siteSchema?.[socialLink])
156
116
  .filter((socialLink) => socialLink),
157
- ...(isNSA ? { knowsAbout } : {}),
117
+ ...(page.knowsAbout ? { knowsAbout: page.knowsAbout } : {}),
158
118
  },
159
119
  };
160
120
 
@@ -9,8 +9,6 @@ const parseCheckSchema = (schema) => {
9
9
  return json;
10
10
  };
11
11
  const pageImage = 'pageImage/pageImage.jpg';
12
- const isIL = process.env.GATSBY_SITE_NAME === 'irishluck.ie';
13
- const isNSA = process.env.GATSBY_SITE_NAME === 'norskespilleautomater.com';
14
12
 
15
13
  describe('Schema Helper', () => {
16
14
  test('breadcrumbsSchema()', () => {
@@ -97,15 +95,7 @@ describe('Schema Helper', () => {
97
95
  expect(json.author.name).toEqual('Site Name');
98
96
  expect(json.author.alternateName).toEqual('Alias Site Name');
99
97
  expect(json.author.foundingDate).toEqual('01/02/03');
100
- if (isIL || isNSA) {
101
- expect(json.author.publishingPrinciples).toEqual(
102
- isNSA
103
- ? 'https://www.norskespilleautomater.com/om-oss/prinsipper'
104
- : 'https://www.irishluck.ie/editorial-principles'
105
- );
106
- } else {
107
- expect(json.author.publishingPrinciples).toEqual(null);
108
- }
98
+ expect(json.author.publishingPrinciples).toEqual(undefined);
109
99
 
110
100
  expect(Object.prototype.toString.call(json.author.logo)).toEqual('[object Object]');
111
101
  expect(json.author.logo['@type']).toEqual('ImageObject');
@@ -131,16 +121,7 @@ describe('Schema Helper', () => {
131
121
  expect(json.author.sameAs[0]).toEqual('author_linkedin');
132
122
  expect(json.author.sameAs[1]).toEqual('author_spotify');
133
123
  expect(json.author.sameAs[2]).toEqual('author_wikipedia');
134
-
135
- if (isNSA) {
136
- expect(Object.prototype.toString.call(json.author.knowsAbout)).toEqual('[object Array]');
137
- expect(json.author.knowsAbout).toHaveLength(4);
138
- expect(Object.prototype.toString.call(json.author.knowsAbout[0])).toEqual('[object Object]');
139
- expect(json.author.knowsAbout[0]['@type']).toEqual('Thing');
140
- expect(json.author.knowsAbout[0].name).toEqual('Norway');
141
- } else {
142
- expect(json.author.knowsAbout).toEqual(undefined);
143
- }
124
+ expect(json.author.knowsAbout).toEqual(undefined);
144
125
 
145
126
  expect(Object.prototype.toString.call(json.keywords)).toEqual('[object Array]');
146
127
  expect(json.keywords).toHaveLength(2);
@@ -174,6 +155,13 @@ describe('Schema Helper', () => {
174
155
  expect(json.sameAs[2]).toEqual('organization_wikipedia');
175
156
  });
176
157
 
158
+ test('moduleSchemas(null)', () => {
159
+ const output = Schema.moduleSchemas([{ name: 'other' }], '/');
160
+
161
+ expect(output).toHaveLength(0);
162
+ expect(output[0]).toEqual(undefined);
163
+ });
164
+
177
165
  test('moduleSchemas(faq)', () => {
178
166
  const output = Schema.moduleSchemas(
179
167
  [
@@ -221,6 +209,15 @@ describe('Schema Helper', () => {
221
209
  expect(json.mainEntity[2].acceptedAnswer.text).toEqual('Answer C');
222
210
  });
223
211
 
212
+ test('templateSchemas(null)', () => {
213
+ const output = Schema.templateSchemas({
214
+ type: 'other',
215
+ path: 'other_page',
216
+ });
217
+
218
+ expect(output).toEqual(null);
219
+ });
220
+
224
221
  test('templateSchemas(article)', () => {
225
222
  const output = Schema.templateSchemas({
226
223
  type: 'article',
@@ -22,6 +22,13 @@ export default function getHeaderSection() {
22
22
  image_alt: null,
23
23
  image_asset_id: 37728,
24
24
  },
25
+ reviewer: {
26
+ name: 'Cameron Murphy',
27
+ image: 'cameron-murphy.jpeg',
28
+ image_alt: null,
29
+ image_asset_id: 37728,
30
+ profile_page_path: 'about-us/cameron-murphy',
31
+ },
25
32
  },
26
33
  };
27
34