Skip to content

Commit be14e6a

Browse files
committed
Merge branch 'master' into add-readme-ko-translation
2 parents 8b95d44 + 5b63410 commit be14e6a

File tree

20 files changed

+497
-420
lines changed

20 files changed

+497
-420
lines changed

client/components/Nav.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class Nav extends React.PureComponent {
227227

228228
renderDashboardMenu(navDropdownState) {
229229
return (
230-
<ul className="nav__items-left" title="project-menu">
230+
<ul className="nav__items-left">
231231
<li className="nav__item-logo">
232232
<InlineSVG src={logoUrl} alt="p5.js logo" className="svg__logo" />
233233
</li>
@@ -245,7 +245,7 @@ class Nav extends React.PureComponent {
245245

246246
renderProjectMenu(navDropdownState) {
247247
return (
248-
<ul className="nav__items-left" title="project-menu">
248+
<ul className="nav__items-left">
249249
<li className="nav__item-logo">
250250
<InlineSVG src={logoUrl} alt="p5.js logo" className="svg__logo" />
251251
</li>

client/components/NavBasic.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class NavBasic extends React.PureComponent {
1313
render() {
1414
return (
1515
<nav className="nav" title="main-navigation" ref={(node) => { this.node = node; }}>
16-
<ul className="nav__items-left" title="project-menu">
16+
<ul className="nav__items-left">
1717
<li className="nav__item-logo">
1818
<InlineSVG src={logoUrl} alt="p5.js logo" className="svg__logo" />
1919
</li>

client/components/__test__/__snapshots__/Nav.test.jsx.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ exports[`Nav renders correctly 1`] = `
77
>
88
<ul
99
className="nav__items-left"
10-
title="project-menu"
1110
>
1211
<li
1312
className="nav__item-logo"

client/modules/IDE/actions/collections.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import axios from 'axios';
2+
import { browserHistory } from 'react-router';
23
import * as ActionTypes from '../../../constants';
34
import { startLoader, stopLoader } from './loader';
45
import { setToastText, showToast } from './toast';
@@ -47,20 +48,22 @@ export function createCollection(collection) {
4748
});
4849
dispatch(stopLoader());
4950

50-
const collectionName = response.data.name;
51-
dispatch(setToastText(`Created "${collectionName}"`));
51+
const newCollection = response.data;
52+
dispatch(setToastText(`Created "${newCollection.name}"`));
5253
dispatch(showToast(TOAST_DISPLAY_TIME_MS));
5354

54-
return response.data;
55+
const pathname = `/${newCollection.owner.username}/collections/${newCollection.id}`;
56+
const location = { pathname, state: { skipSavingPath: true } };
57+
58+
browserHistory.push(location);
5559
})
5660
.catch((response) => {
61+
console.error('Error creating collection', response.data);
5762
dispatch({
5863
type: ActionTypes.ERROR,
5964
error: response.data
6065
});
6166
dispatch(stopLoader());
62-
63-
return response.data;
6467
});
6568
};
6669
}

client/modules/IDE/components/KeyboardShortcutModal.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ function KeyboardShortcutModal() {
7474
</span>
7575
<span>Turn off Accessible Output</span>
7676
</li>
77+
<li className="keyboard-shortcut-item">
78+
<span className="keyboard-shortcut__command">
79+
{metaKeyName} + B
80+
</span>
81+
<span>Toggle Sidebar</span>
82+
</li>
7783
</ul>
7884
);
7985
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ const QuickAddList = ({
5353
{...item}
5454
onSelect={
5555
(event) => {
56-
event.target.blur();
56+
event.stopPropagation();
57+
event.currentTarget.blur();
5758
handleAction(item);
5859
}
5960
}

client/modules/IDE/components/Searchbar/Searchbar.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ class Searchbar extends React.Component {
2626

2727
handleSearchEnter = (e) => {
2828
if (e.key === 'Enter') {
29-
this.props.setSearchTerm(this.state.searchValue);
29+
this.searchChange();
3030
}
3131
}
3232

33-
searchChange = (value) => {
34-
this.props.setSearchTerm(this.state.searchValue);
33+
searchChange = () => {
34+
if (this.state.searchValue.trim().length === 0) return;
35+
this.props.setSearchTerm(this.state.searchValue.trim());
3536
};
3637

3738
handleSearchChange = (e) => {

client/modules/IDE/pages/IDEView.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ class IDEView extends React.Component {
156156
} else if (e.keyCode === 49 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac)) && e.shiftKey) {
157157
e.preventDefault();
158158
this.props.setAllAccessibleOutput(true);
159+
} else if (e.keyCode === 66 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) {
160+
e.preventDefault();
161+
if (!this.props.ide.sidebarIsExpanded) {
162+
this.props.expandSidebar();
163+
} else {
164+
this.props.collapseSidebar();
165+
}
159166
}
160167
}
161168

client/modules/User/components/Collection.jsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,15 +380,15 @@ Collection.propTypes = {
380380
}).isRequired,
381381
getCollections: PropTypes.func.isRequired,
382382
collection: PropTypes.shape({
383-
id: PropTypes.string.isRequired,
384-
name: PropTypes.string.isRequired,
383+
id: PropTypes.string,
384+
name: PropTypes.string,
385385
slug: PropTypes.string,
386386
description: PropTypes.string,
387387
owner: PropTypes.shape({
388-
username: PropTypes.string.isRequired,
388+
username: PropTypes.string,
389389
}).isRequired,
390390
items: PropTypes.arrayOf(PropTypes.shape({})),
391-
}).isRequired,
391+
}),
392392
username: PropTypes.string,
393393
loading: PropTypes.bool.isRequired,
394394
toggleDirectionForField: PropTypes.func.isRequired,
@@ -401,7 +401,14 @@ Collection.propTypes = {
401401
};
402402

403403
Collection.defaultProps = {
404-
username: undefined
404+
username: undefined,
405+
collection: {
406+
id: undefined,
407+
items: [],
408+
owner: {
409+
username: undefined
410+
}
411+
}
405412
};
406413

407414
function mapStateToProps(state, ownProps) {

client/modules/User/components/CollectionCreate.jsx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import PropTypes from 'prop-types';
22
import React from 'react';
33
import { Helmet } from 'react-helmet';
44
import { connect } from 'react-redux';
5-
import { browserHistory } from 'react-router';
65
import { bindActionCreators } from 'redux';
76
import * as CollectionsActions from '../../IDE/actions/collections';
87

@@ -39,19 +38,7 @@ class CollectionCreate extends React.Component {
3938
handleCreateCollection = (event) => {
4039
event.preventDefault();
4140

42-
this.props.createCollection(this.state.collection)
43-
.then(({ id, owner }) => {
44-
const pathname = `/${owner.username}/collections/${id}`;
45-
const location = { pathname, state: { skipSavingPath: true } };
46-
47-
browserHistory.replace(location);
48-
})
49-
.catch((error) => {
50-
console.error('Error creating collection', error);
51-
this.setState({
52-
creationError: error,
53-
});
54-
});
41+
this.props.createCollection(this.state.collection);
5542
}
5643

5744
render() {
@@ -107,12 +94,7 @@ CollectionCreate.propTypes = {
10794
username: PropTypes.string,
10895
authenticated: PropTypes.bool.isRequired
10996
}).isRequired,
110-
createCollection: PropTypes.func.isRequired,
111-
collection: PropTypes.shape({}).isRequired, // TODO
112-
sorting: PropTypes.shape({
113-
field: PropTypes.string.isRequired,
114-
direction: PropTypes.string.isRequired
115-
}).isRequired
97+
createCollection: PropTypes.func.isRequired
11698
};
11799

118100
function mapStateToProps(state, ownProps) {

0 commit comments

Comments
 (0)