Skip to content

Commit 3c0ca14

Browse files
committed
Merge branch 'develop' of https://github.com/processing/p5.js-web-editor into dewanshmobile/mobilenav
2 parents 99de115 + cade211 commit 3c0ca14

File tree

10 files changed

+502
-742
lines changed

10 files changed

+502
-742
lines changed

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';
@@ -111,17 +112,14 @@ const DashboardMenu = () => {
111112
);
112113
};
113114

114-
const ProjectMenu = (props) => {
115+
const ProjectMenu = () => {
115116
const isUserOwner = useSelector(getIsUserOwner);
116117
const project = useSelector((state) => state.project);
117118
const user = useSelector((state) => state.user);
118119

119120
const isUnsaved = !project?.id;
120121

121-
// TODO: use selectRootFile selector
122-
const rootFile = useSelector(
123-
(state) => state.files.filter((file) => file.name === 'root')[0]
124-
);
122+
const rootFile = useSelector(selectRootFile);
125123

126124
const cmRef = useContext(CmControllerContext);
127125

0 commit comments

Comments
 (0)