gatsby-matrix-theme 53.3.14 → 53.3.15
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,10 @@
|
|
|
1
|
+
## [53.3.15](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.3.14...v53.3.15) (2025-11-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update sticky banner ([d9b9869](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/commit/d9b9869b7711c84dced4333f7bfd44e2cf36e6cc))
|
|
7
|
+
|
|
1
8
|
## [53.3.14](https://gitlab.com/g2m-gentoo/team-floyd/themes/matrix-theme/compare/v53.3.13...v53.3.14) (2025-11-05)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-matrix-theme",
|
|
3
|
-
"version": "53.3.
|
|
3
|
+
"version": "53.3.15",
|
|
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.6.
|
|
28
|
+
"gatsby-core-theme": "44.6.1",
|
|
29
29
|
"gatsby-plugin-sharp": "^5.11.0",
|
|
30
30
|
"gatsby-transformer-sharp": "^5.11.0",
|
|
31
31
|
"gatsby-plugin-sitemap": "^6.13.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { imagePrettyUrl } from '~helpers/getters';
|
|
3
|
+
import { imagePrettyUrl, removeDomain } from '~helpers/getters';
|
|
4
4
|
import LazyImage from '~hooks/lazy-image';
|
|
5
5
|
import PrettyLink from '~atoms/pretty-link';
|
|
6
6
|
import styles from './stickyOperatorBanner.module.scss';
|
|
@@ -12,13 +12,13 @@ const StickyOperatorBanner = ({ data, template }) => {
|
|
|
12
12
|
return array[randomIndex];
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const gif = data?.extra_fields?.gif;
|
|
16
15
|
const toplist = data?.modules?.find((module) => module.name === 'top_list');
|
|
17
16
|
const tracker = toplist?.items?.[0]?.tracker || 'main';
|
|
18
17
|
const randomItem = getRandomItem(toplist?.items?.[0]?.items);
|
|
18
|
+
const gifUrl = randomItem?.extra_fields?.gif?.url;
|
|
19
|
+
if (!gifUrl || !randomItem) return null;
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const filename = removeDomain(gifUrl);
|
|
22
22
|
return (
|
|
23
23
|
<PrettyLink
|
|
24
24
|
operator={randomItem}
|
|
@@ -26,7 +26,7 @@ const StickyOperatorBanner = ({ data, template }) => {
|
|
|
26
26
|
template={template}
|
|
27
27
|
className={styles.container}
|
|
28
28
|
>
|
|
29
|
-
<LazyImage src={imagePrettyUrl(
|
|
29
|
+
<LazyImage src={imagePrettyUrl(filename, 'auto', 'auto')} alt="Sticky Operator Banner" />
|
|
30
30
|
</PrettyLink>
|
|
31
31
|
);
|
|
32
32
|
};
|
|
@@ -42,7 +42,7 @@ StickyOperatorBanner.propTypes = {
|
|
|
42
42
|
items: PropTypes.arrayOf(
|
|
43
43
|
PropTypes.shape({
|
|
44
44
|
tracker: PropTypes.string,
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
items: PropTypes.shape({}),
|
|
47
47
|
})
|
|
48
48
|
),
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
/* eslint-disable react/destructuring-assignment */
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { render, screen } from '@testing-library/react';
|
|
5
|
-
import StickyOperatorBanner from
|
|
5
|
+
import StickyOperatorBanner from '.';
|
|
6
6
|
|
|
7
7
|
// Mock dependencies
|
|
8
8
|
jest.mock('~helpers/getters', () => ({
|
|
9
9
|
imagePrettyUrl: jest.fn((url) => `pretty/${url}`),
|
|
10
|
+
removeDomain: jest.fn((url) => url), // MOCK removeDomain
|
|
10
11
|
}));
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
jest.mock('~hooks/lazy-image', () => (props) => (
|
|
14
|
+
<img data-testid="lazy-image" {...props} alt="Test" />
|
|
15
|
+
));
|
|
12
16
|
jest.mock('~atoms/pretty-link', () => (props) => (
|
|
13
17
|
<a data-testid="pretty-link" {...props}>
|
|
14
18
|
{props.children}
|
|
@@ -17,7 +21,6 @@ jest.mock('~atoms/pretty-link', () => (props) => (
|
|
|
17
21
|
|
|
18
22
|
describe('StickyOperatorBanner', () => {
|
|
19
23
|
const mockData = {
|
|
20
|
-
extra_fields: { gif: 'banner.gif' },
|
|
21
24
|
modules: [
|
|
22
25
|
{
|
|
23
26
|
name: 'top_list',
|
|
@@ -25,8 +28,8 @@ describe('StickyOperatorBanner', () => {
|
|
|
25
28
|
{
|
|
26
29
|
tracker: 'test-tracker',
|
|
27
30
|
items: [
|
|
28
|
-
{ id: 1, name: 'Operator A' },
|
|
29
|
-
{ id: 2, name: 'Operator B' },
|
|
31
|
+
{ id: 1, name: 'Operator A', extra_fields: { gif: { url: 'banner.gif' } } },
|
|
32
|
+
{ id: 2, name: 'Operator B', extra_fields: { gif: { url: 'banner2.gif' } } },
|
|
30
33
|
],
|
|
31
34
|
},
|
|
32
35
|
],
|
|
@@ -34,6 +37,15 @@ describe('StickyOperatorBanner', () => {
|
|
|
34
37
|
],
|
|
35
38
|
};
|
|
36
39
|
|
|
40
|
+
// Always pick first item for deterministic test
|
|
41
|
+
beforeAll(() => {
|
|
42
|
+
jest.spyOn(Math, 'random').mockReturnValue(0);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
afterAll(() => {
|
|
46
|
+
jest.spyOn(Math, 'random').mockRestore();
|
|
47
|
+
});
|
|
48
|
+
|
|
37
49
|
it('renders banner with LazyImage and PrettyLink', () => {
|
|
38
50
|
render(<StickyOperatorBanner data={mockData} template="casino" />);
|
|
39
51
|
|
|
@@ -41,31 +53,37 @@ describe('StickyOperatorBanner', () => {
|
|
|
41
53
|
const link = screen.getByTestId('pretty-link');
|
|
42
54
|
|
|
43
55
|
expect(image).toBeInTheDocument();
|
|
44
|
-
expect(image).toHaveAttribute('src', 'pretty/banner.gif');
|
|
56
|
+
expect(image).toHaveAttribute('src', 'pretty/banner.gif'); // now deterministic
|
|
45
57
|
expect(link).toBeInTheDocument();
|
|
46
58
|
});
|
|
47
59
|
|
|
48
|
-
it('renders null if gif is missing', () => {
|
|
49
|
-
const dataWithoutGif = {
|
|
60
|
+
it('renders null if gif is missing in randomItem', () => {
|
|
61
|
+
const dataWithoutGif = {
|
|
62
|
+
modules: [
|
|
63
|
+
{
|
|
64
|
+
name: 'top_list',
|
|
65
|
+
items: [{ items: [{ id: 1, name: 'Operator A', extra_fields: {} }] }],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
};
|
|
50
69
|
const { container } = render(<StickyOperatorBanner data={dataWithoutGif} />);
|
|
51
70
|
expect(container.firstChild).toBeNull();
|
|
52
71
|
});
|
|
53
72
|
|
|
54
73
|
it('renders null if toplist items missing', () => {
|
|
55
|
-
const dataWithoutItems = {
|
|
74
|
+
const dataWithoutItems = { modules: [] };
|
|
56
75
|
const { container } = render(<StickyOperatorBanner data={dataWithoutItems} />);
|
|
57
76
|
expect(container.firstChild).toBeNull();
|
|
58
77
|
});
|
|
59
78
|
|
|
60
79
|
it('uses default tracker if not provided', () => {
|
|
61
80
|
const dataNoTracker = {
|
|
62
|
-
extra_fields: { gif: 'banner.gif' },
|
|
63
81
|
modules: [
|
|
64
82
|
{
|
|
65
83
|
name: 'top_list',
|
|
66
84
|
items: [
|
|
67
85
|
{
|
|
68
|
-
items: [{ id: 1, name: 'Operator X' }],
|
|
86
|
+
items: [{ id: 1, name: 'Operator X', extra_fields: { gif: { url: 'banner.gif' } } }],
|
|
69
87
|
},
|
|
70
88
|
],
|
|
71
89
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"generatedAt":
|
|
1
|
+
{"generatedAt":1762359862613,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":false,"refCount":0,"metaFramework":{"name":"Gatsby","packageName":"gatsby","version":"5.13.6"},"monorepo":"Workspaces","packageManager":{"type":"yarn","version":"1.22.19"},"storybookVersion":"6.5.16","language":"javascript","storybookPackages":{"@storybook/addon-actions":{"version":"6.5.16"},"@storybook/builder-webpack5":{"version":"6.5.16"},"@storybook/manager-webpack5":{"version":"6.5.16"},"@storybook/react":{"version":"6.5.16"}},"framework":{"name":"react"},"addons":{"@storybook/addon-links":{"version":"6.5.16"},"@storybook/addon-essentials":{"version":"6.5.16"}}}
|