Skip to content

Commit 7b270be

Browse files
author
Alexis Hope
authored
Merge branch 'develop' into button-router-test
2 parents 6fbcd65 + 0bd139b commit 7b270be

18 files changed

+751
-1042
lines changed

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,

client/modules/IDE/components/Header/Nav.jsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { setLanguage } from '../../actions/preferences';
1414
import NavBar from '../../../../components/Nav/NavBar';
1515
import CaretLeftIcon from '../../../../images/left-arrow.svg';
1616
import LogoIcon from '../../../../images/p5js-logo-small.svg';
17+
import { selectRootFile } from '../../selectors/files';
1718
import { selectSketchPath } from '../../selectors/project';
1819
import { metaKey, metaKeyName } from '../../../../utils/metaKey';
1920
import { useSketchActions } from '../../hooks';
@@ -102,17 +103,14 @@ const DashboardMenu = () => {
102103
);
103104
};
104105

105-
const ProjectMenu = (props) => {
106+
const ProjectMenu = () => {
106107
const isUserOwner = useSelector(getIsUserOwner);
107108
const project = useSelector((state) => state.project);
108109
const user = useSelector((state) => state.user);
109110

110111
const isUnsaved = !project?.id;
111112

112-
// TODO: use selectRootFile selector
113-
const rootFile = useSelector(
114-
(state) => state.files.filter((file) => file.name === 'root')[0]
115-
);
113+
const rootFile = useSelector(selectRootFile);
116114

117115
const cmRef = useContext(CmControllerContext);
118116

0 commit comments

Comments
 (0)