Skip to content

Commit 068ebaa

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into refactor/dropdown
2 parents 74084cd + 0bd139b commit 068ebaa

Some content is hidden

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

41 files changed

+1347
-1867
lines changed

client/components/Nav.jsx

Lines changed: 0 additions & 417 deletions
This file was deleted.

client/components/Nav.unit.test.jsx

Lines changed: 0 additions & 69 deletions
This file was deleted.

client/modules/IDE/actions/toast.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,24 @@ export function hideToast() {
66
};
77
}
88

9-
export function showToast(time) {
9+
/**
10+
* Temporary fix until #2206 is merged.
11+
* Supports legacy two-action syntax:
12+
* dispatch(setToastText('Toast.SketchFailedSave'));
13+
* dispatch(showToast(1500));
14+
* And also supports proposed single-action syntax with message and optional timeout.
15+
* dispatch(showToast('Toast.SketchFailedSave'));
16+
* dispatch(showToast('Toast.SketchSaved', 5500));
17+
*/
18+
export function showToast(textOrTime, timeout = 1500) {
1019
return (dispatch) => {
20+
let time = timeout;
21+
if (typeof textOrTime === 'string') {
22+
// eslint-disable-next-line no-use-before-define
23+
dispatch(setToastText(textOrTime));
24+
} else {
25+
time = textOrTime;
26+
}
1127
dispatch({
1228
type: ActionTypes.SHOW_TOAST
1329
});

client/modules/IDE/components/AddToCollectionList.jsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Helmet } from 'react-helmet';
44
import { connect } from 'react-redux';
55
import { bindActionCreators } from 'redux';
66
import { withTranslation } from 'react-i18next';
7-
7+
import styled from 'styled-components';
88
import * as ProjectActions from '../actions/project';
99
import * as ProjectsActions from '../actions/projects';
1010
import * as CollectionsActions from '../actions/collections';
@@ -13,10 +13,24 @@ import * as SortingActions from '../actions/sorting';
1313
import getSortedCollections from '../selectors/collections';
1414
import Loader from '../../App/components/loader';
1515
import QuickAddList from './QuickAddList';
16+
import { remSize } from '../../../theme';
1617

1718
const projectInCollection = (project, collection) =>
1819
collection.items.find((item) => item.projectId === project.id) != null;
1920

21+
export const CollectionAddSketchWrapper = styled.div`
22+
width: ${remSize(600)};
23+
max-width: 100%;
24+
overflow: auto;
25+
`;
26+
27+
export const QuickAddWrapper = styled.div`
28+
width: ${remSize(600)};
29+
max-width: 100%;
30+
padding: ${remSize(24)};
31+
height: 100%;
32+
`;
33+
2034
class CollectionList extends React.Component {
2135
constructor(props) {
2236
super(props);
@@ -85,15 +99,14 @@ class CollectionList extends React.Component {
8599
}
86100

87101
return (
88-
<div className="collection-add-sketch">
89-
<div className="quick-add-wrapper">
102+
<CollectionAddSketchWrapper>
103+
<QuickAddWrapper>
90104
<Helmet>
91105
<title>{this.getTitle()}</title>
92106
</Helmet>
93-
94107
{content}
95-
</div>
96-
</div>
108+
</QuickAddWrapper>
109+
</CollectionAddSketchWrapper>
97110
);
98111
}
99112
}

client/modules/IDE/components/AddToCollectionSketchList.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import * as SortingActions from '../actions/sorting';
1212
import getSortedSketches from '../selectors/projects';
1313
import Loader from '../../App/components/loader';
1414
import QuickAddList from './QuickAddList';
15+
import {
16+
CollectionAddSketchWrapper,
17+
QuickAddWrapper
18+
} from './AddToCollectionList';
1519

1620
class SketchList extends React.Component {
1721
constructor(props) {
@@ -81,14 +85,14 @@ class SketchList extends React.Component {
8185
}
8286

8387
return (
84-
<div className="collection-add-sketch">
85-
<div className="quick-add-wrapper">
88+
<CollectionAddSketchWrapper>
89+
<QuickAddWrapper>
8690
<Helmet>
8791
<title>{this.getSketchesTitle()}</title>
8892
</Helmet>
8993
{content}
90-
</div>
91-
</div>
94+
</QuickAddWrapper>
95+
</CollectionAddSketchWrapper>
9296
);
9397
}
9498
}

client/modules/IDE/components/Editor.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import '../../../utils/htmlmixed';
4444
import '../../../utils/p5-javascript';
4545
import Timer from '../components/Timer';
4646
import EditorAccessibility from '../components/EditorAccessibility';
47+
import { selectActiveFile } from '../selectors/files';
4748
import AssetPreview from './AssetPreview';
4849
import { metaKey } from '../../../utils/metaKey';
4950
import './show-hint';
@@ -605,10 +606,7 @@ Editor.propTypes = {
605606
function mapStateToProps(state) {
606607
return {
607608
files: state.files,
608-
file:
609-
state.files.find((file) => file.isSelectedFile) ||
610-
state.files.find((file) => file.name === 'sketch.js') ||
611-
state.files.find((file) => file.name !== 'root'),
609+
file: selectActiveFile(state),
612610
htmlFile: getHTMLFile(state.files),
613611
ide: state.ide,
614612
preferences: state.preferences,

0 commit comments

Comments
 (0)