Skip to content

Commit 13ae403

Browse files
authored
Merge branch 'develop' into piyush/fix-autocapitalize
2 parents 5063963 + 107ef19 commit 13ae403

Some content is hidden

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

55 files changed

+1189
-1057
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/About.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,20 @@ function About(props) {
162162
{t('About.Discord')}
163163
</a>
164164
</p>
165+
<p className="about__content-column-list">
166+
<a
167+
href="https://p5js.org/download/support.html"
168+
target="_blank"
169+
rel="noopener noreferrer"
170+
>
171+
<AsteriskIcon
172+
className="about__content-column-asterisk"
173+
aria-hidden="true"
174+
focusable="false"
175+
/>
176+
Donate
177+
</a>
178+
</p>
165179
<p className="about__content-column-list">
166180
<Link to="/privacy-policy">
167181
<AsteriskIcon

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const EditorContainer = styled.div`
99
transform: ${(props) =>
1010
props.expanded ? 'translateX(50%)' : 'translateX(0)'};
1111
12-
> header {
12+
> div {
1313
display: flex;
1414
${prop('MobilePanel.secondary')}
1515
> span {

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ class Editor extends React.Component {
208208
if (/^[a-z]$/i.test(e.key) && (mode === 'css' || mode === 'javascript')) {
209209
this.showHint(_cm);
210210
}
211+
if (e.key === 'Escape') {
212+
e.preventDefault();
213+
this._cm.getInputField().blur();
214+
}
211215
});
212216

213217
this._cm.getWrapperElement().style[
@@ -338,7 +342,7 @@ class Editor extends React.Component {
338342
mode = 'application/json';
339343
} else if (fileName.match(/.+\.(frag|glsl)$/i)) {
340344
mode = 'x-shader/x-fragment';
341-
} else if (fileName.match(/.+\.(vert|stl)$/i)) {
345+
} else if (fileName.match(/.+\.(vert|stl|mtl)$/i)) {
342346
mode = 'x-shader/x-vertex';
343347
} else {
344348
mode = 'text/plain';
@@ -513,7 +517,7 @@ class Editor extends React.Component {
513517
{(matches) =>
514518
matches ? (
515519
<section className={editorSectionClass}>
516-
<header className="editor__header">
520+
<div className="editor__header">
517521
<button
518522
aria-label={this.props.t('Editor.OpenSketchARIA')}
519523
className="sidebar__contract"
@@ -538,7 +542,7 @@ class Editor extends React.Component {
538542
</span>
539543
<Timer />
540544
</div>
541-
</header>
545+
</div>
542546
<article
543547
ref={(element) => {
544548
this.codemirrorContainer = element;
@@ -555,7 +559,7 @@ class Editor extends React.Component {
555559
</section>
556560
) : (
557561
<EditorContainer expanded={this.props.isExpanded}>
558-
<header>
562+
<>
559563
<IconButton
560564
onClick={this.props.expandSidebar}
561565
icon={FolderIcon}
@@ -564,7 +568,7 @@ class Editor extends React.Component {
564568
{this.props.file.name}
565569
<UnsavedChangesIndicator />
566570
</span>
567-
</header>
571+
</>
568572
<section>
569573
<EditorHolder
570574
ref={(element) => {

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

Lines changed: 14 additions & 16 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'])
@@ -272,7 +270,7 @@ const UnauthenticatedUserMenu = () => {
272270
</span>
273271
</Link>
274272
</li>
275-
<span className="nav__item-or">{t('Nav.LoginOr')}</span>
273+
<li className="nav__item-or">{t('Nav.LoginOr')}</li>
276274
<li className="nav__item">
277275
<Link to="/signup" className="nav__auth-button">
278276
<span className="nav__item-header" title="SignUp">

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
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 (
12-
<header>
15+
<>
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>
26-
</header>
17+
{!isMobile && (
18+
<Toolbar syncFileContent={props.syncFileContent} key={project.id} />
19+
)}
20+
</>
2721
);
2822
};
2923

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)