Skip to content

Commit dd5e46c

Browse files
authored
Merge branch 'develop' into fix/s3v4
2 parents cf0cd38 + 260a92d commit dd5e46c

File tree

20 files changed

+130
-42
lines changed

20 files changed

+130
-42
lines changed

client/components/Nav.jsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -566,16 +566,6 @@ class Nav extends React.PureComponent {
566566
</button>
567567
<ul className="nav__dropdown">
568568

569-
<li className="nav__dropdown-item">
570-
<button
571-
onFocus={this.handleFocusForLang}
572-
onBlur={this.handleBlur}
573-
value="it"
574-
onClick={e => this.handleLangSelection(e)}
575-
>
576-
Italian (Test Fallback)
577-
</button>
578-
</li>
579569
<li className="nav__dropdown-item">
580570
<button
581571
onFocus={this.handleFocusForLang}

client/components/NavBasic.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3+
import { withTranslation } from 'react-i18next';
34

45
import LogoIcon from '../images/p5js-logo-small.svg';
56
import ArrowIcon from '../images/triangle-arrow-left.svg';
@@ -14,7 +15,7 @@ class NavBasic extends React.PureComponent {
1415
<nav className="nav" title="main-navigation" ref={(node) => { this.node = node; }}>
1516
<ul className="nav__items-left">
1617
<li className="nav__item-logo">
17-
<LogoIcon role="img" aria-label="p5.js Logo" focusable="false" className="svg__logo" />
18+
<LogoIcon role="img" aria-label={this.props.t('Common.p5logoARIA')} focusable="false" className="svg__logo" />
1819
</li>
1920
{ this.props.onBack && (
2021
<li className="nav__item">
@@ -34,6 +35,7 @@ class NavBasic extends React.PureComponent {
3435

3536
NavBasic.propTypes = {
3637
onBack: PropTypes.func,
38+
t: PropTypes.func.isRequired
3739
};
3840

39-
export default NavBasic;
41+
export default withTranslation()(NavBasic);

client/modules/IDE/components/AssetList.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ class AssetListRowBase extends React.Component {
6161
handleAssetDelete = () => {
6262
const { key, name } = this.props.asset;
6363
this.closeOptions();
64-
if (window.confirm(`Are you sure you want to delete "${name}"?`)) {
64+
if (window.confirm(this.props.t('Common.DeleteConfirmation', { name }))) {
6565
this.props.deleteAssetRequest(key);
6666
}
6767
}
6868

6969
render() {
70-
const { asset, username } = this.props;
70+
const { asset, username, t } = this.props;
7171
const { optionsOpen } = this.state;
7272
return (
7373
<tr className="asset-table__row" key={asset.key}>
@@ -86,7 +86,7 @@ class AssetListRowBase extends React.Component {
8686
onClick={this.toggleOptions}
8787
onBlur={this.onBlurComponent}
8888
onFocus={this.onFocusComponent}
89-
aria-label={this.props.t('AssetList.ToggleOpenCloseARIA')}
89+
aria-label={t('AssetList.ToggleOpenCloseARIA')}
9090
>
9191
<DownFilledTriangleIcon focusable="false" aria-hidden="true" />
9292
</button>
@@ -101,7 +101,7 @@ class AssetListRowBase extends React.Component {
101101
onBlur={this.onBlurComponent}
102102
onFocus={this.onFocusComponent}
103103
>
104-
{this.props.t('AssetList.Delete')}
104+
{t('AssetList.Delete')}
105105
</button>
106106
</li>
107107
<li>
@@ -112,7 +112,7 @@ class AssetListRowBase extends React.Component {
112112
onFocus={this.onFocusComponent}
113113
className="asset-table__action-option"
114114
>
115-
{this.props.t('AssetList.OpenNewTab')}
115+
{t('AssetList.OpenNewTab')}
116116
</Link>
117117
</li>
118118
</ul>}
@@ -194,7 +194,7 @@ class AssetList extends React.Component {
194194
</tr>
195195
</thead>
196196
<tbody>
197-
{assetList.map(asset => <AssetListRow asset={asset} key={asset.key} />)}
197+
{assetList.map(asset => <AssetListRow asset={asset} key={asset.key} t={t} />)}
198198
</tbody>
199199
</table>}
200200
</article>

client/modules/IDE/components/CollectionList/CollectionList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class CollectionList extends React.Component {
140140
{this._renderLoader()}
141141
{this._renderEmptyTable()}
142142
{this.hasCollections() &&
143-
<table className="sketches-table" summary="table containing all collections">
143+
<table className="sketches-table" summary={this.props.t('CollectionList.TableSummary')}>
144144
<thead>
145145
<tr>
146146
{this._renderFieldHeader('name', this.props.t('CollectionList.HeaderName'))}

client/modules/IDE/components/EditableInput.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import { withTranslation } from 'react-i18next';
3+
import { useTranslation } from 'react-i18next';
44
import i18next from 'i18next';
55
import EditIcon from '../../../images/pencil.svg';
66

@@ -22,7 +22,7 @@ function EditableInput({
2222
isEditing ? 'is-editing' : 'is-not-editing'
2323
} editable-input--${hasValue ? 'has-value' : 'has-placeholder'}`;
2424
const inputRef = React.createRef();
25-
25+
const { t } = useTranslation();
2626
React.useEffect(() => {
2727
if (isEditing) {
2828
inputRef.current.focus();
@@ -60,7 +60,7 @@ function EditableInput({
6060
<button
6161
className="editable-input__label"
6262
onClick={beginEditing}
63-
aria-label={this.props.t('EditableInput.EditValue', { display: displayValue })}
63+
aria-label={t('EditableInput.EditValue', { display: displayValue })}
6464
>
6565
<span>{displayValue}</span>
6666
<EditIcon
@@ -101,7 +101,6 @@ EditableInput.propTypes = {
101101
onChange: PropTypes.func.isRequired,
102102
validate: PropTypes.func,
103103
value: PropTypes.string,
104-
t: PropTypes.func.isRequired
105104
};
106105

107-
export default withTranslation()(EditableInput);
106+
export default EditableInput;

client/modules/IDE/components/NewFileModal.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,23 @@ class NewFileModal extends React.Component {
2020
constructor(props) {
2121
super(props);
2222
this.focusOnModal = this.focusOnModal.bind(this);
23+
this.handleOutsideClick = this.handleOutsideClick.bind(this);
2324
}
2425

2526
componentDidMount() {
2627
this.focusOnModal();
28+
document.addEventListener('click', this.handleOutsideClick, false);
29+
}
30+
31+
componentWillUnmount() {
32+
document.removeEventListener('click', this.handleOutsideClick, false);
33+
}
34+
35+
handleOutsideClick(e) {
36+
// ignore clicks on the component itself
37+
if (e.path.includes(this.modal)) return;
38+
39+
this.props.closeNewFileModal();
2740
}
2841

2942
focusOnModal() {

client/modules/IDE/components/NewFolderModal.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,25 @@ import NewFolderForm from './NewFolderForm';
88
import ExitIcon from '../../../images/exit.svg';
99

1010
class NewFolderModal extends React.Component {
11+
constructor(props) {
12+
super(props);
13+
this.handleOutsideClick = this.handleOutsideClick.bind(this);
14+
}
15+
1116
componentDidMount() {
1217
this.newFolderModal.focus();
18+
document.addEventListener('click', this.handleOutsideClick, false);
19+
}
20+
21+
componentWillUnmount() {
22+
document.removeEventListener('click', this.handleOutsideClick, false);
23+
}
24+
25+
handleOutsideClick(e) {
26+
// ignore clicks on the component itself
27+
if (e.path.includes(this.newFolderModal)) return;
28+
29+
this.props.closeModal();
1330
}
1431

1532
render() {

client/modules/IDE/components/QuickAddList/QuickAddList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Item = ({
1919
className="quick-add__item-view"
2020
to={url}
2121
target="_blank"
22-
onClick={e => e.stopPropogation()}
22+
onClick={e => e.stopPropagation()}
2323
>
2424
{t('QuickAddList.View')}
2525
</Link>

client/modules/IDE/components/SketchList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ class SketchList extends React.Component {
433433
{this._renderLoader()}
434434
{this._renderEmptyTable()}
435435
{this.hasSketches() &&
436-
<table className="sketches-table" summary="table containing all saved projects">
436+
<table className="sketches-table" summary={this.props.t('SketchList.TableSummary')}>
437437
<thead>
438438
<tr>
439439
{this._renderFieldHeader('name', this.props.t('SketchList.HeaderName'))}

client/modules/IDE/components/Toolbar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class Toolbar extends React.Component {
156156
if (this.props.owner) {
157157
return (
158158
<p className="toolbar__project-owner">
159-
by <Link to={`/${this.props.owner.username}/sketches`}>{this.props.owner.username}</Link>
159+
{this.props.t('Toolbar.By')} <Link to={`/${this.props.owner.username}/sketches`}>{this.props.owner.username}</Link>
160160
</p>
161161
);
162162
}

0 commit comments

Comments
 (0)