Skip to content

Commit 5bb0850

Browse files
authored
Merge branch 'develop' into feature/urdu-translation
2 parents a60ebfd + 72f3afc commit 5bb0850

File tree

5 files changed

+32
-62
lines changed

5 files changed

+32
-62
lines changed

client/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const availableLanguages = [
4444

4545
export function languageKeyToLabel(lang) {
4646
const languageMap = {
47-
be: 'Bengali',
47+
be: 'বাংলা',
4848
de: 'Deutsch',
4949
'en-US': 'English',
5050
'es-419': 'Español',
Lines changed: 19 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
import PropTypes from 'prop-types';
2-
import React, { useEffect } from 'react';
3-
import { connect } from 'react-redux';
4-
import { bindActionCreators } from 'redux';
5-
import { withTranslation } from 'react-i18next';
1+
import React, { useEffect, useMemo } from 'react';
62
import { Helmet } from 'react-helmet';
7-
import browserHistory from '../../../browserHistory';
3+
import { useLocation, useHistory } from 'react-router-dom';
4+
import { useSelector, useDispatch } from 'react-redux';
5+
import { useTranslation } from 'react-i18next';
86
import { verifyEmailConfirmation } from '../actions';
97
import RootPage from '../../../components/RootPage';
108
import Nav from '../../IDE/components/Header/Nav';
119

12-
const EmailVerificationView = (props) => {
13-
const { emailVerificationTokenState, location, t } = props;
14-
15-
const verificationTokenFromLocation = () => {
10+
const EmailVerificationView = () => {
11+
const { t } = useTranslation();
12+
const location = useLocation();
13+
const dispatch = useDispatch();
14+
const browserHistory = useHistory();
15+
const emailVerificationTokenState = useSelector(
16+
(state) => state.user.emailVerificationTokenState
17+
);
18+
const verificationToken = useMemo(() => {
1619
const searchParams = new URLSearchParams(location.search);
1720
return searchParams.get('t');
18-
};
19-
21+
}, [location.search]);
2022
useEffect(() => {
21-
const verificationToken = verificationTokenFromLocation();
22-
if (verificationToken != null) {
23-
props.verifyEmailConfirmation(verificationToken);
23+
if (verificationToken) {
24+
dispatch(verifyEmailConfirmation(verificationToken));
2425
}
25-
}, [location, props]);
26-
26+
}, [dispatch, verificationToken]);
2727
let status = null;
28-
29-
if (verificationTokenFromLocation() == null) {
28+
if (!verificationToken) {
3029
status = <p>{t('EmailVerificationView.InvalidTokenNull')}</p>;
3130
} else if (emailVerificationTokenState === 'checking') {
3231
status = <p>{t('EmailVerificationView.Checking')}</p>;
@@ -54,39 +53,4 @@ const EmailVerificationView = (props) => {
5453
</RootPage>
5554
);
5655
};
57-
58-
function mapStateToProps(state) {
59-
return {
60-
emailVerificationTokenState: state.user.emailVerificationTokenState
61-
};
62-
}
63-
64-
function mapDispatchToProps(dispatch) {
65-
return bindActionCreators(
66-
{
67-
verifyEmailConfirmation
68-
},
69-
dispatch
70-
);
71-
}
72-
73-
EmailVerificationView.defaultProps = {
74-
emailVerificationTokenState: null
75-
};
76-
77-
EmailVerificationView.propTypes = {
78-
emailVerificationTokenState: PropTypes.oneOf([
79-
'checking',
80-
'verified',
81-
'invalid'
82-
]),
83-
verifyEmailConfirmation: PropTypes.func.isRequired,
84-
t: PropTypes.func.isRequired,
85-
location: PropTypes.shape({
86-
search: PropTypes.string.isRequired
87-
}).isRequired
88-
};
89-
90-
export default withTranslation()(
91-
connect(mapStateToProps, mapDispatchToProps)(EmailVerificationView)
92-
);
56+
export default EmailVerificationView;

client/modules/User/pages/SignupView.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { Link } from 'react-router-dom';
33
import { Helmet } from 'react-helmet';
4-
import { useTranslation } from 'react-i18next';
4+
import { useTranslation, Trans } from 'react-i18next';
55
import SignupForm from '../components/SignupForm';
66
import SocialAuthButton from '../components/SocialAuthButton';
77
import Nav from '../../IDE/components/Header/Nav';
@@ -27,9 +27,13 @@ function SignupView() {
2727
<SocialAuthButton service={SocialAuthButton.services.google} />
2828
</div>
2929
<p className="form__navigation-options">
30-
By signing up, you agree to the p5.js Editor&apos;s{' '}
31-
<Link to="/terms-of-use">Terms of Use</Link> and{' '}
32-
<Link to="/privacy-policy">Privacy Policy</Link>.
30+
<Trans
31+
i18nKey="SignupView.Warning"
32+
components={[
33+
<Link to="/terms-of-use">Terms of use</Link>,
34+
<Link to="/privacy-policy">Privacy Policy</Link>
35+
]}
36+
/>
3337
</p>
3438
<p className="form__navigation-options">
3539
{t('SignupView.AlreadyHave')}{' '}

translations/locales/en-US/translations.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@
366366
"Description": "Sign Up",
367367
"Or": "Or",
368368
"AlreadyHave": "Already have an account?",
369-
"Login": "Log In"
369+
"Login": "Log In",
370+
"Warning": "By signing up, you agree to the p5.js Editor's <0>Terms of Use</0> and <1>Privacy Policy.</1>"
370371
},
371372
"EmailVerificationView": {
372373
"Title": "p5.js Web Editor | Email Verification",

translations/locales/hi/translations.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@
353353
"Description": "साइन अप",
354354
"Or": "या",
355355
"AlreadyHave": "पहले से ही अकाउंट है?",
356-
"Login": "लॉग इन"
356+
"Login": "लॉग इन",
357+
"Warning": "साइन अप करके, आप p5.js संपादक की उपयोग की <0>शर्तों</0> और <1>गोपनीयता नीति</1> से सहमत होते हैं।"
357358
},
358359
"EmailVerificationView": {
359360
"Title": "p5.js वेब एडिटर | ईमेल वेरीफिकेशन",

0 commit comments

Comments
 (0)