Skip to content

Commit 830fea3

Browse files
authored
Merge branch 'develop' into addCSS
2 parents b247f90 + 27a96ac commit 830fea3

File tree

4 files changed

+65
-68
lines changed

4 files changed

+65
-68
lines changed

client/components/Nav/NavBar.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ function NavBar({ children, className }) {
7171
onFocus: clearHideTimeout
7272
}),
7373
createMenuItemHandlers: (dropdown) => ({
74-
onMouseUp: () => {
74+
onMouseUp: (e) => {
75+
if (e.button === 2) {
76+
return;
77+
}
7578
setDropdownOpen('none');
7679
},
7780
onBlur: handleBlur,

client/modules/IDE/actions/assets.js

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,18 @@ function setAssets(assets, totalSize) {
1111
}
1212

1313
export function getAssets() {
14-
return (dispatch) => {
14+
return async (dispatch) => {
1515
dispatch(startLoader());
16-
apiClient
17-
.get('/S3/objects')
18-
.then((response) => {
19-
dispatch(setAssets(response.data.assets, response.data.totalSize));
20-
dispatch(stopLoader());
21-
})
22-
.catch(() => {
23-
dispatch({
24-
type: ActionTypes.ERROR
25-
});
26-
dispatch(stopLoader());
16+
try {
17+
const response = await apiClient.get('/S3/objects');
18+
dispatch(setAssets(response.data.assets, response.data.totalSize));
19+
dispatch(stopLoader());
20+
} catch (error) {
21+
dispatch({
22+
type: ActionTypes.ERROR
2723
});
24+
dispatch(stopLoader());
25+
}
2826
};
2927
}
3028

@@ -36,16 +34,14 @@ export function deleteAsset(assetKey) {
3634
}
3735

3836
export function deleteAssetRequest(assetKey) {
39-
return (dispatch) => {
40-
apiClient
41-
.delete(`/S3/${assetKey}`)
42-
.then((response) => {
43-
dispatch(deleteAsset(assetKey));
44-
})
45-
.catch(() => {
46-
dispatch({
47-
type: ActionTypes.ERROR
48-
});
37+
return async (dispatch) => {
38+
try {
39+
await apiClient.delete(`/S3/${assetKey}`);
40+
dispatch(deleteAsset(assetKey));
41+
} catch (error) {
42+
dispatch({
43+
type: ActionTypes.ERROR
4944
});
45+
}
5046
};
5147
}

client/modules/Preview/EmbedFrame.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ function injectLocalFiles(files, htmlFile, options) {
252252
'PREVIEW_SCRIPTS_URL'
253253
)}`;
254254
previewScripts.setAttribute('crossorigin', '');
255-
sketchDoc.head.appendChild(previewScripts);
255+
sketchDoc.body.appendChild(previewScripts);
256256

257257
const sketchDocString = `<!DOCTYPE HTML>\n${sketchDoc.documentElement.outerHTML}`;
258258
scriptOffs = getAllScriptOffsets(sketchDocString);

client/modules/User/pages/EmailVerificationView.jsx

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import PropTypes from 'prop-types';
2-
import React from 'react';
2+
import React, { useEffect } from 'react';
33
import { connect } from 'react-redux';
44
import { bindActionCreators } from 'redux';
55
import { withTranslation } from 'react-i18next';
@@ -9,57 +9,51 @@ import { verifyEmailConfirmation } from '../actions';
99
import RootPage from '../../../components/RootPage';
1010
import Nav from '../../IDE/components/Header/Nav';
1111

12-
class EmailVerificationView extends React.Component {
13-
static defaultProps = {
14-
emailVerificationTokenState: null
15-
};
16-
17-
componentWillMount() {
18-
const verificationToken = this.verificationToken();
19-
if (verificationToken != null) {
20-
this.props.verifyEmailConfirmation(verificationToken);
21-
}
22-
}
12+
const EmailVerificationView = (props) => {
13+
const { emailVerificationTokenState, location, t } = props;
2314

24-
verificationToken = () => {
25-
const { location } = this.props;
15+
const verificationTokenFromLocation = () => {
2616
const searchParams = new URLSearchParams(location.search);
2717
return searchParams.get('t');
2818
};
2919

30-
render() {
31-
let status = null;
32-
const { emailVerificationTokenState } = this.props;
33-
34-
if (this.verificationToken() == null) {
35-
status = <p>{this.props.t('EmailVerificationView.InvalidTokenNull')}</p>;
36-
} else if (emailVerificationTokenState === 'checking') {
37-
status = <p>{this.props.t('EmailVerificationView.Checking')}</p>;
38-
} else if (emailVerificationTokenState === 'verified') {
39-
status = <p>{this.props.t('EmailVerificationView.Verified')}</p>;
40-
setTimeout(() => browserHistory.push('/'), 1000);
41-
} else if (emailVerificationTokenState === 'invalid') {
42-
status = <p>{this.props.t('EmailVerificationView.InvalidState')}</p>;
20+
useEffect(() => {
21+
const verificationToken = verificationTokenFromLocation();
22+
if (verificationToken != null) {
23+
props.verifyEmailConfirmation(verificationToken);
4324
}
25+
}, [location, props]);
4426

45-
return (
46-
<RootPage>
47-
<Nav layout="dashboard" />
48-
<div className="form-container">
49-
<Helmet>
50-
<title>{this.props.t('EmailVerificationView.Title')}</title>
51-
</Helmet>
52-
<div className="form-container__content">
53-
<h2 className="form-container__title">
54-
{this.props.t('EmailVerificationView.Verify')}
55-
</h2>
56-
{status}
57-
</div>
58-
</div>
59-
</RootPage>
60-
);
27+
let status = null;
28+
29+
if (verificationTokenFromLocation() == null) {
30+
status = <p>{t('EmailVerificationView.InvalidTokenNull')}</p>;
31+
} else if (emailVerificationTokenState === 'checking') {
32+
status = <p>{t('EmailVerificationView.Checking')}</p>;
33+
} else if (emailVerificationTokenState === 'verified') {
34+
status = <p>{t('EmailVerificationView.Verified')}</p>;
35+
setTimeout(() => browserHistory.push('/'), 1000);
36+
} else if (emailVerificationTokenState === 'invalid') {
37+
status = <p>{t('EmailVerificationView.InvalidState')}</p>;
6138
}
62-
}
39+
40+
return (
41+
<RootPage>
42+
<Nav layout="dashboard" />
43+
<div className="form-container">
44+
<Helmet>
45+
<title>{t('EmailVerificationView.Title')}</title>
46+
</Helmet>
47+
<div className="form-container__content">
48+
<h2 className="form-container__title">
49+
{t('EmailVerificationView.Verify')}
50+
</h2>
51+
{status}
52+
</div>
53+
</div>
54+
</RootPage>
55+
);
56+
};
6357

6458
function mapStateToProps(state) {
6559
return {
@@ -76,6 +70,10 @@ function mapDispatchToProps(dispatch) {
7670
);
7771
}
7872

73+
EmailVerificationView.defaultProps = {
74+
emailVerificationTokenState: null
75+
};
76+
7977
EmailVerificationView.propTypes = {
8078
emailVerificationTokenState: PropTypes.oneOf([
8179
'checking',

0 commit comments

Comments
 (0)