Skip to content

Commit b00d2e3

Browse files
authored
Merge branch 'develop' into scroll-in-policy-container
2 parents 414ab18 + 0df9082 commit b00d2e3

File tree

21 files changed

+288
-340
lines changed

21 files changed

+288
-340
lines changed

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ If you have found a bug in the p5.js Web Editor, you can file it under the ["iss
3131

3232
To see which pull requests and issues are currently being reviewed, check the [PR Review Board](https://github.com/processing/p5.js-web-editor/projects/9) or the following Milestones: [MINOR Release](https://github.com/processing/p5.js-web-editor/milestone/8).
3333

34-
Issues and Pull Requests categorized under the PATCH or MINOR Release Milestones will be prioritized since they are planned to be merged for the next release to Production. Please feel free to [comment on this pinned issue](https://github.com/processing/p5.js-web-editor/issues/2534) if you would like your issue to be considered for the next release!
35-
36-
37-
### When Will the Next Production Release Be?
38-
39-
We will aim to deploy on a 1-2 month basis. Here are some dates we’re working towards:
40-
41-
2.12.0 MINOR Release: By February 27, 2024
42-
43-
[You can read more about Semantic Versioning and the differences between a MINOR and PATCH release](https://semver.org/).
44-
4534

4635
## References for Contributing to the p5.js Web Editor
4736

client/components/Dropdown/TableDropdown.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import React from 'react';
2-
import { useMediaQuery } from 'react-responsive';
32
import styled from 'styled-components';
43
import { prop, remSize } from '../../theme';
54
import DropdownMenu from './DropdownMenu';
65

76
import DownFilledTriangleIcon from '../../images/down-filled-triangle.svg';
87
import MoreIconSvg from '../../images/more.svg';
8+
import useIsMobile from '../../modules/IDE/hooks/useIsMobile';
99

1010
const DotsHorizontal = styled(MoreIconSvg)`
1111
transform: rotate(90deg);
1212
`;
1313

1414
const TableDropdownIcon = () => {
15-
// TODO: centralize breakpoints
16-
const isMobile = useMediaQuery({ maxWidth: 770 });
17-
15+
const isMobile = useIsMobile();
1816
return isMobile ? (
1917
<DotsHorizontal focusable="false" aria-hidden="true" />
2018
) : (

client/modules/IDE/components/Editor/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class Editor extends React.Component {
338338
mode = 'application/json';
339339
} else if (fileName.match(/.+\.(frag|glsl)$/i)) {
340340
mode = 'x-shader/x-fragment';
341-
} else if (fileName.match(/.+\.(vert|stl)$/i)) {
341+
} else if (fileName.match(/.+\.(vert|stl|mtl)$/i)) {
342342
mode = 'x-shader/x-vertex';
343343
} else {
344344
mode = 'text/plain';

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { sortBy } from 'lodash';
44
import { Link } from 'react-router-dom';
55
import PropTypes from 'prop-types';
66
import { useTranslation } from 'react-i18next';
7-
import MediaQuery from 'react-responsive';
87
import NavDropdownMenu from '../../../../components/Nav/NavDropdownMenu';
98
import NavMenuItem from '../../../../components/Nav/NavMenuItem';
109
import { availableLanguages, languageKeyToLabel } from '../../../../i18n';
@@ -30,21 +29,20 @@ import {
3029
import { logoutUser } from '../../../User/actions';
3130
import { CmControllerContext } from '../../pages/IDEView';
3231
import MobileNav from './MobileNav';
32+
import useIsMobile from '../../hooks/useIsMobile';
3333

34-
const Nav = ({ layout }) => (
35-
<MediaQuery minWidth={770}>
36-
{(matches) =>
37-
matches ? (
38-
<NavBar>
39-
<LeftLayout layout={layout} />
40-
<UserMenu />
41-
</NavBar>
42-
) : (
43-
<MobileNav />
44-
)
45-
}
46-
</MediaQuery>
47-
);
34+
const Nav = ({ layout }) => {
35+
const isMobile = useIsMobile();
36+
37+
return isMobile ? (
38+
<MobileNav />
39+
) : (
40+
<NavBar>
41+
<LeftLayout layout={layout} />
42+
<UserMenu />
43+
</NavBar>
44+
);
45+
};
4846

4947
Nav.propTypes = {
5048
layout: PropTypes.oneOf(['dashboard', 'project'])

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { useSelector } from 'react-redux';
4-
import MediaQuery from 'react-responsive';
4+
import useIsMobile from '../../hooks/useIsMobile';
5+
56
import Nav from './Nav';
67
import Toolbar from './Toolbar';
78

89
const Header = (props) => {
910
const project = useSelector((state) => state.project);
1011

12+
const isMobile = useIsMobile();
13+
1114
return (
1215
<header>
1316
<Nav />
14-
<MediaQuery minWidth={770}>
15-
{(matches) => {
16-
if (matches)
17-
return (
18-
<Toolbar
19-
syncFileContent={props.syncFileContent}
20-
key={project.id}
21-
/>
22-
);
23-
return null;
24-
}}
25-
</MediaQuery>
17+
{!isMobile && (
18+
<Toolbar syncFileContent={props.syncFileContent} key={project.id} />
19+
)}
2620
</header>
2721
);
2822
};

client/modules/IDE/components/IDEOverlays.jsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ export default function IDEOverlays() {
3434
preferencesIsVisible,
3535
keyboardShortcutVisible,
3636
shareModalVisible,
37-
shareModalProjectId,
38-
shareModalProjectName,
39-
shareModalProjectUsername,
4037
errorType,
4138
previousPath
4239
} = useSelector((state) => state.ide);
@@ -87,11 +84,7 @@ export default function IDEOverlays() {
8784
ariaLabel={t('IDEView.ShareARIA')}
8885
closeOverlay={() => dispatch(closeShareModal())}
8986
>
90-
<ShareModal
91-
projectId={shareModalProjectId}
92-
projectName={shareModalProjectName}
93-
ownerUsername={shareModalProjectUsername}
94-
/>
87+
<ShareModal />
9588
</Overlay>
9689
)}
9790
{keyboardShortcutVisible && (

client/modules/IDE/components/ShareModal.jsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
import PropTypes from 'prop-types';
21
import React from 'react';
32
import { useTranslation } from 'react-i18next';
3+
import { useSelector } from 'react-redux';
44
import CopyableInput from './CopyableInput';
55
// import getConfig from '../../../utils/getConfig';
66

7-
const ShareModal = ({ projectId, ownerUsername, projectName }) => {
7+
const ShareModal = () => {
88
const { t } = useTranslation();
9+
10+
// TODO: store these as nested properties instead of top-level
11+
const projectId = useSelector((state) => state.ide.shareModalProjectId);
12+
const projectName = useSelector((state) => state.ide.shareModalProjectName);
13+
const ownerUsername = useSelector(
14+
(state) => state.ide.shareModalProjectUsername
15+
);
16+
917
const hostname = window.location.origin;
1018
// const previewUrl = getConfig('PREVIEW_URL');
1119
return (
@@ -35,10 +43,4 @@ const ShareModal = ({ projectId, ownerUsername, projectName }) => {
3543
);
3644
};
3745

38-
ShareModal.propTypes = {
39-
projectId: PropTypes.string.isRequired,
40-
ownerUsername: PropTypes.string.isRequired,
41-
projectName: PropTypes.string.isRequired
42-
};
43-
4446
export default ShareModal;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { useMediaQuery } from 'react-responsive';
2+
3+
const useIsMobile = (customBreakpoint) => {
4+
const breakPoint = customBreakpoint || 770;
5+
const isMobile = useMediaQuery({ maxWidth: breakPoint });
6+
return isMobile;
7+
};
8+
9+
export default useIsMobile;

0 commit comments

Comments
 (0)