gatsby-core-theme 44.5.0-poc.2 → 44.5.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/.ci.yml +2 -28
- package/CHANGELOG.md +233 -29
- package/gatsby-browser.js +48 -100
- package/gatsby-node.mjs +25 -21
- package/package.json +1 -1
- package/release.config.js +0 -5
- package/src/components/atoms/admin/button/index.js +1 -1
- package/src/components/atoms/author/index.js +6 -5
- package/src/components/atoms/collapse/collapse.test.js +113 -26
- package/src/components/atoms/collapse/index.js +23 -1
- package/src/components/atoms/comment-votes/comment-votes.module.scss +34 -0
- package/src/components/atoms/comment-votes/index.js +93 -0
- package/src/components/atoms/ratings/index.js +7 -0
- package/src/components/atoms/ratings/rating.test.js +1 -1
- package/src/components/molecules/comment/comment.module.scss +42 -74
- package/src/components/molecules/comment/index.js +108 -134
- package/src/components/molecules/header/variants/operator/template-one-two/index.js +4 -3
- package/src/components/molecules/header/variants/operator/template-one-two/template-one-two.stories.js +4 -3
- package/src/components/molecules/header/variants/operator/template-one-two/template-one-two.test.js +8 -8
- package/src/components/molecules/header/variants/slot/template-one/index.js +4 -3
- package/src/components/molecules/header/variants/slot/template-one/template-one.stories.js +4 -3
- package/src/components/molecules/leave-comment-form/index.js +25 -19
- package/src/components/molecules/spotlights_v2/icon/template-one/index.js +1 -1
- package/src/components/organisms/anchor/template-one/anchor.module.scss +19 -11
- package/src/components/organisms/archive/index.js +5 -2
- package/src/components/organisms/comments/comment-tree/comment-tree.module.scss +47 -0
- package/src/components/organisms/comments/comment-tree/index.js +8 -7
- package/src/components/organisms/comments/index.js +14 -26
- package/src/components/organisms/cookie-consent/index.js +48 -34
- package/src/components/organisms/form/fields/fields.module.scss +7 -4
- package/src/components/organisms/form/fields/index.js +101 -56
- package/src/components/organisms/form/form.module.scss +131 -39
- package/src/components/organisms/form/form.test.js +28 -33
- package/src/components/organisms/form/index.js +138 -78
- package/src/constants/forms.js +65 -14
- package/src/constants/ratings-constant.js +5 -0
- package/src/constants/schema.js +1 -0
- package/src/constants/settings.mjs +0 -1
- package/src/context/VotesProvider.js +49 -0
- package/src/helpers/replaceMedia.js +44 -1
- package/src/helpers/schema.js +32 -0
- package/src/helpers/tracker.mjs +2 -2
- package/src/resolver/index.mjs +8 -4
- package/src/resolver/modules.mjs +9 -6
- package/src/resolver/modules.test.js +1 -1
- package/src/resolver/redirect.mjs +23 -0
- package/src/resolver/redirect.test.js +65 -1
package/gatsby-node.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
clean,
|
|
24
24
|
removeUnwantedSections,
|
|
25
25
|
} from "./src/resolver/common.mjs";
|
|
26
|
-
import { generateRedirects } from "./src/resolver/redirect.mjs";
|
|
26
|
+
import { generateRedirects, generatePrettyLinkRedirects } from "./src/resolver/redirect.mjs";
|
|
27
27
|
import { translate, is404Page } from "./src/helpers/getters.mjs";
|
|
28
28
|
import { getArchivePages, hasArchiveModule } from "./src/resolver/archive.mjs";
|
|
29
29
|
|
|
@@ -71,12 +71,10 @@ const relations = {};
|
|
|
71
71
|
|
|
72
72
|
// eslint-disable-next-line import/prefer-default-export
|
|
73
73
|
export const createPages = async (
|
|
74
|
-
{ actions: { createPage } },
|
|
74
|
+
{ actions: { createPage, createRedirect } },
|
|
75
75
|
themeOptions
|
|
76
76
|
) => {
|
|
77
77
|
process.env.GATSBY_SITE_NAME = String(themeOptions.siteName);
|
|
78
|
-
|
|
79
|
-
generateRedirects(siteSettingsData);
|
|
80
78
|
preconnectLinks = themeOptions.preconnectLinks || [];
|
|
81
79
|
console.log(chalk.magenta("info") + chalk.whiteBright(" starting processor"));
|
|
82
80
|
|
|
@@ -126,6 +124,8 @@ export const createPages = async (
|
|
|
126
124
|
streamRobotsTxt.write(robotsTxtContent);
|
|
127
125
|
streamRobotsTxt.end();
|
|
128
126
|
|
|
127
|
+
generateRedirects(siteSettingsData);
|
|
128
|
+
|
|
129
129
|
// create every single page
|
|
130
130
|
Object.keys(processed.site_markets).forEach((siteMarket) => {
|
|
131
131
|
if (!processed.pages[siteMarket]["page"]) {
|
|
@@ -282,23 +282,27 @@ export const createPages = async (
|
|
|
282
282
|
}
|
|
283
283
|
});
|
|
284
284
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
285
|
+
if(process.env.DISABLE_SPLASH_SCREEN === 'true'){
|
|
286
|
+
generatePrettyLinkRedirects( trackingPages )
|
|
287
|
+
}else{
|
|
288
|
+
trackingPages.forEach(({ path, page, operator }) => {
|
|
289
|
+
createPage({
|
|
290
|
+
path,
|
|
291
|
+
component: `${__dirname}/src/components/${
|
|
292
|
+
process.env.IS_TRACKING_SSR === "true"
|
|
293
|
+
? "app-tracker-ssr.js"
|
|
294
|
+
: "app-tracker.js"
|
|
295
|
+
}`,
|
|
296
|
+
context: {
|
|
297
|
+
page,
|
|
298
|
+
siteGeneralData,
|
|
299
|
+
operator,
|
|
300
|
+
isTracker: true,
|
|
301
|
+
isLiveStreamProvider: false,
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
})
|
|
305
|
+
}
|
|
302
306
|
};
|
|
303
307
|
|
|
304
308
|
export const onCreatePage = async ({ page, actions }) => {
|
package/package.json
CHANGED
package/release.config.js
CHANGED
|
@@ -11,7 +11,7 @@ const getDMSLink = (module) => {
|
|
|
11
11
|
|
|
12
12
|
switch (module.name) {
|
|
13
13
|
case "top_list":
|
|
14
|
-
hercLink += `toplists/${module.items ? module.items[0].id : ""}
|
|
14
|
+
hercLink += `toplists/operators/${module.items ? module.items[0].id : ""}`;
|
|
15
15
|
linkText = "Edit Toplist";
|
|
16
16
|
break;
|
|
17
17
|
case "bonus":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
2
|
/* eslint-disable arrow-body-style */
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { lazy, Suspense } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
6
|
import { formatDate } from '~helpers/date-time';
|
|
@@ -8,10 +8,11 @@ import { imagePrettyUrl } from '~helpers/getters';
|
|
|
8
8
|
import Link from '~hooks/link';
|
|
9
9
|
import LazyImage from '~hooks/lazy-image';
|
|
10
10
|
import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
11
|
-
import Verify from '~images/icons/verify';
|
|
12
|
-
import Clock from '~images/icons/clock';
|
|
13
11
|
import styles from './author.module.scss';
|
|
14
12
|
|
|
13
|
+
const VerifyIcon = lazy(() => import('~images/icons/verify'));
|
|
14
|
+
const ClockIcon = lazy(() => import('~images/icons/clock'));
|
|
15
|
+
|
|
15
16
|
const Author = ({
|
|
16
17
|
name,
|
|
17
18
|
date,
|
|
@@ -26,11 +27,11 @@ const Author = ({
|
|
|
26
27
|
isCardsAuthor = false,
|
|
27
28
|
hasAuthorBox = false,
|
|
28
29
|
reviewer,
|
|
29
|
-
clock = <
|
|
30
|
+
clock = <Suspense fallback={null}><ClockIcon /></Suspense>,
|
|
30
31
|
authorImageWidth = 30,
|
|
31
32
|
authorImageHeight = 30,
|
|
32
33
|
showVerification = false,
|
|
33
|
-
verifyIcon = <
|
|
34
|
+
verifyIcon = <Suspense fallback={null}><VerifyIcon /></Suspense>,
|
|
34
35
|
}) => {
|
|
35
36
|
const prefixstyle = !link || !authorImg;
|
|
36
37
|
|
|
@@ -1,50 +1,137 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
|
-
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { render, cleanup, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { render, cleanup, fireEvent, waitFor } from '@testing-library/react';
|
|
5
4
|
import '@testing-library/jest-dom/extend-expect';
|
|
6
5
|
import Collapse from '.';
|
|
7
6
|
|
|
8
7
|
describe('Collapse Component', () => {
|
|
9
|
-
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
cleanup();
|
|
10
|
+
jest.restoreAllMocks();
|
|
11
|
+
delete HTMLElement.prototype.scrollHeight;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const setup = (props = {}) =>
|
|
15
|
+
render(
|
|
16
|
+
<Collapse
|
|
17
|
+
buttonText="Toggle"
|
|
18
|
+
contentText="Test Content"
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
test('renders with button and string content', () => {
|
|
24
|
+
const { getByText } = setup();
|
|
25
|
+
expect(getByText('Toggle')).toBeInTheDocument();
|
|
26
|
+
expect(getByText('Test Content')).toBeInTheDocument();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('renders with React element as contentText', () => {
|
|
30
|
+
const { getByText } = render(
|
|
31
|
+
<Collapse
|
|
32
|
+
buttonText="Toggle"
|
|
33
|
+
contentText={<p>JSX Content</p>}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
expect(getByText('JSX Content')).toBeInTheDocument();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('opens when initOpen is true', async () => {
|
|
40
|
+
const scrollHeightMock = 200;
|
|
41
|
+
Object.defineProperty(HTMLElement.prototype, 'scrollHeight', {
|
|
42
|
+
configurable: true,
|
|
43
|
+
get: () => scrollHeightMock,
|
|
44
|
+
});
|
|
45
|
+
|
|
10
46
|
const { container } = render(
|
|
11
|
-
<Collapse
|
|
47
|
+
<Collapse
|
|
48
|
+
buttonText="Toggle"
|
|
49
|
+
contentText="Test Content"
|
|
50
|
+
initOpen
|
|
51
|
+
onlyMobile
|
|
52
|
+
/>
|
|
12
53
|
);
|
|
13
54
|
|
|
14
|
-
const
|
|
15
|
-
|
|
55
|
+
const contentDiv = container.querySelector('div[style]');
|
|
56
|
+
expect(contentDiv).toBeInTheDocument();
|
|
16
57
|
|
|
17
|
-
|
|
18
|
-
|
|
58
|
+
await waitFor(() => {
|
|
59
|
+
expect(contentDiv.style.maxHeight).toBe(`${scrollHeightMock}px`);
|
|
60
|
+
});
|
|
19
61
|
});
|
|
20
62
|
|
|
21
|
-
test('
|
|
22
|
-
const
|
|
63
|
+
test('toggles open/close on click', () => {
|
|
64
|
+
const scrollHeightMock = 300;
|
|
65
|
+
|
|
66
|
+
Object.defineProperty(HTMLElement.prototype, 'scrollHeight', {
|
|
67
|
+
configurable: true,
|
|
68
|
+
get: () => scrollHeightMock,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const { container, getByText } = setup({ onlyMobile: true });
|
|
72
|
+
|
|
73
|
+
const contentDiv = container.querySelector('div[style]');
|
|
74
|
+
expect(contentDiv).not.toBeNull();
|
|
75
|
+
|
|
76
|
+
const button = getByText('Toggle');
|
|
23
77
|
|
|
24
|
-
const button = container.querySelector('button');
|
|
25
|
-
expect(button.classList.contains('active')).toBeFalsy();
|
|
26
78
|
fireEvent.click(button);
|
|
27
|
-
|
|
79
|
+
expect(contentDiv.style.maxHeight).toBe(`${scrollHeightMock}px`);
|
|
80
|
+
|
|
81
|
+
fireEvent.click(button);
|
|
82
|
+
expect(['0', '0px']).toContain(contentDiv.style.maxHeight);
|
|
28
83
|
});
|
|
29
84
|
|
|
30
|
-
test('
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
-
);
|
|
85
|
+
test('renders correctly with onlyMobile and onlyDesktop props', () => {
|
|
86
|
+
const { getByText } = setup({ onlyMobile: true });
|
|
87
|
+
expect(getByText('Toggle')).toBeInTheDocument();
|
|
34
88
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
89
|
+
cleanup();
|
|
90
|
+
|
|
91
|
+
const { getByText: getByText2 } = setup({ onlyDesktop: true });
|
|
92
|
+
expect(getByText2('Toggle')).toBeInTheDocument();
|
|
38
93
|
});
|
|
39
94
|
|
|
40
|
-
test('
|
|
95
|
+
test('closes on outside click when closeOnOutsideClick is true', async () => {
|
|
96
|
+
const scrollHeightMock = 100;
|
|
97
|
+
|
|
98
|
+
Object.defineProperty(HTMLElement.prototype, 'scrollHeight', {
|
|
99
|
+
configurable: true,
|
|
100
|
+
get: () => scrollHeightMock,
|
|
101
|
+
});
|
|
102
|
+
|
|
41
103
|
const { container } = render(
|
|
42
|
-
<
|
|
104
|
+
<div>
|
|
105
|
+
<Collapse
|
|
106
|
+
buttonText="Toggle"
|
|
107
|
+
contentText="Test Content"
|
|
108
|
+
initOpen
|
|
109
|
+
closeOnOutsideClick
|
|
110
|
+
onlyMobile
|
|
111
|
+
/>
|
|
112
|
+
<div data-testid="outside">Outside</div>
|
|
113
|
+
</div>
|
|
43
114
|
);
|
|
44
115
|
|
|
45
|
-
|
|
116
|
+
const contentDiv = container.querySelector('div[style]');
|
|
117
|
+
expect(contentDiv).not.toBeNull();
|
|
118
|
+
expect(contentDiv.style.maxHeight).toBe(`${scrollHeightMock}px`);
|
|
119
|
+
|
|
120
|
+
const outside = container.querySelector('[data-testid="outside"]');
|
|
121
|
+
fireEvent.mouseDown(outside);
|
|
122
|
+
|
|
123
|
+
await waitFor(() => {
|
|
124
|
+
expect(['0', '0px']).toContain(contentDiv.style.maxHeight);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('does not apply maxHeight when onlyMobile and onlyDesktop are false', () => {
|
|
129
|
+
const { container } = setup({ initOpen: true });
|
|
130
|
+
|
|
131
|
+
const divs = container.querySelectorAll('div');
|
|
132
|
+
const contentDiv = Array.from(divs).find(div =>
|
|
133
|
+
div.innerHTML.includes('Test Content')
|
|
134
|
+
);
|
|
135
|
+
expect(contentDiv.style.maxHeight).toBe('');
|
|
46
136
|
});
|
|
47
|
-
});
|
|
48
|
-
afterEach(() => {
|
|
49
|
-
cleanup();
|
|
50
137
|
});
|
|
@@ -10,9 +10,11 @@ const Collapse = ({
|
|
|
10
10
|
onlyDesktop = false,
|
|
11
11
|
initOpen = false,
|
|
12
12
|
maxHeight = 0,
|
|
13
|
+
closeOnOutsideClick = false,
|
|
13
14
|
}) => {
|
|
14
15
|
const [maxHeightStyle, setMaxHeightStyle] = useState(maxHeight);
|
|
15
16
|
const contentRef = useRef(React.createRef());
|
|
17
|
+
const containerRef = useRef(null);
|
|
16
18
|
|
|
17
19
|
useEffect(() => {
|
|
18
20
|
if (initOpen) {
|
|
@@ -20,6 +22,22 @@ const Collapse = ({
|
|
|
20
22
|
}
|
|
21
23
|
}, [initOpen]);
|
|
22
24
|
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!closeOnOutsideClick || maxHeightStyle === 0) return;
|
|
28
|
+
|
|
29
|
+
const handleClickOutside = (event) => {
|
|
30
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
31
|
+
setMaxHeightStyle(0);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
36
|
+
return () => {
|
|
37
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
38
|
+
};
|
|
39
|
+
}, [closeOnOutsideClick, maxHeightStyle]);
|
|
40
|
+
|
|
23
41
|
const clickHandler = () => {
|
|
24
42
|
if (maxHeightStyle === 0) {
|
|
25
43
|
setMaxHeightStyle(contentRef.current.scrollHeight);
|
|
@@ -29,7 +47,10 @@ const Collapse = ({
|
|
|
29
47
|
};
|
|
30
48
|
|
|
31
49
|
return (
|
|
32
|
-
<div
|
|
50
|
+
<div
|
|
51
|
+
ref={containerRef}
|
|
52
|
+
className={styles?.collapseContainer || ''}
|
|
53
|
+
>
|
|
33
54
|
<div className={maxHeightStyle !== 0 ? styles?.active || '' : ''}>
|
|
34
55
|
<button
|
|
35
56
|
type="button"
|
|
@@ -74,6 +95,7 @@ Collapse.propTypes = {
|
|
|
74
95
|
onlyDesktop: PropTypes.bool,
|
|
75
96
|
initOpen: PropTypes.bool,
|
|
76
97
|
maxHeight: PropTypes.number,
|
|
98
|
+
closeOnOutsideClick: PropTypes.bool,
|
|
77
99
|
};
|
|
78
100
|
|
|
79
101
|
export default Collapse;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.buttonGroup{
|
|
2
|
+
background: var(--comment-vote-bg, #EAE5E0);
|
|
3
|
+
font-size: var(--comment-vote-font-size, 1.2rem);
|
|
4
|
+
padding: var(--comment-vote-padding, .5rem .8rem);
|
|
5
|
+
height: var(--comment-vote-height, 2.8rem);
|
|
6
|
+
gap: .4rem;
|
|
7
|
+
color: #0F172A;
|
|
8
|
+
|
|
9
|
+
@include flex-align(center, center);
|
|
10
|
+
|
|
11
|
+
&.left{
|
|
12
|
+
border-bottom-left-radius: var(--comment-vote-border-radius, 5rem);
|
|
13
|
+
border-top-left-radius: var(--comment-vote-border-radius, 5rem);
|
|
14
|
+
padding-right: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.right{
|
|
18
|
+
border-bottom-right-radius: var(--comment-vote-border-radius, 5rem);
|
|
19
|
+
border-top-right-radius: var(--comment-vote-border-radius, 5rem);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.buttonGroupIcon{
|
|
24
|
+
width: var(--comment-vote-icon-size, 1.6rem);
|
|
25
|
+
height: var(--comment-vote-icon-size, 1.6rem);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.buttonGroup[disabled]{
|
|
29
|
+
cursor: default !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.disabled > *{
|
|
33
|
+
opacity: .3;
|
|
34
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
4
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
5
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
6
|
+
import React, { useContext } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import LazyImage from '~hooks/lazy-image';
|
|
9
|
+
import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
10
|
+
import { useVote, VotesContext } from '../../../context/VotesProvider';
|
|
11
|
+
import styles from './comment-votes.module.scss';
|
|
12
|
+
|
|
13
|
+
const CommentVotes = ({
|
|
14
|
+
comment,
|
|
15
|
+
voteUpAria = 'Like Button',
|
|
16
|
+
voteDownAria = 'Dislike Button'
|
|
17
|
+
}) => {
|
|
18
|
+
const { updateVote } = useContext(VotesContext);
|
|
19
|
+
|
|
20
|
+
const userVote = useVote(comment.comment_id);
|
|
21
|
+
|
|
22
|
+
const handleVote = async (like = false, commentId) => {
|
|
23
|
+
const data = like
|
|
24
|
+
? {
|
|
25
|
+
"vote_up": "increase",
|
|
26
|
+
"commentID": commentId
|
|
27
|
+
}
|
|
28
|
+
: {
|
|
29
|
+
"vote_down": "increase",
|
|
30
|
+
"commentID": commentId
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
fetch(`${process.env.GATSBY_API_COMMENT_URL}/api/put-vote`, {
|
|
35
|
+
method: 'PUT',
|
|
36
|
+
headers: {
|
|
37
|
+
'Content-Type': 'application/json',
|
|
38
|
+
},
|
|
39
|
+
body: JSON.stringify(data),
|
|
40
|
+
})
|
|
41
|
+
.then(async (response) => {
|
|
42
|
+
if (response.ok) {
|
|
43
|
+
resolve(response);
|
|
44
|
+
} else {
|
|
45
|
+
const errorData = await response.json().catch(() => ({}));
|
|
46
|
+
reject(errorData?.errors?.join() || response.statusText);
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
.catch((error) => reject(error.message));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return <>
|
|
54
|
+
<button
|
|
55
|
+
onClick={async () => {
|
|
56
|
+
updateVote(comment.comment_id, 'vote_up');
|
|
57
|
+
await handleVote(true, comment.comment_id)
|
|
58
|
+
}}
|
|
59
|
+
aria-label={useTranslate('vote_up_aria_label', voteUpAria)}
|
|
60
|
+
type='button'
|
|
61
|
+
className={`${styles.buttonGroup} ${styles.left} ${userVote === 'vote_down' && styles.disabled || ''}`}
|
|
62
|
+
disabled={Boolean(userVote)}
|
|
63
|
+
>
|
|
64
|
+
<LazyImage className={styles.buttonGroupIcon} src='/images/like.svg' />
|
|
65
|
+
<span>{userVote === 'vote_up' ? comment.votes_up + 1 : comment.votes_up}</span>
|
|
66
|
+
</button>
|
|
67
|
+
<button
|
|
68
|
+
onClick={async () => {
|
|
69
|
+
updateVote(comment.comment_id, 'vote_down');
|
|
70
|
+
await handleVote(false, comment.comment_id)
|
|
71
|
+
}}
|
|
72
|
+
aria-label={useTranslate('vote_down_aria_label', voteDownAria)}
|
|
73
|
+
type='button'
|
|
74
|
+
className={`${styles.buttonGroup} ${styles.right} ${userVote === 'vote_up' && styles.disabled || ''}`}
|
|
75
|
+
disabled={Boolean(userVote)}
|
|
76
|
+
>
|
|
77
|
+
<LazyImage className={styles.buttonGroupIcon} src='/images/dislike.svg' />
|
|
78
|
+
<span>{userVote === 'vote_down' ? comment.votes_down + 1 : comment.votes_down}</span>
|
|
79
|
+
</button>
|
|
80
|
+
</>
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
CommentVotes.propTypes = {
|
|
84
|
+
voteUpAria: PropTypes.string,
|
|
85
|
+
voteDownAria: PropTypes.string,
|
|
86
|
+
comment: PropTypes.shape({
|
|
87
|
+
comment_id: PropTypes.string,
|
|
88
|
+
votes_up: PropTypes.number,
|
|
89
|
+
votes_down: PropTypes.number
|
|
90
|
+
})
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default CommentVotes;
|
|
@@ -60,6 +60,13 @@ export default function Ratings({
|
|
|
60
60
|
valueDiplayed = "TBA";
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
if (fieldValue === "payout_time") {
|
|
64
|
+
valueDiplayed = useTranslate(
|
|
65
|
+
valueDiplayed.toLowerCase().replace(/[–\s]/g, "_"),
|
|
66
|
+
valueDiplayed
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
63
70
|
return (
|
|
64
71
|
<li
|
|
65
72
|
key={keygen()}
|
|
@@ -32,7 +32,7 @@ describe('Rating component', () => {
|
|
|
32
32
|
test('Rating', () => {
|
|
33
33
|
const { container } = render(<Ratings item={page()} type="operator" />);
|
|
34
34
|
expect(container.querySelectorAll('ul')).toHaveLength(1);
|
|
35
|
-
expect(container.querySelectorAll('li')).toHaveLength(
|
|
35
|
+
expect(container.querySelectorAll('li')).toHaveLength(7);
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
test('Rating with diferent data text', () => {
|
|
@@ -3,75 +3,71 @@
|
|
|
3
3
|
|
|
4
4
|
gap: 1.6rem;
|
|
5
5
|
position: relative;
|
|
6
|
+
margin-bottom: 3.4rem;
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
top: -13rem;
|
|
10
|
-
content: "";
|
|
11
|
-
height: 22rem;
|
|
12
|
-
position: absolute;
|
|
13
|
-
right: 100%;
|
|
14
|
-
width: 2.9rem;
|
|
15
|
-
z-index: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
+ div .commentContainer::before{
|
|
19
|
-
height: 12rem;
|
|
20
|
-
top: -5rem;
|
|
8
|
+
@include min(tablet){
|
|
9
|
+
margin-bottom: 0;
|
|
21
10
|
}
|
|
11
|
+
|
|
22
12
|
}
|
|
23
13
|
|
|
24
14
|
.commentTopArea{
|
|
25
15
|
@include flex-align(center, start);
|
|
26
16
|
|
|
17
|
+
flex-wrap: wrap;
|
|
27
18
|
gap: .8rem;
|
|
19
|
+
|
|
20
|
+
> img{
|
|
21
|
+
border-radius: 50%;
|
|
22
|
+
width: 5rem;
|
|
23
|
+
height: 5rem;
|
|
24
|
+
}
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
.commentName{
|
|
31
|
-
font-size: 18px;
|
|
28
|
+
font-size: var(--comment-name-font-size, 18px);
|
|
32
29
|
font-weight: 600;
|
|
33
30
|
line-height: 28px;
|
|
31
|
+
color: var(--comment-name-font-color, #1B1B1C);
|
|
32
|
+
|
|
33
|
+
@include flex-align(center, center);
|
|
34
|
+
|
|
35
|
+
> svg{
|
|
36
|
+
margin-left: .8rem;
|
|
37
|
+
width: 2rem;
|
|
38
|
+
height: 2rem;
|
|
39
|
+
color: var(--comment-name-font-color, #1B1B1C);
|
|
40
|
+
}
|
|
41
|
+
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
.commentJobTitle{
|
|
37
|
-
height: 24px;
|
|
38
|
-
padding: .8rem;
|
|
39
|
-
font-size: 1.2rem;
|
|
40
|
-
font-weight: 400;
|
|
45
|
+
height: var(--comment-jobTitle-height, 24px);
|
|
46
|
+
padding: var(--comment-jobTitle-padding, .8rem);
|
|
47
|
+
font-size: var(--comment-jobTitle-font-size, 1.2rem);
|
|
48
|
+
font-weight: var(--comment-jobTitle-font-weight, 400);
|
|
41
49
|
line-height: 1.8rem;
|
|
42
50
|
|
|
43
51
|
@include flex-align(center, center);
|
|
44
52
|
|
|
45
|
-
border-radius: 5rem;
|
|
46
|
-
background: #CFC7C0;
|
|
53
|
+
border-radius: var(--comment-jobTitle-border-radius, 5rem);
|
|
54
|
+
background: var(--comment-jobTitle-bg, #CFC7C0);
|
|
55
|
+
color: var(--comment-jobTitle-font-color, #0F172A);
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
.commentDate{
|
|
50
|
-
color: #64748B;
|
|
51
|
-
font-size: 1.6rem;
|
|
59
|
+
color: var(--comment-date-font-color, #64748B);
|
|
60
|
+
font-size: var(--comment-date-font-size, 1.6rem);
|
|
52
61
|
font-weight: 400;
|
|
53
62
|
line-height: 2.6rem;
|
|
54
63
|
}
|
|
55
64
|
|
|
56
65
|
.commentContent{
|
|
57
|
-
border-radius: .8rem;
|
|
58
|
-
border: .1rem solid #F4F4F4;
|
|
59
|
-
background: #FFF;
|
|
66
|
+
border-radius: var(--comment-border-radius, .8rem);
|
|
67
|
+
border: var(--comment-border, .1rem solid #F4F4F4);
|
|
68
|
+
background: var(--comment-bg-color, #FFF);
|
|
60
69
|
position: relative;
|
|
61
|
-
padding: 2.4rem;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.isReplyThread::before{
|
|
65
|
-
content: "";
|
|
66
|
-
position: absolute;
|
|
67
|
-
right: 100%;
|
|
68
|
-
border-left: .1rem solid #CFC7C0;
|
|
69
|
-
border-bottom: .1rem solid #CFC7C0;
|
|
70
|
-
border-bottom-left-radius: 2rem;
|
|
71
|
-
height: -webkit-fill-available;
|
|
72
|
-
width: 3rem;
|
|
73
|
-
bottom: 50%;
|
|
74
|
-
z-index: 0;
|
|
70
|
+
padding: var(--comment-padding, 2.4rem);
|
|
75
71
|
}
|
|
76
72
|
|
|
77
73
|
.commentActions{
|
|
@@ -80,50 +76,22 @@
|
|
|
80
76
|
@include flex-direction(row);
|
|
81
77
|
}
|
|
82
78
|
|
|
83
|
-
.buttonGroup{
|
|
84
|
-
background: #CFC7C0;
|
|
85
|
-
font-size: 1.2rem;
|
|
86
|
-
padding: .8rem;
|
|
87
|
-
gap: .4rem;
|
|
88
|
-
|
|
89
|
-
@include flex-align(center, center);
|
|
90
|
-
|
|
91
|
-
&.left{
|
|
92
|
-
border-bottom-left-radius: 5rem;
|
|
93
|
-
border-top-left-radius: 5rem;
|
|
94
|
-
padding-right: 0;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
&.right{
|
|
98
|
-
border-bottom-right-radius: 5rem;
|
|
99
|
-
border-top-right-radius: 5rem;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.buttonGroupIcon{
|
|
104
|
-
width: 1.6rem;
|
|
105
|
-
height: 1.6rem;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
79
|
.replyButton{
|
|
109
|
-
border-radius: 10rem;
|
|
110
|
-
border: 1.5px solid #161128;
|
|
111
|
-
font-
|
|
112
|
-
font-
|
|
80
|
+
border-radius: var(--comment-btn-border-radius, 10rem);
|
|
81
|
+
border: var(--comment-btn-border, 1.5px solid #161128);
|
|
82
|
+
color: var(--comment-btn-font-color, #0A0E19);
|
|
83
|
+
font-size: var(--comment-btn-font-size, 1.2rem);
|
|
84
|
+
font-weight: var(--comment-btn-font-weight, 700);
|
|
113
85
|
line-height: 1.8rem;
|
|
114
86
|
text-transform: capitalize;
|
|
115
87
|
margin-left: .8rem;
|
|
116
|
-
padding: 0.
|
|
88
|
+
padding: var(--comment-btn-padding, 0.2rem 1.6rem);
|
|
117
89
|
}
|
|
118
90
|
|
|
119
91
|
.replySection{
|
|
120
92
|
display: grid;
|
|
121
93
|
}
|
|
122
94
|
|
|
123
|
-
.disabled > *{
|
|
124
|
-
opacity: .3;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
95
|
.buttonGroup[disabled]{
|
|
128
96
|
cursor: default;
|
|
129
97
|
}
|