gatsby-matrix-theme 53.0.31 → 53.1.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/package.json +2 -2
  3. package/src/components/atoms/author-card/index.js +3 -2
  4. package/src/components/atoms/cards/article-card/variables/index.js +11 -9
  5. package/src/components/atoms/cards/author/template-one/index.js +3 -1
  6. package/src/components/atoms/cards/author/template-two/index.js +2 -1
  7. package/src/components/atoms/cards/game-cards/template-five/index.js +10 -10
  8. package/src/components/atoms/cards/game-cards/template-four/index.js +9 -9
  9. package/src/components/atoms/cards/game-cards/template-one/index.js +9 -9
  10. package/src/components/atoms/cards/game-cards/template-three/index.js +10 -10
  11. package/src/components/atoms/cards/game-cards/template-two/index.js +10 -10
  12. package/src/components/atoms/cards/payment-method/template-one/index.js +6 -5
  13. package/src/components/atoms/cards/payment-method/template-three/index.js +7 -6
  14. package/src/components/atoms/cards/popup-card/index.js +7 -6
  15. package/src/components/atoms/cards/software-provider-card/index.js +4 -3
  16. package/src/components/atoms/feedback/template-three/index.js +7 -7
  17. package/src/components/atoms/feedback/template-two/index.js +4 -3
  18. package/src/components/atoms/ratings-with-comments/index.js +133 -0
  19. package/src/components/atoms/ratings-with-comments/ratings-with-comments.module.scss +300 -0
  20. package/src/components/molecules/header/variants/author/assets/portrait/index.js +2 -1
  21. package/src/components/molecules/header/variants/default/template-two/index.js +5 -5
  22. package/src/components/molecules/header/variants/operator/template-five/index.js +7 -6
  23. package/src/components/molecules/header/variants/operator/template-four/index.js +7 -6
  24. package/src/components/molecules/header/variants/operator/template-three/index.js +6 -5
  25. package/src/components/molecules/header/variants/payment/template-five/index.js +6 -5
  26. package/src/components/molecules/header/variants/payment/template-four/index.js +5 -4
  27. package/src/components/molecules/header/variants/payment/template-one-three/index.js +6 -5
  28. package/src/components/molecules/header/variants/payment/template-two/index.js +5 -4
  29. package/src/components/molecules/header/variants/slot/template-one/index.js +4 -3
  30. package/src/components/molecules/header/variants/slot/template-two/index.js +6 -5
  31. package/src/components/molecules/operator-details/index.js +8 -7
  32. package/src/components/molecules/operator-exclusive/index.js +5 -4
  33. package/src/gatsby-core-theme/components/molecules/module/index.js +2 -0
  34. package/src/gatsby-core-theme/components/molecules/star-rating/linear-rating.js +56 -0
  35. package/src/gatsby-core-theme/components/molecules/star-rating/linear-rating.module.scss +43 -0
  36. package/storybook/public/{232.72a14466.iframe.bundle.js → 232.e2508c7f.iframe.bundle.js} +1 -1
  37. package/storybook/public/582.f442a86e.iframe.bundle.js +1 -0
  38. package/storybook/public/679.144f0a65.iframe.bundle.js +1 -0
  39. package/storybook/public/{912.6f6e8178.iframe.bundle.js → 717.420d37ed.iframe.bundle.js} +4 -4
  40. package/storybook/public/{912.6f6e8178.iframe.bundle.js.map → 717.420d37ed.iframe.bundle.js.map} +1 -1
  41. package/storybook/public/941.a249aa66.iframe.bundle.js +1 -0
  42. package/storybook/public/iframe.html +1 -1
  43. package/storybook/public/main.58ab21ce.iframe.bundle.js +1 -0
  44. package/storybook/public/project.json +1 -1
  45. package/storybook/public/runtime~main.ab877657.iframe.bundle.js +1 -0
  46. package/storybook/public/679.4fbb874f.iframe.bundle.js +0 -1
  47. package/storybook/public/909.b439deb7.iframe.bundle.js +0 -1
  48. package/storybook/public/main.fcc4bb69.iframe.bundle.js +0 -1
  49. package/storybook/public/runtime~main.40bd7856.iframe.bundle.js +0 -1
  50. /package/storybook/public/{912.6f6e8178.iframe.bundle.js.LICENSE.txt → 717.420d37ed.iframe.bundle.js.LICENSE.txt} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # [53.1.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.0.31...v53.1.0) (2025-05-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * alt function alteration ([012fc3c](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/012fc3c8f10e7a4ff2ac85a80775b89a057ad277))
7
+ * hide author default image ([3930e6a](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/3930e6a3c9988208d3f0f1ad3128d4927f4cd681))
8
+ * move linear rating to matrix ([db2e50d](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/db2e50da97c9f9e73da06fff538aabc2a58885d6))
9
+ * tests ([4cbdb44](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/4cbdb44a5289eee162cfd6c2257f905e2fdc2849))
10
+ * tests ([98d7d76](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/98d7d762cffeee17247592ccb7c06395a19391b8))
11
+ * tests ([500971f](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/500971f8bd1161fbb7ff616371d72a6258c3ed88))
12
+ * update component ([7cdf5c8](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/7cdf5c8515bf5293c7422a15f3182358721dbcc0))
13
+ * update components ([5241da8](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/5241da814bd85fd88e6bce38884fb4379180e218))
14
+ * update core version ([feacafc](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/feacafc553f7178bdc711b1f329bd44a1ed0483a))
15
+ * update core version ([670d2eb](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/670d2ebb8905e692ff83cdfd81af95ff23452146))
16
+ * update linear stars component ([0c5a485](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/0c5a48532d7678d9293a4e52d874f49a5097f296))
17
+ * update modules to include rating comments ([77b3c80](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/77b3c80f49f54bbf953faee0dee86072a6dd98f0))
18
+
19
+
20
+ * Merge branch 'tm-5433-ratings-template-block' into 'master' ([e0d7a5f](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/e0d7a5f5f8f3266471a4917c5b46f6e132d62fbb))
21
+ * Merge branch 'tm-5470-custom-image-alt' into 'master' ([b5242f8](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/b5242f8b3f3f223b2ff711eedf0ccedeaae73a1b))
22
+ * Merge branch 'tm-5468-alt-text-adjustments' into 'master' ([2c89703](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/2c897030cc563909ba1c06e4594c3aa4d3baffda))
23
+ * Merge branch 'tm-5466-author-image' into 'master' ([74faabd](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/74faabdf7d98be70090d61d3e202e6fec1090587))
24
+
25
+
26
+ ### Features
27
+
28
+ * update core theme ([d593931](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/d593931d867bde6c1a8c525868fff890a50288c7))
29
+
1
30
  ## [53.0.31](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.0.30...v53.0.31) (2025-05-15)
2
31
 
3
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "53.0.31",
3
+ "version": "53.1.0",
4
4
  "main": "index.js",
5
5
  "description": "Matrix Theme NPM Package",
6
6
  "author": "",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@react-icons/all-files": "^4.1.0",
27
27
  "gatsby": "^5.11.0",
28
- "gatsby-core-theme": "44.0.39",
28
+ "gatsby-core-theme": "44.1.0",
29
29
  "gatsby-plugin-sharp": "^5.11.0",
30
30
  "gatsby-transformer-sharp": "^5.11.0",
31
31
  "gatsby-plugin-sitemap": "^6.13.1",
@@ -2,8 +2,9 @@
2
2
  /* eslint-disable camelcase */
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
6
- import { imagePrettyUrl, getAltText } from 'gatsby-core-theme/src/helpers/getters';
5
+ import LazyImage from '~hooks/lazy-image';
6
+ import { imagePrettyUrl } from '~helpers/getters';
7
+ import { getAltText } from '~helpers/image';
7
8
  import styles from './author-card.module.scss';
8
9
 
9
10
  const AuthorCard = ({ author, width = 60, height = 60 }) => {
@@ -33,15 +33,17 @@ const VariableComponent = ({
33
33
  showAuthorOnOneLine ? styles?.showAuthorOnOneLine || '' : styles?.showAuthorBlock || ''
34
34
  } `}
35
35
  >
36
- <div className={styles.authorImages}>
37
- <LazyImage
38
- alt={author?.name}
39
- width={imgSize}
40
- height={imgSize}
41
- src={imagePrettyUrl(author?.image, imgSize, imgSize)}
42
- />
43
- {verifyIcon && verifyIcon}
44
- </div>
36
+ {!!author?.image && (
37
+ <div className={styles.authorImages}>
38
+ <LazyImage
39
+ alt={author?.name}
40
+ width={imgSize}
41
+ height={imgSize}
42
+ src={imagePrettyUrl(author?.image, imgSize, imgSize)}
43
+ />
44
+ {verifyIcon && verifyIcon}
45
+ </div>
46
+ )}
45
47
  <div className={styles.authorContainer}>
46
48
  {showAuthorOnOneLine && (
47
49
  <p>
@@ -6,7 +6,9 @@ import useTranslate from '~hooks/useTranslate/useTranslate';
6
6
  import LazyImage from '~hooks/lazy-image';
7
7
  import Socials from '../../../author/socials';
8
8
  import styles from './template-one.module.scss';
9
- import { imagePrettyUrl, getAltText, textWordsLimit } from '~helpers/getters';
9
+ import { imagePrettyUrl, textWordsLimit } from '~helpers/getters';
10
+ import { getAltText } from '~helpers/image';
11
+
10
12
 
11
13
  export default function TemplateOne({ item, width = 72, height = 72 }) {
12
14
  const author = item.relation;
@@ -5,7 +5,8 @@ import useTranslate from '~hooks/useTranslate/useTranslate';
5
5
  import LazyImage from '~hooks/lazy-image';
6
6
  import Socials from '../../../author/socials';
7
7
  import styles from './template-two.module.scss';
8
- import { imagePrettyUrl, getAltText } from '~helpers/getters';
8
+ import { imagePrettyUrl } from '~helpers/getters';
9
+ import { getAltText } from '~helpers/image';
9
10
 
10
11
  export default function TemplateTwo({ item, width = 80, height = 80 }) {
11
12
  const author = item.relation;
@@ -3,16 +3,16 @@ import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import {
5
5
  imagePrettyUrl,
6
- getSectionExtraField,
7
- getAltText,
8
- } from 'gatsby-core-theme/src/helpers/getters';
9
- import Button from 'gatsby-core-theme/src/components/atoms/button/button';
10
- import OperatorCta from 'gatsby-core-theme/src/components/atoms/button/operator-cta';
11
- import GatsbyImg from 'gatsby-core-theme/src/hooks/gatsby-img';
12
- import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating';
13
- import OneStarRating from 'gatsby-core-theme/src/components/molecules/star-rating/one-star';
14
- import Link from 'gatsby-core-theme/src/hooks/link';
15
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
6
+ getSectionExtraField
7
+ } from '~helpers/getters';
8
+ import Button from '~atoms/button/button';
9
+ import OperatorCta from '~atoms/button/operator-cta';
10
+ import GatsbyImg from '~hooks/gatsby-img';
11
+ import StarRating from '~molecules/star-rating';
12
+ import OneStarRating from '~molecules/star-rating/one-star';
13
+ import Link from '~hooks/link';
14
+ import LazyImage from '~hooks/lazy-image';
15
+ import { getAltText } from '~helpers/image';
16
16
  import useTranslate from '~hooks/useTranslate/useTranslate';
17
17
  import { TrackingKeys } from '~constants/tracking-api'
18
18
 
@@ -4,15 +4,15 @@ import PropTypes from 'prop-types';
4
4
  import {
5
5
  imagePrettyUrl,
6
6
  getSectionExtraField,
7
- getAltText,
8
- } from 'gatsby-core-theme/src/helpers/getters';
9
- import Button from 'gatsby-core-theme/src/components/atoms/button/button';
10
- import OperatorCta from 'gatsby-core-theme/src/components/atoms/button/operator-cta';
11
- import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating';
12
- import OneStarRating from 'gatsby-core-theme/src/components/molecules/star-rating/one-star';
13
- import GatsbyImg from 'gatsby-core-theme/src/hooks/gatsby-img';
14
- import Link from 'gatsby-core-theme/src/hooks/link';
15
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
7
+ } from '~helpers/getters';
8
+ import { getAltText } from '~helpers/image';
9
+ import Button from '~atoms/button/button';
10
+ import OperatorCta from '~atoms/button/operator-cta';
11
+ import StarRating from '~molecules/star-rating';
12
+ import OneStarRating from '~molecules/star-rating/one-star';
13
+ import GatsbyImg from '~hooks/gatsby-img';
14
+ import Link from '~hooks/link';
15
+ import LazyImage from '~hooks/lazy-image';
16
16
  import useTranslate from '~hooks/useTranslate/useTranslate';
17
17
  import { TrackingKeys } from '~constants/tracking-api'
18
18
  import styles from './template-four.module.scss';
@@ -3,15 +3,15 @@ import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import {
5
5
  imagePrettyUrl,
6
- getSectionExtraField,
7
- getAltText,
8
- } from 'gatsby-core-theme/src/helpers/getters';
9
- import Button from 'gatsby-core-theme/src/components/atoms/button/button';
10
- import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating/one-star';
11
- import OperatorCta from 'gatsby-core-theme/src/components/atoms/button/operator-cta';
12
- import GatsbyImg from 'gatsby-core-theme/src/hooks/gatsby-img';
13
- import Link from 'gatsby-core-theme/src/hooks/link';
14
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
6
+ getSectionExtraField
7
+ } from '~helpers/getters';
8
+ import { getAltText } from '~helpers/image';
9
+ import Button from '~atoms/button/button';
10
+ import StarRating from '~molecules/star-rating/one-star';
11
+ import OperatorCta from '~atoms/button/operator-cta';
12
+ import GatsbyImg from '~hooks/gatsby-img';
13
+ import Link from '~hooks/link';
14
+ import LazyImage from '~hooks/lazy-image';
15
15
  import useTranslate from '~hooks/useTranslate/useTranslate';
16
16
  import { TrackingKeys } from '~constants/tracking-api';
17
17
  import styles from './template-one.module.scss';
@@ -3,16 +3,16 @@ import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import {
5
5
  imagePrettyUrl,
6
- getSectionExtraField,
7
- getAltText,
8
- } from 'gatsby-core-theme/src/helpers/getters';
9
- import Button from 'gatsby-core-theme/src/components/atoms/button/button';
10
- import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating';
11
- import OneStarRating from 'gatsby-core-theme/src/components/molecules/star-rating/one-star';
12
- import OperatorCta from 'gatsby-core-theme/src/components/atoms/button/operator-cta';
13
- import GatsbyImg from 'gatsby-core-theme/src/hooks/gatsby-img';
14
- import Link from 'gatsby-core-theme/src/hooks/link';
15
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
6
+ getSectionExtraField
7
+ } from '~helpers/getters';
8
+ import { getAltText } from '~helpers/image';
9
+ import Button from '~atoms/button/button';
10
+ import StarRating from '~molecules/star-rating';
11
+ import OneStarRating from '~molecules/star-rating/one-star';
12
+ import OperatorCta from '~atoms/button/operator-cta';
13
+ import GatsbyImg from '~hooks/gatsby-img';
14
+ import Link from '~hooks/link';
15
+ import LazyImage from '~hooks/lazy-image';
16
16
  import useTranslate from '~hooks/useTranslate/useTranslate';
17
17
  import { TrackingKeys } from '~constants/tracking-api'
18
18
  import styles from './template-three.module.scss';
@@ -3,16 +3,16 @@ import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import {
5
5
  imagePrettyUrl,
6
- getSectionExtraField,
7
- getAltText,
8
- } from 'gatsby-core-theme/src/helpers/getters';
9
- import Button from 'gatsby-core-theme/src/components/atoms/button/button';
10
- import OperatorCta from 'gatsby-core-theme/src/components/atoms/button/operator-cta';
11
- import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating';
12
- import OneStarRating from 'gatsby-core-theme/src/components/molecules/star-rating/one-star';
13
- import GatsbyImg from 'gatsby-core-theme/src/hooks/gatsby-img';
14
- import Link from 'gatsby-core-theme/src/hooks/link';
15
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
6
+ getSectionExtraField
7
+ } from '~helpers/getters';
8
+ import { getAltText } from '~helpers/image';
9
+ import Button from '~atoms/button/button';
10
+ import OperatorCta from '~atoms/button/operator-cta';
11
+ import StarRating from '~molecules/star-rating';
12
+ import OneStarRating from '~molecules/star-rating/one-star';
13
+ import GatsbyImg from '~hooks/gatsby-img';
14
+ import Link from '~hooks/link';
15
+ import LazyImage from '~hooks/lazy-image';
16
16
  import useTranslate from '~hooks/useTranslate/useTranslate';
17
17
  import { TrackingKeys } from '~constants/tracking-api'
18
18
  import styles from './template-two.module.scss';
@@ -2,12 +2,13 @@
2
2
  /* eslint-disable import/no-extraneous-dependencies */
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import Button from 'gatsby-core-theme/src/components/atoms/button/button';
6
- import Link from 'gatsby-core-theme/src/hooks/link';
7
- import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating/one-star';
8
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
9
- import { getAltText, imagePrettyUrl, textWordsLimit } from 'gatsby-core-theme/src/helpers/getters';
10
5
  import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
6
+ import Button from '~atoms/button/button';
7
+ import Link from '~hooks/link';
8
+ import StarRating from '~molecules/star-rating/one-star';
9
+ import LazyImage from '~hooks/lazy-image';
10
+ import { imagePrettyUrl, textWordsLimit } from '~helpers/getters';
11
+ import { getAltText } from '~helpers/image';
11
12
  import useTranslate from '~hooks/useTranslate/useTranslate';
12
13
  import SellingPoints from '../sellingPoints';
13
14
  import styles from './template-one.module.scss';
@@ -2,13 +2,14 @@
2
2
  /* eslint-disable import/no-extraneous-dependencies */
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import Link from 'gatsby-core-theme/src/hooks/link';
6
- import Button from 'gatsby-core-theme/src/components/atoms/button/button';
7
- import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating';
8
- import OneStarRating from 'gatsby-core-theme/src/components/molecules/star-rating/one-star';
9
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
10
- import { getAltText, imagePrettyUrl } from 'gatsby-core-theme/src/helpers/getters';
11
5
  import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
6
+ import Link from '~hooks/link';
7
+ import Button from '~atoms/button/button';
8
+ import StarRating from '~molecules/star-rating';
9
+ import OneStarRating from '~molecules/star-rating/one-star';
10
+ import LazyImage from '~hooks/lazy-image';
11
+ import { imagePrettyUrl } from '~helpers/getters';
12
+ import { getAltText } from '~helpers/image';
12
13
  import SellingPoints from '../sellingPoints';
13
14
  import styles from './template-three.module.scss';
14
15
 
@@ -1,12 +1,13 @@
1
1
  /* eslint-disable import/no-extraneous-dependencies */
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import OperatorCta from 'gatsby-core-theme/src/components/atoms/button/operator-cta';
5
- import { getAltText, imagePrettyUrl } from 'gatsby-core-theme/src/helpers/getters';
6
- import ReviewLink from 'gatsby-core-theme/src/components/atoms/review-link';
7
- import Tnc from 'gatsby-core-theme/src/components/molecules/tnc';
8
- import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating';
9
- import Bonus from 'gatsby-core-theme/src/components/molecules/bonus-box/template-one';
4
+ import OperatorCta from '~atoms/button/operator-cta';
5
+ import { imagePrettyUrl } from '~helpers/getters';
6
+ import { getAltText } from '~helpers/image';
7
+ import ReviewLink from '~atoms/review-link';
8
+ import Tnc from '~molecules/tnc';
9
+ import StarRating from '~molecules/star-rating';
10
+ import Bonus from '~molecules/bonus-box/template-one';
10
11
  import LazyImage from '~hooks/lazy-image';
11
12
  import { TrackingKeys } from '~constants/tracking-api'
12
13
  import styles from './popup-card.module.scss';
@@ -1,9 +1,10 @@
1
1
  /* eslint-disable import/no-extraneous-dependencies */
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import Link from 'gatsby-core-theme/src/hooks/link';
5
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
6
- import { getAltText, imagePrettyUrl, textWordsLimit } from 'gatsby-core-theme/src/helpers/getters';
4
+ import Link from '~hooks/link';
5
+ import LazyImage from '~hooks/lazy-image';
6
+ import { imagePrettyUrl, textWordsLimit } from '~helpers/getters';
7
+ import { getAltText } from '~helpers/image';
7
8
 
8
9
  import styles from './software-provider-card.module.scss';
9
10
 
@@ -2,14 +2,14 @@
2
2
  import React, { useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Link } from 'gatsby';
5
- import { imagePrettyUrl, getAltText } from 'gatsby-core-theme/src/helpers/getters.mjs';
6
- import { BiLike } from '@react-icons/all-files/bi/BiLike';
7
5
  import { BiDislike } from '@react-icons/all-files/bi/BiDislike';
8
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
9
-
10
- import ModalProvider from 'gatsby-core-theme/src/hooks/modal/modalContext';
11
- import Modal from 'gatsby-core-theme/src/hooks/modal';
12
- import ModalContent from 'gatsby-core-theme/src/hooks/modal/modal-content';
6
+ import { BiLike } from '@react-icons/all-files/bi/BiLike';
7
+ import { imagePrettyUrl } from '~helpers/getters.mjs';
8
+ import { getAltText } from '~helpers/image';
9
+ import LazyImage from '~hooks/lazy-image';
10
+ import ModalProvider from '~hooks/modal/modalContext';
11
+ import Modal from '~hooks/modal';
12
+ import ModalContent from '~hooks/modal/modal-content';
13
13
  import { addVote } from '../../../../services';
14
14
  import useTranslate from '~hooks/useTranslate/useTranslate';
15
15
 
@@ -2,10 +2,11 @@
2
2
  import React, { useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Link } from 'gatsby';
5
- import { imagePrettyUrl, getAltText } from 'gatsby-core-theme/src/helpers/getters.mjs';
6
- import { BiLike } from '@react-icons/all-files/bi/BiLike';
7
5
  import { BiDislike } from '@react-icons/all-files/bi/BiDislike';
8
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
6
+ import { BiLike } from '@react-icons/all-files/bi/BiLike';
7
+ import { imagePrettyUrl } from '~helpers/getters.mjs';
8
+ import { getAltText } from '~helpers/image';
9
+ import LazyImage from '~hooks/lazy-image';
9
10
  import useTranslate from '~hooks/useTranslate/useTranslate';
10
11
  import { addVote } from '../../../../services';
11
12
 
@@ -0,0 +1,133 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { getObjectValue } from 'gatsby-core-theme/src/helpers/getters';
4
+ import keygen from 'gatsby-core-theme/src/helpers/keygen';
5
+ import { FaStar } from '@react-icons/all-files/fa/FaStar';
6
+ import { operatorRatings } from 'gatsby-core-theme/src/constants/ratings-constant';
7
+ import useTranslate from '~hooks/useTranslate/useTranslate';
8
+ import styles from './ratings-with-comments.module.scss';
9
+ import LinearStarRating from '../../../gatsby-core-theme/components/molecules/star-rating/linear-rating';
10
+
11
+ const RatingsWithComments = ({
12
+ page,
13
+ numOfStars = 5,
14
+ templateWithBoxes = false,
15
+ showTitle = true,
16
+ currency = '€',
17
+ showComment = true,
18
+ icon = null,
19
+ iconColor = '#D63B54'
20
+ }) => {
21
+ const { relation: item, type } = page;
22
+ const typeCheck =
23
+ // eslint-disable-next-line no-nested-ternary
24
+ type === 'operator' ? (item?.type === 'casino' ? 'operator' : item?.type) : type;
25
+
26
+ const ratings = operatorRatings[typeCheck] || [];
27
+
28
+ const rangeText = {
29
+ 0: useTranslate('range_low', 'Low'),
30
+ 1: useTranslate('range_medium', 'Medium'),
31
+ 2: useTranslate('range_high', 'High'),
32
+ };
33
+
34
+ const ratingsData = operatorRatings.ratingProperties.some((prop) => item[prop])
35
+ ? item
36
+ : item?.bonus || item;
37
+
38
+ if (!ratings.length) {
39
+ return null;
40
+ }
41
+
42
+ const renderRatingItem = (rating) => {
43
+ const { fieldValue, translationKey, fieldLabel, componentToUse } = rating || {};
44
+ let valueDisplayed;
45
+ const value = getObjectValue(ratingsData, fieldValue);
46
+
47
+ // eslint-disable-next-line no-nested-ternary
48
+ const component = showComment ? (
49
+ <LinearStarRating
50
+ numOfStars={numOfStars}
51
+ rating={value}
52
+ icon={icon || <FaStar title="Star Icon" color={iconColor} />}
53
+ />
54
+ ) : componentToUse ? (
55
+ componentToUse(numOfStars, value, currency)
56
+ ) : (
57
+ false
58
+ );
59
+
60
+ if (component) {
61
+ valueDisplayed = component || '-';
62
+ } else if (fieldValue.includes('volatility')) {
63
+ valueDisplayed = rangeText[getObjectValue(ratingsData, fieldValue)] || '-';
64
+ } else {
65
+ valueDisplayed = value || '-';
66
+ }
67
+
68
+ const comment = showComment
69
+ ? ratingsData?.rating_comments?.find((entry) => entry?.rating_name === fieldValue)?.comment
70
+ : null;
71
+
72
+ return (
73
+ <li
74
+ key={keygen()}
75
+ className={`${styles?.item || ''} ${fieldLabel === 'Overall' && styles?.overall}`}
76
+ >
77
+ <p className={styles?.label || ''}>{useTranslate(translationKey, fieldLabel)}</p>
78
+
79
+ <>
80
+ {valueDisplayed}
81
+ {typeof valueDisplayed === 'number' && fieldValue === 'rtp' && '%'}
82
+ {comment && <span className={styles?.comment}>{comment}</span>}
83
+ </>
84
+ </li>
85
+ );
86
+ };
87
+ return (
88
+ <div
89
+ className={`${styles.ratingsContainer} ${templateWithBoxes && styles.ratingWithBoxes} ${
90
+ showComment ? styles.ratingsWithComments : ''
91
+ }`}
92
+ >
93
+ {showTitle ? (
94
+ <div className={styles.withTitle || ''}>
95
+ <h3>{useTranslate('ratings_with_comments_title', 'Ratings')}</h3>
96
+ {ratings
97
+ ?.filter((rating) => rating.fieldLabel === 'Overall')
98
+ .map((rating) => renderRatingItem(rating))}
99
+ </div>
100
+ ) : (
101
+ ratings
102
+ ?.filter((rating) => rating.fieldLabel === 'Overall')
103
+ .map((rating) => renderRatingItem(rating))
104
+ )}
105
+
106
+ {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}
107
+ <ul className={`${styles?.ratingList || ''}`} tabIndex={0}>
108
+ {ratings
109
+ ?.filter((rating) => rating.fieldLabel !== 'Overall')
110
+ .map((rating) => renderRatingItem(rating))}
111
+ </ul>
112
+ </div>
113
+ );
114
+ };
115
+
116
+ RatingsWithComments.propTypes = {
117
+ page: PropTypes.shape({
118
+ relation: PropTypes.shape({
119
+ type: PropTypes.string,
120
+ bonus: PropTypes.shape({}),
121
+ }),
122
+ type: PropTypes.shape({}),
123
+ }),
124
+ numOfStars: PropTypes.number,
125
+ templateWithBoxes: PropTypes.bool,
126
+ showTitle: PropTypes.string,
127
+ currency: PropTypes.string,
128
+ showComment: PropTypes.bool,
129
+ icon: PropTypes.element,
130
+ iconColor: PropTypes.string,
131
+ };
132
+
133
+ export default RatingsWithComments;