Skip to content

Commit

Permalink
Merge branch 'develop' into yosuva-rv/fix-fileNode
Browse files Browse the repository at this point in the history
  • Loading branch information
lindapaiste authored Sep 16, 2023
2 parents f36a6cd + d5eee45 commit a3c4e45
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 68 deletions.
5 changes: 4 additions & 1 deletion client/components/Nav/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ function NavBar({ children, className }) {
onFocus: clearHideTimeout
}),
createMenuItemHandlers: (dropdown) => ({
onMouseUp: () => {
onMouseUp: (e) => {
if (e.button === 2) {
return;
}
setDropdownOpen('none');
},
onBlur: handleBlur,
Expand Down
40 changes: 18 additions & 22 deletions client/modules/IDE/actions/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ function setAssets(assets, totalSize) {
}

export function getAssets() {
return (dispatch) => {
return async (dispatch) => {
dispatch(startLoader());
apiClient
.get('/S3/objects')
.then((response) => {
dispatch(setAssets(response.data.assets, response.data.totalSize));
dispatch(stopLoader());
})
.catch(() => {
dispatch({
type: ActionTypes.ERROR
});
dispatch(stopLoader());
try {
const response = await apiClient.get('/S3/objects');
dispatch(setAssets(response.data.assets, response.data.totalSize));
dispatch(stopLoader());
} catch (error) {
dispatch({
type: ActionTypes.ERROR
});
dispatch(stopLoader());
}
};
}

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

export function deleteAssetRequest(assetKey) {
return (dispatch) => {
apiClient
.delete(`/S3/${assetKey}`)
.then((response) => {
dispatch(deleteAsset(assetKey));
})
.catch(() => {
dispatch({
type: ActionTypes.ERROR
});
return async (dispatch) => {
try {
await apiClient.delete(`/S3/${assetKey}`);
dispatch(deleteAsset(assetKey));
} catch (error) {
dispatch({
type: ActionTypes.ERROR
});
}
};
}
2 changes: 1 addition & 1 deletion client/modules/Preview/EmbedFrame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function injectLocalFiles(files, htmlFile, options) {
'PREVIEW_SCRIPTS_URL'
)}`;
previewScripts.setAttribute('crossorigin', '');
sketchDoc.head.appendChild(previewScripts);
sketchDoc.body.appendChild(previewScripts);

const sketchDocString = `<!DOCTYPE HTML>\n${sketchDoc.documentElement.outerHTML}`;
scriptOffs = getAllScriptOffsets(sketchDocString);
Expand Down
86 changes: 42 additions & 44 deletions client/modules/User/pages/EmailVerificationView.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import React, { useEffect } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { withTranslation } from 'react-i18next';
Expand All @@ -9,57 +9,51 @@ import { verifyEmailConfirmation } from '../actions';
import RootPage from '../../../components/RootPage';
import Nav from '../../IDE/components/Header/Nav';

class EmailVerificationView extends React.Component {
static defaultProps = {
emailVerificationTokenState: null
};

componentWillMount() {
const verificationToken = this.verificationToken();
if (verificationToken != null) {
this.props.verifyEmailConfirmation(verificationToken);
}
}
const EmailVerificationView = (props) => {
const { emailVerificationTokenState, location, t } = props;

verificationToken = () => {
const { location } = this.props;
const verificationTokenFromLocation = () => {
const searchParams = new URLSearchParams(location.search);
return searchParams.get('t');
};

render() {
let status = null;
const { emailVerificationTokenState } = this.props;

if (this.verificationToken() == null) {
status = <p>{this.props.t('EmailVerificationView.InvalidTokenNull')}</p>;
} else if (emailVerificationTokenState === 'checking') {
status = <p>{this.props.t('EmailVerificationView.Checking')}</p>;
} else if (emailVerificationTokenState === 'verified') {
status = <p>{this.props.t('EmailVerificationView.Verified')}</p>;
setTimeout(() => browserHistory.push('/'), 1000);
} else if (emailVerificationTokenState === 'invalid') {
status = <p>{this.props.t('EmailVerificationView.InvalidState')}</p>;
useEffect(() => {
const verificationToken = verificationTokenFromLocation();
if (verificationToken != null) {
props.verifyEmailConfirmation(verificationToken);
}
}, [location, props]);

return (
<RootPage>
<Nav layout="dashboard" />
<div className="form-container">
<Helmet>
<title>{this.props.t('EmailVerificationView.Title')}</title>
</Helmet>
<div className="form-container__content">
<h2 className="form-container__title">
{this.props.t('EmailVerificationView.Verify')}
</h2>
{status}
</div>
</div>
</RootPage>
);
let status = null;

if (verificationTokenFromLocation() == null) {
status = <p>{t('EmailVerificationView.InvalidTokenNull')}</p>;
} else if (emailVerificationTokenState === 'checking') {
status = <p>{t('EmailVerificationView.Checking')}</p>;
} else if (emailVerificationTokenState === 'verified') {
status = <p>{t('EmailVerificationView.Verified')}</p>;
setTimeout(() => browserHistory.push('/'), 1000);
} else if (emailVerificationTokenState === 'invalid') {
status = <p>{t('EmailVerificationView.InvalidState')}</p>;
}
}

return (
<RootPage>
<Nav layout="dashboard" />
<div className="form-container">
<Helmet>
<title>{t('EmailVerificationView.Title')}</title>
</Helmet>
<div className="form-container__content">
<h2 className="form-container__title">
{t('EmailVerificationView.Verify')}
</h2>
{status}
</div>
</div>
</RootPage>
);
};

function mapStateToProps(state) {
return {
Expand All @@ -76,6 +70,10 @@ function mapDispatchToProps(dispatch) {
);
}

EmailVerificationView.defaultProps = {
emailVerificationTokenState: null
};

EmailVerificationView.propTypes = {
emailVerificationTokenState: PropTypes.oneOf([
'checking',
Expand Down
4 changes: 4 additions & 0 deletions client/styles/components/_form-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
flex-direction: column;
justify-content: center;
align-items: center;
margin-bottom: 20px;
}

.form-container--align-left .form-container__content {
Expand Down Expand Up @@ -71,3 +72,6 @@
.form-container__stack > * + * {
margin-top: #{10 / $base-font-size}rem;
}
.form__navigation-options a {
font-weight: bold;
}

0 comments on commit a3c4e45

Please sign in to comment.