gatsby-core-theme 41.1.0 → 41.1.2

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,25 @@
1
+ ## [41.1.2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.1...v41.1.2) (2024-12-03)
2
+
3
+
4
+ ### Code Refactoring
5
+
6
+ * get author review content from content data ([bd09c47](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/bd09c477ea3766a84f189a2751b54097767e75f4))
7
+
8
+
9
+ * Merge branch 'multiple-contributor-author-review' into 'master' ([fe913fb](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/fe913fb7c192e7a17772c8757ef418ea7bbac300))
10
+
11
+
12
+ ### Tests
13
+
14
+ * fix test ([c7626fd](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c7626fdf0269e37593ae49aa02a85d1545fdc6a2))
15
+
16
+ ## [41.1.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.0...v41.1.1) (2024-12-03)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * admin bar links and preview ([c64e47d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c64e47da86b084c33860b5d08708efcf52d0027e))
22
+
1
23
  # [41.1.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.0.2...v41.1.0) (2024-12-03)
2
24
 
3
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "41.1.0",
3
+ "version": "41.1.2",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -9,7 +9,7 @@ import PreviewLink from "./preview";
9
9
  import Logo from "./logo";
10
10
  import styles from "./bar.module.scss";
11
11
 
12
- const AdminBar = ({ page, marketSections, menu }) => {
12
+ const AdminBar = ({ page, marketSections, menu, activeMarket }) => {
13
13
  const { setShowTranslationKeys, preview } = useContext(Context) || {};
14
14
  const [val, setVal] = useState(false);
15
15
  const types = ["operator", "game", "author", "payment_method"];
@@ -43,7 +43,7 @@ const AdminBar = ({ page, marketSections, menu }) => {
43
43
  </label>
44
44
  </li>
45
45
  <LayoutSection menus={menus} />
46
- <PreviewLink page={page} preview={preview} />
46
+ <PreviewLink activeMarket={activeMarket} page={page} preview={preview} />
47
47
  </ul>
48
48
  </div>
49
49
  </div>
@@ -11,9 +11,9 @@ const LayoutSection = ({ menus }) => {
11
11
  case "page":
12
12
  return `site-pages/${id}`;
13
13
  case "operator":
14
- return `operators/${id}/sites-data?site=${process.env.GATSBY_SITE_NAME}`;
14
+ return `operators/${id.operator_id}/sites-data/edit/${id.id}`;
15
15
  case "game":
16
- return `games/${id}/sites?site_name=${process.env.GATSBY_SITE_NAME}`;
16
+ return `games/${id.id}/sites?site_name=${process.env.GATSBY_SITE_NAME}`;
17
17
  case "author":
18
18
  return `site-authors/${id}`;
19
19
  case "payment_method":
@@ -4,14 +4,19 @@ import { FiEye } from "@react-icons/all-files/fi/FiEye";
4
4
  import { FiEyeOff } from "@react-icons/all-files/fi/FiEyeOff";
5
5
  import styles from "./preview.module.scss";
6
6
 
7
- const PreviewLink = ({ page, preview }) => (
7
+ const PreviewLink = ({ page, preview, activeMarket }) => {
8
+
9
+ const path = activeMarket && activeMarket.path_prefix ? page.path.replace(`${activeMarket.path_prefix}/`, '') : page.path;
10
+
11
+
12
+ return (
8
13
  <li>
9
14
  <a
10
15
  className={styles.preview}
11
16
  target={!preview ? "_blank" : ""}
12
17
  href={
13
18
  !preview
14
- ? `/preview/?path=${page.path}&market_id=${page.market_id}`
19
+ ? `/preview/?path=${path}&market_id=${page.market_id}&market=${page.market}`
15
20
  : `/${page.path}`
16
21
  }
17
22
  rel="noreferrer"
@@ -19,12 +24,17 @@ const PreviewLink = ({ page, preview }) => (
19
24
  Preview Page {preview ? <FiEyeOff /> : <FiEye />}
20
25
  </a>
21
26
  </li>
22
- );
27
+ )
28
+ };
23
29
 
24
30
  PreviewLink.propTypes = {
25
31
  page: PropTypes.shape({
26
32
  path: PropTypes.string,
27
33
  market_id: PropTypes.number,
34
+ market: PropTypes.string,
35
+ }),
36
+ activeMarket: PropTypes.shape({
37
+ path_prefix: PropTypes.string,
28
38
  }),
29
39
  preview: PropTypes.bool,
30
40
  };
@@ -102,6 +102,7 @@ const Navigation = ({
102
102
  page={pageContext.page}
103
103
  marketSections={pageContext.marketSections}
104
104
  menu={menu}
105
+ activeMarket={activeMarket}
105
106
  />
106
107
  )}
107
108
  <nav className={styles.nav || ""} ref={navRef}>
@@ -73,7 +73,7 @@ export const menusConfig = (menuObj, footerSection, page, types) => [
73
73
  links: [
74
74
  {
75
75
  ...(types.includes(page?.type) && {
76
- data: page?.relation?.operator_id,
76
+ data: page?.relation,
77
77
  buttonText: `Edit ${page?.type} Sites Data`,
78
78
  icon: <FiDatabase fontSize={20} />,
79
79
  type: page?.type,
@@ -81,7 +81,7 @@ export function generateHreflangs(page, data) {
81
81
 
82
82
  // Check if author review per page per author is available
83
83
  if (page.author_reviews && page.author_reviews[authorId]?.length) {
84
- review = page.author_reviews[authorId];
84
+ review = data.content[page.author_reviews[authorId]];
85
85
  }
86
86
 
87
87
  return { ...author, author_review: review || "" }; // Return the author object with review or empty string
@@ -160,30 +160,33 @@ describe("Page Helper", () => {
160
160
  ]);
161
161
  });
162
162
 
163
- const pageAuthordata = {
163
+ const generalData = {
164
164
  authors: {
165
165
  1: { name: "Author One", bio: "Bio of Author One" },
166
166
  2: { name: "Author Two", bio: "Bio of Author Two" },
167
167
  // Non-existent author
168
168
  3: null,
169
169
  },
170
+ content: {
171
+ "66bc78a1c1dfec6dc577b0c3": "<p>In my opinion, fast payout casinos are a game-changer for players in Ireland.</p>",
172
+ "66bb62cdef28a6710241911b": "<h3>Can I access WinSpirit Casino from my mobile?</h3>",
173
+ }
170
174
  };
171
175
 
172
176
  test("returns authors when there are multiple authors", () => {
173
177
  const page = {
174
178
  authors: [1, 2],
175
179
  author_reviews: {
176
- 1: ["Great article!", "Very insightful!"],
177
- 2: [], // No reviews for Author Two
178
- },
180
+ 1: "66bc78a1c1dfec6dc577b0c3",
181
+ } // No reviews for Author Two
179
182
  };
180
183
 
181
- const result = addMultipleAuthorsToPage(page, pageAuthordata);
184
+ const result = addMultipleAuthorsToPage(page, generalData);
182
185
  expect(result).toEqual([
183
186
  {
184
187
  name: "Author One",
185
188
  bio: "Bio of Author One",
186
- author_review: ["Great article!", "Very insightful!"],
189
+ author_review: "<p>In my opinion, fast payout casinos are a game-changer for players in Ireland.</p>",
187
190
  },
188
191
  { name: "Author Two", bio: "Bio of Author Two", author_review: "" },
189
192
  ]);
@@ -193,17 +196,16 @@ describe("Page Helper", () => {
193
196
  const page = {
194
197
  authors: [1, 2, 3], // 3 is a non-existent author
195
198
  author_reviews: {
196
- 1: ["Great article!"],
197
- 2: null,
199
+ 1: "66bc78a1c1dfec6dc577b0c3",
198
200
  },
199
201
  };
200
202
 
201
- const result = addMultipleAuthorsToPage(page, pageAuthordata);
203
+ const result = addMultipleAuthorsToPage(page, generalData);
202
204
  expect(result).toEqual([
203
205
  {
204
206
  name: "Author One",
205
207
  bio: "Bio of Author One",
206
- author_review: ["Great article!"],
208
+ author_review: "<p>In my opinion, fast payout casinos are a game-changer for players in Ireland.</p>",
207
209
  },
208
210
  { name: "Author Two", bio: "Bio of Author Two", author_review: "" },
209
211
  ]);
@@ -214,7 +216,7 @@ describe("Page Helper", () => {
214
216
  authors: [],
215
217
  };
216
218
 
217
- const result = addMultipleAuthorsToPage(page, pageAuthordata);
219
+ const result = addMultipleAuthorsToPage(page, generalData);
218
220
  expect(result).toEqual([]);
219
221
  });
220
222
 
@@ -223,7 +225,7 @@ describe("Page Helper", () => {
223
225
  authors: null,
224
226
  };
225
227
 
226
- const result = addMultipleAuthorsToPage(page, pageAuthordata);
228
+ const result = addMultipleAuthorsToPage(page, generalData);
227
229
  expect(result).toEqual([]);
228
230
  });
229
231
 
@@ -232,7 +234,7 @@ describe("Page Helper", () => {
232
234
  authors: [3], // Only non-existent author
233
235
  };
234
236
 
235
- const result = addMultipleAuthorsToPage(page, pageAuthordata);
237
+ const result = addMultipleAuthorsToPage(page, generalData);
236
238
  expect(result).toEqual([]);
237
239
  });
238
240
  });
@@ -57,6 +57,7 @@ export async function getAPIData(page, url, headers, preview) {
57
57
  pagesData,
58
58
  operatorData,
59
59
  paymentData,
60
+ allMarketsData
60
61
  } = await fetchSiteSettings(siteName, true);
61
62
 
62
63
  const processed = processor.run(
@@ -83,7 +84,7 @@ export async function getAPIData(page, url, headers, preview) {
83
84
  );
84
85
 
85
86
  const pagePreviewProcessed = Object.values(pagesData).filter(
86
- (value) => value.path === params?.path
87
+ (value) => (value.path === `${params?.market && allMarketsData[params?.market].path_prefix ? `${allMarketsData[params?.market].path_prefix}/` : '' }${params?.path}`)
87
88
  );
88
89
 
89
90
  if(pagePreviewProcessed.length > 0 ) {