gatsby-core-theme 44.2.16 → 44.2.18

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,32 @@
1
+ ## [44.2.18](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.17...v44.2.18) (2025-06-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add time translations for notifications ([8635372](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/8635372cb96cd6afb817bd25b1f6d094b16c077f))
7
+ * add translation ([3646134](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/36461348749e99752e08ff4fc16ff8c11b9861bf))
8
+ * conflicts ([b4a714f](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/b4a714f50b5da363067570f425be34be3b49cbd8))
9
+ * operator cta ([2498397](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/24983978555b5d72b19e4e55e9c981266e4dcd4c))
10
+ * resolve mentioned issues ([efc2af3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/efc2af3c70a2d000246d7b626ff7b681e5dd10b7))
11
+ * test ([4e99e0b](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/4e99e0ba5fe28f0997d33379fd4b22e62de43334))
12
+ * test ([5b776de](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/5b776def206fd0472a53a3e44ded5505ffeda13c))
13
+ * test ([3c20ccb](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/3c20ccb5e3d6d7a0ca2ed4d227da330de016deb2))
14
+ * validate data ([d76d52b](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d76d52b3b58cb5412b6436fd8845482f61d2960c))
15
+
16
+
17
+ * Merge branch 'tm-5453-cta-button' into 'master' ([5fd74f4](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/5fd74f4a828e8520e516760c0f462292866f7f19))
18
+ * Merge branch 'tm-5536-time-translations' into 'master' ([d7f6855](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d7f68553a167bddbdf44a4c5e091d491f4d735c4))
19
+
20
+ ## [44.2.17](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.16...v44.2.17) (2025-06-20)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * autosuggest logic ([75fb409](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/75fb409a4b6f72d93adbb4b98525ba655599e51b))
26
+
27
+
28
+ * Merge branch 'tm-5552-autosuggest-logic' into 'master' ([6520798](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/6520798d46a2be6beaf5ff24f8bb37aad90de7dc))
29
+
1
30
  ## [44.2.16](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.15...v44.2.16) (2025-06-19)
2
31
 
3
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.2.16",
3
+ "version": "44.2.18",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -12,9 +12,9 @@ const LayoutSection = ({ menus }) => {
12
12
  case "page":
13
13
  return `site-pages/${id}`;
14
14
  case "operator":
15
- return `operators/${id.operator_id}/sites-data/edit/${id.id}`;
15
+ return `operators/${id?.operator_id}/sites-data/edit/${id?.id}`;
16
16
  case "game":
17
- return `games/${id.game_id}/sites?site_name=${process.env.GATSBY_SITE_NAME}`;
17
+ return `games/${id?.game_id}/sites?site_name=${process.env.GATSBY_SITE_NAME}`;
18
18
  case "author":
19
19
  return `site-authors/${id}`;
20
20
  case "payment_method":
@@ -40,9 +40,9 @@ const LayoutSection = ({ menus }) => {
40
40
  <li key={keygen()}>
41
41
  <Redirect
42
42
  icon={link?.icon}
43
- path={paths(link?.type, link.data)}
44
- linkText={link.buttonText}
45
- description={link.description}
43
+ path={paths(link?.type, link?.data)}
44
+ linkText={link?.buttonText}
45
+ description={link?.description}
46
46
  />
47
47
  </li>
48
48
  ))}
@@ -95,8 +95,7 @@ const OperatorCtaButton = ({
95
95
  } `;
96
96
 
97
97
  return (
98
- trackerLinkActive(operator, tracker) &&
99
- (status === "active" ? (
98
+ trackerLinkActive(operator, tracker) && status === "active" ? (
100
99
  <a
101
100
  href={prettyLink || "#"}
102
101
  title={`${typeof translateBtn === "string" ? translateBtn : ""} ${titleSuffix || ""
@@ -121,7 +120,6 @@ const OperatorCtaButton = ({
121
120
  {icon && icon}
122
121
  </div>
123
122
  ))
124
- )
125
123
  }
126
124
 
127
125
  OperatorCtaButton.propTypes = {
@@ -1,3 +1,5 @@
1
+
2
+ /* eslint-disable react/prop-types */
1
3
  import React from "react";
2
4
  import PropTypes from "prop-types";
3
5
  import LazyImage from "~hooks/lazy-image";
@@ -7,38 +9,14 @@ import { imagePrettyUrl, getExtraField } from "~helpers/getters";
7
9
  import { getAltText, getImageFilename } from "~helpers/image";
8
10
  import useTranslate from "~hooks/useTranslate/useTranslate";
9
11
  import CloseIcon from "~images/icons/close";
12
+ import { getTimeAgo } from "~helpers/date-time";
10
13
  import styles from "./notification-items.module.scss";
11
14
 
12
15
  const CardsItems = ({ module, onClose, useBanner = false }) => {
13
16
  const { items } = module;
14
17
  const noNewUpdates = useTranslate("noNewUpdates", "No new items");
15
18
 
16
- const getTimeAgo = (dateString) => {
17
- const date = new Date(dateString.replace(" ", "T")); // Make it ISO-compliant
18
- const now = new Date();
19
-
20
- const diffMs = now.getTime() - date.getTime();
21
- const diffMinutes = Math.floor(diffMs / (1000 * 60));
22
- const diffHours = Math.floor(diffMinutes / 60);
23
- const diffDays = Math.floor(diffHours / 24);
24
- const diffMonths = Math.floor(diffDays / 30);
25
-
26
- let timeAgo = "";
27
-
28
- if (diffDays >= 32) {
29
- timeAgo = `${diffMonths} month${diffMonths > 1 ? "s" : ""} ago`;
30
- } else if (diffDays >= 1) {
31
- timeAgo = `${diffDays} day${diffDays > 1 ? "s" : ""} ago`;
32
- } else if (diffHours >= 1) {
33
- timeAgo = `${diffHours} hour${diffHours > 1 ? "s" : ""} ago`;
34
- } else {
35
- timeAgo = `${diffMinutes} minute${diffMinutes !== 1 ? "s" : ""} ago`;
36
- }
37
-
38
- return timeAgo;
39
- };
40
-
41
- const content = (item) => {
19
+ const Content = ({ item }) => {
42
20
  const priorityImage = useBanner
43
21
  ? item?.banner || item?.relation?.logo?.fileName
44
22
  : item?.relation?.logo?.fileName;
@@ -52,6 +30,14 @@ const CardsItems = ({ module, onClose, useBanner = false }) => {
52
30
  const TitleTag = item?.title_tag || "label";
53
31
  const ribbon = getExtraField(item?.extra_fields, "notification_ribbon");
54
32
 
33
+ const { key, value } = getTimeAgo(
34
+ item?.manual_updated_at ||
35
+ item?.updated_at ||
36
+ item?.manual_created_at ||
37
+ item?.created_at
38
+ );
39
+ const timeAgo = `${value} ${useTranslate(key, key?.replace("_", " "))}`;
40
+
55
41
  return (
56
42
  <div className={styles.notificationContent}>
57
43
  {img && (
@@ -77,12 +63,7 @@ const CardsItems = ({ module, onClose, useBanner = false }) => {
77
63
  <div className={styles.ribbonAndTime}>
78
64
  {ribbon && <span className={styles.ribbon}>{ribbon}</span>}
79
65
  <span className={styles.extraContent}>
80
- {getTimeAgo(
81
- item?.manual_updated_at ||
82
- item?.updated_at ||
83
- item?.manual_created_at ||
84
- item?.created_at
85
- )}
66
+ {timeAgo}
86
67
  </span>
87
68
  </div>
88
69
  )}
@@ -90,6 +71,7 @@ const CardsItems = ({ module, onClose, useBanner = false }) => {
90
71
  </div>
91
72
  );
92
73
  };
74
+
93
75
  return (
94
76
  <div className={styles.container || ""}>
95
77
  <div className={styles.notificationsContainer || ""}>
@@ -120,7 +102,7 @@ const CardsItems = ({ module, onClose, useBanner = false }) => {
120
102
  className={`${styles.notificationLink} cards-gtm`}
121
103
  aria-label={`${item?.title} Link`}
122
104
  >
123
- {content(item)}
105
+ <Content item={item} />
124
106
  </Link>
125
107
  </li>
126
108
  ))}
@@ -269,7 +269,7 @@ const SearchForm = ({
269
269
  )}
270
270
  </div>
271
271
  )}
272
- {(showRecommendedCasinos || showTopSearches) && (!filteredData || filteredData.length === 0) && (
272
+ {(showRecommendedCasinos || showTopSearches) && (!filteredData || filteredData.length === 0) && !autoCompleteLoading && (
273
273
  <VariableComponent
274
274
  recommendedCasinos={recommendedCasinos}
275
275
  topSearches={topSearches}
@@ -28,7 +28,7 @@ const VariableComponent = ({
28
28
  >
29
29
  {showTopSearches && (
30
30
  <div className={styles.topSearches}>
31
- <p>Top Searches:</p>
31
+ <p>{useTranslate("top_searches_bar", "Top Searches:")}</p>
32
32
  {topSearches?.map((item) => (
33
33
  <Link key={item.id} to={item?.link?.value}>
34
34
  {item?.label}
@@ -29,8 +29,6 @@ describe("VariableComponent", () => {
29
29
  />
30
30
  );
31
31
 
32
- expect(screen.getByText("Top Searches:")).toBeInTheDocument();
33
-
34
32
  topSearches.forEach((item) => {
35
33
  expect(screen.getByText(item.label)).toBeInTheDocument();
36
34
  });
@@ -28,3 +28,25 @@ export function formatDate(date, format, separator = '/', market = 'en-GB') {
28
28
  }
29
29
  return formattedDate;
30
30
  }
31
+
32
+ export const getTimeAgo = (dateString) => {
33
+ const date = new Date(dateString.includes('Z') ? dateString : `${dateString.replace(" ", "T")}Z`);
34
+ const now = new Date(new Date().toISOString().slice(0, 19));
35
+
36
+ const diffMs = now.getTime() - date.getTime();
37
+ const diffMinutes = Math.floor(diffMs / (1000 * 60));
38
+ const diffHours = Math.floor(diffMinutes / 60);
39
+ const diffDays = Math.floor(diffHours / 24);
40
+ const diffMonths = Math.floor(diffDays / 30);
41
+
42
+ if (diffDays >= 32) {
43
+ return { value: diffMonths, key: diffMonths === 1 ? "month_ago" : "months_ago" };
44
+ }
45
+ if (diffDays >= 1) {
46
+ return { value: diffDays, key: diffDays === 1 ? "day_ago" : "days_ago" };
47
+ }
48
+ if (diffHours >= 1) {
49
+ return { value: diffHours, key: diffHours === 1 ? "hour_ago" : "hours_ago" };
50
+ }
51
+ return { value: diffMinutes, key: diffMinutes === 1 ? "minute_ago" : "minutes_ago" };
52
+ };
@@ -1,4 +1,4 @@
1
- import { formatDate } from './date-time';
1
+ import { formatDate, getTimeAgo } from './date-time';
2
2
 
3
3
  describe('Date-Time Helper', () => {
4
4
  test('formatDate()', () => {
@@ -7,4 +7,19 @@ describe('Date-Time Helper', () => {
7
7
  expect(formatDate('2020-04-23 11:45:10', 'MMM YYYY', '/', 'en-US')).toEqual('April 2020');
8
8
  expect(formatDate('2020-04-23 11:45:10', 'DD/MM/YYYY', '@@', 'en-US')).toEqual('04@@23@@2020');
9
9
  });
10
+
11
+
12
+ test('getTimeAgo()', () => {
13
+ const nowUTC = new Date(new Date().toISOString().slice(0, 19));
14
+
15
+ const minutesAgo = new Date(nowUTC.getTime() - 5 * 60 * 1000).toISOString().slice(0, 19); // 5 mins ago
16
+ const hoursAgo = new Date(nowUTC.getTime() - 2 * 60 * 60 * 1000).toISOString().slice(0, 19); // 2 hours ago
17
+ const daysAgo = new Date(nowUTC.getTime() - 10 * 24 * 60 * 60 * 1000).toISOString().slice(0, 19); // 10 days ago
18
+ const monthsAgo = new Date(nowUTC.getTime() - 65 * 24 * 60 * 60 * 1000).toISOString().slice(0, 19); // ~2 months ago
19
+
20
+ expect(getTimeAgo(minutesAgo)).toMatchObject({ key: 'minutes_ago', value: 5 });
21
+ expect(getTimeAgo(hoursAgo)).toMatchObject({ key: 'hours_ago', value: 2 });
22
+ expect(getTimeAgo(daysAgo)).toMatchObject({ key: 'days_ago', value: 10 });
23
+ expect(getTimeAgo(monthsAgo)).toMatchObject({ key: 'months_ago', value: 2 });
24
+ });
10
25
  });