Skip to content

Commit 148ab78

Browse files
committed
Resolve merge conflicts with master
2 parents 70fe492 + 2308d06 commit 148ab78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+12196
-12460
lines changed

Diff for: client/components/AddRemoveButton.jsx

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import InlineSVG from 'react-inlinesvg';
43

5-
const addIcon = require('../images/plus.svg');
6-
const removeIcon = require('../images/minus.svg');
4+
import AddIcon from '../images/plus.svg';
5+
import RemoveIcon from '../images/minus.svg';
76

87
const AddRemoveButton = ({ type, onClick }) => {
9-
const alt = type === 'add' ? 'add to collection' : 'remove from collection';
10-
const icon = type === 'add' ? addIcon : removeIcon;
8+
const alt = type === 'add' ? 'Add to collection' : 'Remove from collection';
9+
const Icon = type === 'add' ? AddIcon : RemoveIcon;
1110

1211
return (
13-
<button className="overlay__close-button" onClick={onClick}>
14-
<InlineSVG src={icon} alt={alt} />
12+
<button
13+
className="overlay__close-button"
14+
onClick={onClick}
15+
aria-label={alt}
16+
>
17+
<Icon focusable="false" aria-hidden="true" />
1518
</button>
1619
);
1720
};

Diff for: client/components/Nav.jsx

+11-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from 'react';
33
import { connect } from 'react-redux';
44
import { withRouter } from 'react-router';
55
import { Link } from 'react-router';
6-
import InlineSVG from 'react-inlinesvg';
76
import classNames from 'classnames';
87
import * as IDEActions from '../modules/IDE/actions/ide';
98
import * as toastActions from '../modules/IDE/actions/toast';
@@ -12,10 +11,10 @@ import { setAllAccessibleOutput } from '../modules/IDE/actions/preferences';
1211
import { logoutUser } from '../modules/User/actions';
1312

1413
import { metaKeyName, } from '../utils/metaKey';
15-
import caretLeft from '../images/left-arrow.svg';
1614

17-
const triangleUrl = require('../images/down-filled-triangle.svg');
18-
const logoUrl = require('../images/p5js-logo-small.svg');
15+
import CaretLeftIcon from '../images/left-arrow.svg';
16+
import TriangleIcon from '../images/down-filled-triangle.svg';
17+
import LogoIcon from '../images/p5js-logo-small.svg';
1918

2019
const __process = (typeof global !== 'undefined' ? global : window).process;
2120

@@ -229,11 +228,11 @@ class Nav extends React.PureComponent {
229228
return (
230229
<ul className="nav__items-left">
231230
<li className="nav__item-logo">
232-
<InlineSVG src={logoUrl} alt="p5.js logo" className="svg__logo" />
231+
<LogoIcon role="img" aria-label="p5.js Logo" focusable="false" className="svg__logo" />
233232
</li>
234233
<li className="nav__item nav__item--no-icon">
235234
<Link to="/" className="nav__back-link">
236-
<InlineSVG src={caretLeft} className="nav__back-icon" />
235+
<CaretLeftIcon className="nav__back-icon" focusable="false" aria-hidden="true" />
237236
<span className="nav__item-header">
238237
Back to Editor
239238
</span>
@@ -247,7 +246,7 @@ class Nav extends React.PureComponent {
247246
return (
248247
<ul className="nav__items-left">
249248
<li className="nav__item-logo">
250-
<InlineSVG src={logoUrl} alt="p5.js logo" className="svg__logo" />
249+
<LogoIcon role="img" aria-label="p5.js Logo" focusable="false" className="svg__logo" />
251250
</li>
252251
<li className={navDropdownState.file}>
253252
<button
@@ -261,7 +260,7 @@ class Nav extends React.PureComponent {
261260
}}
262261
>
263262
<span className="nav__item-header">File</span>
264-
<InlineSVG className="nav__item-header-triangle" src={triangleUrl} />
263+
<TriangleIcon className="nav__item-header-triangle" focusable="false" aria-hidden="true" />
265264
</button>
266265
<ul className="nav__dropdown">
267266
<li className="nav__dropdown-item">
@@ -363,7 +362,7 @@ class Nav extends React.PureComponent {
363362
}}
364363
>
365364
<span className="nav__item-header">Edit</span>
366-
<InlineSVG className="nav__item-header-triangle" src={triangleUrl} />
365+
<TriangleIcon className="nav__item-header-triangle" focusable="false" aria-hidden="true" />
367366
</button>
368367
<ul className="nav__dropdown" >
369368
<li className="nav__dropdown-item">
@@ -423,7 +422,7 @@ class Nav extends React.PureComponent {
423422
}}
424423
>
425424
<span className="nav__item-header">Sketch</span>
426-
<InlineSVG className="nav__item-header-triangle" src={triangleUrl} />
425+
<TriangleIcon className="nav__item-header-triangle" focusable="false" aria-hidden="true" />
427426
</button>
428427
<ul className="nav__dropdown">
429428
<li className="nav__dropdown-item">
@@ -498,7 +497,7 @@ class Nav extends React.PureComponent {
498497
}}
499498
>
500499
<span className="nav__item-header">Help</span>
501-
<InlineSVG className="nav__item-header-triangle" src={triangleUrl} />
500+
<TriangleIcon className="nav__item-header-triangle" focusable="false" aria-hidden="true" />
502501
</button>
503502
<ul className="nav__dropdown">
504503
<li className="nav__dropdown-item">
@@ -575,7 +574,7 @@ class Nav extends React.PureComponent {
575574
}}
576575
>
577576
My Account
578-
<InlineSVG className="nav__item-header-triangle" src={triangleUrl} />
577+
<TriangleIcon className="nav__item-header-triangle" focusable="false" aria-hidden="true" />
579578
</button>
580579
<ul className="nav__dropdown">
581580
<li className="nav__dropdown-item">

Diff for: client/components/NavBasic.jsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import InlineSVG from 'react-inlinesvg';
43

5-
const logoUrl = require('../images/p5js-logo-small.svg');
6-
const arrowUrl = require('../images/triangle-arrow-left.svg');
4+
import LogoIcon from '../images/p5js-logo-small.svg';
5+
import ArrowIcon from '../images/triangle-arrow-left.svg';
76

87
class NavBasic extends React.PureComponent {
98
static defaultProps = {
@@ -15,13 +14,13 @@ class NavBasic extends React.PureComponent {
1514
<nav className="nav" title="main-navigation" ref={(node) => { this.node = node; }}>
1615
<ul className="nav__items-left">
1716
<li className="nav__item-logo">
18-
<InlineSVG src={logoUrl} alt="p5.js logo" className="svg__logo" />
17+
<LogoIcon role="img" aria-label="p5.js Logo" focusable="false" className="svg__logo" />
1918
</li>
2019
{ this.props.onBack && (
2120
<li className="nav__item">
2221
<button onClick={this.props.onBack}>
2322
<span className="nav__item-header">
24-
<InlineSVG src={arrowUrl} alt="Left arrow" />
23+
<ArrowIcon focusable="false" aria-hidden="true" />
2524
</span>
2625
Back to the editor
2726
</button>

Diff for: client/components/PreviewNav.jsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
33
import { Link } from 'react-router';
4-
import InlineSVG from 'react-inlinesvg';
54

6-
const logoUrl = require('../images/p5js-logo-small.svg');
7-
const editorUrl = require('../images/code.svg');
5+
import LogoIcon from '../images/p5js-logo-small.svg';
6+
import CodeIcon from '../images/code.svg';
87

98
const PreviewNav = ({ owner, project }) => (
109
<nav className="nav preview-nav">
1110
<div className="nav__items-left">
1211
<div className="nav__item-logo">
13-
<InlineSVG src={logoUrl} alt="p5.js logo" className="svg__logo" />
12+
<LogoIcon role="img" aria-label="p5.js Logo" focusable="false" className="svg__logo" />
1413
</div>
1514
<Link className="nav__item" to={`/${owner.username}/sketches/${project.id}`}>{project.name}</Link>
1615
<p className="toolbar__project-owner">by</p>
1716
<Link className="nav__item" to={`/${owner.username}/sketches/`}>{owner.username}</Link>
1817
</div>
1918
<div className="nav__items-right">
20-
<Link to={`/${owner.username}/sketches/${project.id}`}>
21-
<InlineSVG className="preview-nav__editor-svg" src={editorUrl} />
19+
<Link to={`/${owner.username}/sketches/${project.id}`} aria-label="Edit Sketch" >
20+
<CodeIcon className="preview-nav__editor-svg" focusable="false" aria-hidden="true" />
2221
</Link>
2322
</div>
2423
</nav>

Diff for: client/components/__test__/__snapshots__/Nav.test.jsx.snap

+21-10
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ exports[`Nav renders correctly 1`] = `
1111
<li
1212
className="nav__item-logo"
1313
>
14-
<span
15-
className="isvg loading svg__logo"
14+
<test-file-stub
15+
aria-label="p5.js Logo"
16+
className="svg__logo"
17+
focusable="false"
18+
role="img"
1619
/>
1720
</li>
1821
<li
@@ -29,8 +32,10 @@ exports[`Nav renders correctly 1`] = `
2932
>
3033
File
3134
</span>
32-
<span
33-
className="isvg loading nav__item-header-triangle"
35+
<test-file-stub
36+
aria-hidden="true"
37+
className="nav__item-header-triangle"
38+
focusable="false"
3439
/>
3540
</button>
3641
<ul
@@ -108,8 +113,10 @@ exports[`Nav renders correctly 1`] = `
108113
>
109114
Edit
110115
</span>
111-
<span
112-
className="isvg loading nav__item-header-triangle"
116+
<test-file-stub
117+
aria-hidden="true"
118+
className="nav__item-header-triangle"
119+
focusable="false"
113120
/>
114121
</button>
115122
<ul
@@ -201,8 +208,10 @@ exports[`Nav renders correctly 1`] = `
201208
>
202209
Sketch
203210
</span>
204-
<span
205-
className="isvg loading nav__item-header-triangle"
211+
<test-file-stub
212+
aria-hidden="true"
213+
className="nav__item-header-triangle"
214+
focusable="false"
206215
/>
207216
</button>
208217
<ul
@@ -282,8 +291,10 @@ exports[`Nav renders correctly 1`] = `
282291
>
283292
Help
284293
</span>
285-
<span
286-
className="isvg loading nav__item-header-triangle"
294+
<test-file-stub
295+
aria-hidden="true"
296+
className="nav__item-header-triangle"
297+
focusable="false"
287298
/>
288299
</button>
289300
<ul

Diff for: client/modules/App/components/Overlay.jsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import InlineSVG from 'react-inlinesvg';
43
import { browserHistory } from 'react-router';
54

6-
const exitUrl = require('../../../images/exit.svg');
5+
import ExitIcon from '../../../images/exit.svg';
76

87
class Overlay extends React.Component {
98
constructor(props) {
@@ -81,8 +80,8 @@ class Overlay extends React.Component {
8180
<h2 className="overlay__title">{title}</h2>
8281
<div className="overlay__actions">
8382
{actions}
84-
<button className="overlay__close-button" onClick={this.close} >
85-
<InlineSVG src={exitUrl} alt="close overlay" />
83+
<button className="overlay__close-button" onClick={this.close} aria-label={`Close ${title} overlay`} >
84+
<ExitIcon focusable="false" aria-hidden="true" />
8685
</button>
8786
</div>
8887
</header>

Diff for: client/modules/IDE/actions/collections.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export function getCollections(username) {
2727
});
2828
dispatch(stopLoader());
2929
})
30-
.catch((response) => {
30+
.catch((error) => {
31+
const { response } = error;
3132
dispatch({
3233
type: ActionTypes.ERROR,
3334
error: response.data
@@ -57,7 +58,8 @@ export function createCollection(collection) {
5758

5859
browserHistory.push(location);
5960
})
60-
.catch((response) => {
61+
.catch((error) => {
62+
const { response } = error;
6163
console.error('Error creating collection', response.data);
6264
dispatch({
6365
type: ActionTypes.ERROR,
@@ -87,7 +89,8 @@ export function addToCollection(collectionId, projectId) {
8789

8890
return response.data;
8991
})
90-
.catch((response) => {
92+
.catch((error) => {
93+
const { response } = error;
9194
dispatch({
9295
type: ActionTypes.ERROR,
9396
error: response.data
@@ -118,7 +121,8 @@ export function removeFromCollection(collectionId, projectId) {
118121

119122
return response.data;
120123
})
121-
.catch((response) => {
124+
.catch((error) => {
125+
const { response } = error;
122126
dispatch({
123127
type: ActionTypes.ERROR,
124128
error: response.data
@@ -141,7 +145,8 @@ export function editCollection(collectionId, { name, description }) {
141145
});
142146
return response.data;
143147
})
144-
.catch((response) => {
148+
.catch((error) => {
149+
const { response } = error;
145150
dispatch({
146151
type: ActionTypes.ERROR,
147152
error: response.data
@@ -164,7 +169,8 @@ export function deleteCollection(collectionId) {
164169
});
165170
return response.data;
166171
})
167-
.catch((response) => {
172+
.catch((error) => {
173+
const { response } = error;
168174
dispatch({
169175
type: ActionTypes.ERROR,
170176
error: response.data

Diff for: client/modules/IDE/actions/files.js

+16-9
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ export function createFile(formProps) {
6565
// });
6666
dispatch(setUnsavedChanges(true));
6767
})
68-
.catch(response => dispatch({
69-
type: ActionTypes.ERROR,
70-
error: response.data
71-
}));
68+
.catch((error) => {
69+
const { response } = error;
70+
dispatch({
71+
type: ActionTypes.ERROR,
72+
error: response.data
73+
});
74+
});
7275
} else {
7376
const id = objectID().toHexString();
7477
dispatch({
@@ -113,10 +116,13 @@ export function createFolder(formProps) {
113116
dispatch(setProjectSavedTime(response.data.project.updatedAt));
114117
dispatch(closeNewFolderModal());
115118
})
116-
.catch(response => dispatch({
117-
type: ActionTypes.ERROR,
118-
error: response.data
119-
}));
119+
.catch((error) => {
120+
const { response } = error;
121+
dispatch({
122+
type: ActionTypes.ERROR,
123+
error: response.data
124+
});
125+
});
120126
} else {
121127
const id = objectID().toHexString();
122128
dispatch({
@@ -163,7 +169,8 @@ export function deleteFile(id, parentId) {
163169
parentId
164170
});
165171
})
166-
.catch((response) => {
172+
.catch((error) => {
173+
const { response } = error;
167174
dispatch({
168175
type: ActionTypes.ERROR,
169176
error: response.data

Diff for: client/modules/IDE/actions/preferences.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ function updatePreferences(formParams, dispatch) {
88
axios.put(`${ROOT_URL}/preferences`, formParams, { withCredentials: true })
99
.then(() => {
1010
})
11-
.catch(response => dispatch({
12-
type: ActionTypes.ERROR,
13-
error: response.data
14-
}));
11+
.catch((error) => {
12+
const { response } = error;
13+
dispatch({
14+
type: ActionTypes.ERROR,
15+
error: response.data
16+
});
17+
});
1518
}
1619

1720
export function setFontSize(value) {

0 commit comments

Comments
 (0)