Skip to content

Commit 3efa347

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into refactor/share-modal
# Conflicts: # client/modules/IDE/pages/IDEView.jsx # client/modules/IDE/components/IDEOverlays.jsx
2 parents 8846d40 + 42dec8d commit 3efa347

File tree

176 files changed

+4999
-7470
lines changed

Some content is hidden

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

176 files changed

+4999
-7470
lines changed

.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ MAILGUN_KEY=<your-mailgun-api-key>
1919
ML5_LIBRARY_USERNAME=ml5
2020
ML5_LIBRARY_EMAIL=examples@ml5js.org
2121
ML5_LIBRARY_PASS=helloml5
22-
MOBILE_ENABLED=true
2322
MONGO_URL=mongodb://localhost:27017/p5js-web-editor
2423
PORT=8000
2524
PREVIEW_PORT=8002

.storybook/preview-head.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script>
2+
// https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/176#issuecomment-683150213
3+
window.$RefreshReg$ = () => {};
4+
window.$RefreshSig$ = () => () => {};
5+
</script>

.storybook/preview.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from 'react';
22
import { Provider } from 'react-redux';
3+
import { MemoryRouter } from 'react-router';
34

45
import ThemeProvider from '../client/modules/App/components/ThemeProvider';
56
import configureStore from '../client/store';
67
import '../client/i18n-test';
7-
import '../client/styles/build/css/main.css'
8+
import '../client/styles/storybook.css'
89

910
const initialState = window.__INITIAL_STATE__;
1011

@@ -13,9 +14,11 @@ const store = configureStore(initialState);
1314
export const decorators = [
1415
(Story) => (
1516
<Provider store={store}>
16-
<ThemeProvider>
17-
<Story />
18-
</ThemeProvider>
17+
<MemoryRouter>
18+
<ThemeProvider>
19+
<Story />
20+
</ThemeProvider>
21+
</MemoryRouter>
1922
</Provider>
2023
),
2124
]

README.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@ The p5.js Editor is a collaborative project created by many individuals, mostly
1212

1313
Learn more about [our community](https://p5js.org/community/) and read our community statement and [code of conduct](./.github/CODE_OF_CONDUCT.md). You can directly support our work with p5.js by [donating to the Processing Foundation](https://processingfoundation.org/support).
1414

15-
## Get Started
15+
## Getting Started
1616

1717
Make your first sketch in the [p5.js Editor](https://editor.p5js.org/)! Learn more about sketching with p5.js on the [Get Started](https://p5js.org/get-started/) and find everything you can do in the [Reference](https://p5js.org/reference/). You can also look at [examples](https://editor.p5js.org/p5/sketches) and remix them in the p5.js Editor.
1818

19-
## Setting Up the Development Environment
20-
21-
- Refer to [this documentation for setting up your environment](https://github.com/processing/p5.js-web-editor/blob/develop/contributor_docs/installation.md)
22-
23-
2419

2520
## Issues
2621

@@ -31,10 +26,45 @@ If you have found a bug in the p5.js Web Editor, you can file it under the ["iss
3126
* p5.sound: [https://github.com/processing/p5.js-sound/issues](https://github.com/processing/p5.js-sound/issues)
3227
* p5.js website: [https://github.com/processing/p5.js-website/issues](https://github.com/processing/p5.js-website/issues)
3328

29+
30+
### How Do I Know My Issue or Pull Request is Getting Reviewed?
31+
32+
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: [PATCH Release](https://github.com/processing/p5.js-web-editor/milestone/10), [MINOR Release](https://github.com/processing/p5.js-web-editor/milestone/8).
33+
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.9.3 PATCH Release: By November 17, 2023
42+
43+
2.10.0 MINOR Release: By December 15, 2023
44+
45+
[You can read more about Semantic Versioning and the differences between a MINOR and PATCH release](https://semver.org/).
46+
47+
48+
## References for Contributing to the p5.js Web Editor
49+
50+
[Code of Conduct](https://editor.p5js.org/code-of-conduct)
51+
52+
[Contribution Guidelines for p5.js](https://p5js.org/contributor-docs/#/)
53+
54+
[Contribution Guidelines for the p5.js Web Editor](https://github.com/processing/p5.js-web-editor/tree/develop/contributor_docs)
55+
56+
[p5.js Community Statement](https://p5js.org/community/)
57+
58+
3459
## Acknowledgements
3560

3661
Support for this project has come from [Processing Foundation](https://processingfoundation.org/), [NYU ITP](https://tisch.nyu.edu/itp), [CS4All, NYC DOE](http://cs4all.nyc/), [COSA at DU](https://liberalarts.du.edu/emergent-digital-practices/open-source-arts), [STUDIO for Creative Inquiry](https://studioforcreativeinquiry.org/), [Grant for the Web](https://www.grantfortheweb.org/), [New Media Rights](https://www.newmediarights.org/), and many others.
3762

38-
Hosting and technical support has come from: <br />
39-
<a href="https://releasehub.com/" target="_blank"><img width="100" src="https://assets.website-files.com/603dd147c5b0a480611bd348/603dd147c5b0a469bc1bd451_logo--dark.svg" /></a>
63+
Hosting and technical support has come from:
64+
<br />
65+
<br />
66+
<a href="https://releasehub.com/" target="_blank"><img width="100" src="https://assets.website-files.com/603dd147c5b0a480611bd348/603dd147c5b0a469bc1bd451_logo--dark.svg" /></a>
67+
<br />
4068
<a href="https://www.browserstack.com/" target="_blank"><img width="100" src="https://user-images.githubusercontent.com/6063380/46976166-ab280a80-d096-11e8-983b-18dd38c8cc9b.png" /></a>
69+
<br />
70+
<a href="https://www.fastly.com/" target="_blank"><img width="100" src="https://cdn-assets-us.frontify.com/s3/frontify-enterprise-files-us/eyJwYXRoIjoiZmFzdGx5XC9hY2NvdW50c1wvYzJcLzQwMDEwMjNcL3Byb2plY3RzXC8xMVwvYXNzZXRzXC80ZVwvNzc0XC9lZTZmYzlkOWYzNWE1NjBkNjUzNjFkNGI0NGQ2MTNmZi0xNjIxNTIyODg4LnBuZyJ9:fastly:nVuY3PxyFqQMI6elJsMzxAGLH3IFlmiuMdacHAGRMkE?width=2400" /></a>

client/common/ButtonOrLink.test.jsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { render, screen, fireEvent } from '../test-utils';
2+
import { render, screen, fireEvent, waitFor, history } from '../test-utils';
33
import ButtonOrLink from './ButtonOrLink';
44

55
describe('ButtonOrLink', () => {
@@ -25,8 +25,12 @@ describe('ButtonOrLink', () => {
2525
expect(link).toHaveAttribute('href', 'https://p5js.org');
2626
});
2727

28-
it('can render an internal link with react-router', () => {
28+
it('can render an internal link with react-router', async () => {
2929
render(<ButtonOrLink href="/about">About</ButtonOrLink>);
30-
// TODO: how can this be tested? Needs a router provider?
30+
31+
const link = screen.getByText('About');
32+
fireEvent.click(link);
33+
34+
await waitFor(() => expect(history.location.pathname).toEqual('/about'));
3135
});
3236
});

client/components/mobile/IconButton.jsx renamed to client/common/IconButton.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import styled from 'styled-components';
4-
import Button from '../../common/Button';
5-
import { remSize } from '../../theme';
4+
import Button from './Button';
5+
import { remSize } from '../theme';
66

77
const ButtonWrapper = styled(Button)`
88
width: ${remSize(48)};

client/common/icons.jsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ import DropdownArrow from '../images/down-filled-triangle.svg';
1313
import Preferences from '../images/preferences.svg';
1414
import Play from '../images/triangle-arrow-right.svg';
1515
import More from '../images/more.svg';
16+
import Editor from '../images/editor.svg';
17+
import Account from '../images/account.svg';
1618
import Code from '../images/code.svg';
1719
import Save from '../images/save.svg';
1820
import Terminal from '../images/terminal.svg';
19-
2021
import Folder from '../images/folder-padded.svg';
21-
2222
import CircleTerminal from '../images/circle-terminal.svg';
2323
import CircleFolder from '../images/circle-folder.svg';
2424
import CircleInfo from '../images/circle-info.svg';
25+
import Add from '../images/add.svg';
26+
import Filter from '../images/filter.svg';
27+
import Cross from '../images/cross.svg';
2528

2629
// HOC that adds the right web accessibility props
2730
// https://www.scottohara.me/blog/2019/05/22/contextual-images-svgs-and-a11y.html
@@ -83,16 +86,19 @@ export const GoogleIcon = withLabel(Google);
8386
export const PlusIcon = withLabel(Plus);
8487
export const CloseIcon = withLabel(Close);
8588
export const ExitIcon = withLabel(Exit);
89+
export const EditorIcon = withLabel(Editor);
90+
export const AccountIcon = withLabel(Account);
8691
export const DropdownArrowIcon = withLabel(DropdownArrow);
8792
export const PreferencesIcon = withLabel(Preferences);
8893
export const PlayIcon = withLabel(Play);
8994
export const MoreIcon = withLabel(More);
9095
export const TerminalIcon = withLabel(Terminal);
9196
export const CodeIcon = withLabel(Code);
9297
export const SaveIcon = withLabel(Save);
93-
9498
export const FolderIcon = withLabel(Folder);
95-
99+
export const CrossIcon = withLabel(Cross);
96100
export const CircleTerminalIcon = withLabel(CircleTerminal);
97101
export const CircleFolderIcon = withLabel(CircleFolder);
98102
export const CircleInfoIcon = withLabel(CircleInfo);
103+
export const AddIcon = withLabel(Add);
104+
export const FilterIcon = withLabel(Filter);

client/components/Dropdown.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import styled from 'styled-components';
44
import { remSize, prop } from '../theme';
5-
import IconButton from './mobile/IconButton';
5+
import IconButton from '../common/IconButton';
66

77
const DropdownWrapper = styled.ul`
88
background-color: ${prop('Modal.background')};

client/components/Nav/NavBar.jsx

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import React, {
66
useRef,
77
useState
88
} from 'react';
9+
import useKeyDownHandlers from '../../modules/IDE/hooks/useKeyDownHandlers';
910
import { MenuOpenContext, NavBarContext } from './contexts';
1011

11-
function NavBar({ children }) {
12+
function NavBar({ children, className }) {
1213
const [dropdownOpen, setDropdownOpen] = useState('none');
1314

1415
const timerRef = useRef(null);
@@ -31,18 +32,9 @@ function NavBar({ children }) {
3132
};
3233
}, [nodeRef, setDropdownOpen]);
3334

34-
// TODO: replace with `useKeyDownHandlers` after #2052 is merged
35-
useEffect(() => {
36-
function handleKeyDown(e) {
37-
if (e.keyCode === 27) {
38-
setDropdownOpen('none');
39-
}
40-
}
41-
document.addEventListener('keydown', handleKeyDown, false);
42-
return () => {
43-
document.removeEventListener('keydown', handleKeyDown, false);
44-
};
45-
}, [setDropdownOpen]);
35+
useKeyDownHandlers({
36+
escape: () => setDropdownOpen('none')
37+
});
4638

4739
const clearHideTimeout = useCallback(() => {
4840
if (timerRef.current) {
@@ -55,6 +47,15 @@ function NavBar({ children }) {
5547
timerRef.current = setTimeout(() => setDropdownOpen('none'), 10);
5648
}, [timerRef, setDropdownOpen]);
5749

50+
const toggleDropdownOpen = useCallback(
51+
(dropdown) => {
52+
setDropdownOpen((prevState) =>
53+
prevState === dropdown ? 'none' : dropdown
54+
);
55+
},
56+
[setDropdownOpen]
57+
);
58+
5859
const contextValue = useMemo(
5960
() => ({
6061
createDropdownHandlers: (dropdown) => ({
@@ -64,31 +65,33 @@ function NavBar({ children }) {
6465
);
6566
},
6667
onClick: () => {
67-
setDropdownOpen((prevState) =>
68-
prevState === 'none' ? dropdown : 'none'
69-
);
68+
toggleDropdownOpen(dropdown);
7069
},
7170
onBlur: handleBlur,
7271
onFocus: clearHideTimeout
7372
}),
7473
createMenuItemHandlers: (dropdown) => ({
75-
onMouseUp: () => {
74+
onMouseUp: (e) => {
75+
if (e.button === 2) {
76+
return;
77+
}
7678
setDropdownOpen('none');
7779
},
7880
onBlur: handleBlur,
7981
onFocus: () => {
8082
clearHideTimeout();
8183
setDropdownOpen(dropdown);
8284
}
83-
})
85+
}),
86+
toggleDropdownOpen
8487
}),
85-
[setDropdownOpen, clearHideTimeout, handleBlur]
88+
[setDropdownOpen, toggleDropdownOpen, clearHideTimeout, handleBlur]
8689
);
8790

8891
return (
8992
<NavBarContext.Provider value={contextValue}>
9093
<header>
91-
<nav className="nav" ref={nodeRef}>
94+
<nav className={className} ref={nodeRef}>
9295
<MenuOpenContext.Provider value={dropdownOpen}>
9396
{children}
9497
</MenuOpenContext.Provider>
@@ -99,11 +102,13 @@ function NavBar({ children }) {
99102
}
100103

101104
NavBar.propTypes = {
102-
children: PropTypes.node
105+
children: PropTypes.node,
106+
className: PropTypes.string
103107
};
104108

105109
NavBar.defaultProps = {
106-
children: null
110+
children: null,
111+
className: 'nav'
107112
};
108113

109114
export default NavBar;

client/components/Nav/NavDropdownMenu.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { useContext, useMemo } from 'react';
44
import TriangleIcon from '../../images/down-filled-triangle.svg';
55
import { MenuOpenContext, NavBarContext, ParentMenuContext } from './contexts';
66

7-
function NavDropdownMenu({ id, title, children }) {
7+
export function useMenuProps(id) {
88
const activeMenu = useContext(MenuOpenContext);
99

1010
const isOpen = id === activeMenu;
@@ -16,6 +16,12 @@ function NavDropdownMenu({ id, title, children }) {
1616
id
1717
]);
1818

19+
return { isOpen, handlers };
20+
}
21+
22+
function NavDropdownMenu({ id, title, children }) {
23+
const { isOpen, handlers } = useMenuProps(id);
24+
1925
return (
2026
<li className={classNames('nav__item', isOpen && 'nav__item--open')}>
2127
<button {...handlers}>

client/components/Nav/NavMenuItem.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useContext, useMemo } from 'react';
33
import ButtonOrLink from '../../common/ButtonOrLink';
44
import { NavBarContext, ParentMenuContext } from './contexts';
55

6-
function NavMenuItem({ hideIf, ...rest }) {
6+
function NavMenuItem({ hideIf, className, ...rest }) {
77
const parent = useContext(ParentMenuContext);
88

99
const { createMenuItemHandlers } = useContext(NavBarContext);
@@ -18,7 +18,7 @@ function NavMenuItem({ hideIf, ...rest }) {
1818
}
1919

2020
return (
21-
<li className="nav__dropdown-item">
21+
<li className={className}>
2222
<ButtonOrLink {...rest} {...handlers} />
2323
</li>
2424
);
@@ -31,13 +31,15 @@ NavMenuItem.propTypes = {
3131
/**
3232
* Provides a way to deal with optional items.
3333
*/
34-
hideIf: PropTypes.bool
34+
hideIf: PropTypes.bool,
35+
className: PropTypes.string
3536
};
3637

3738
NavMenuItem.defaultProps = {
3839
onClick: null,
3940
value: null,
40-
hideIf: false
41+
hideIf: false,
42+
className: 'nav__dropdown-item'
4143
};
4244

4345
export default NavMenuItem;

client/components/Nav/contexts.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ export const MenuOpenContext = createContext('none');
66

77
export const NavBarContext = createContext({
88
createDropdownHandlers: () => ({}),
9-
createMenuItemHandlers: () => ({})
9+
createMenuItemHandlers: () => ({}),
10+
toggleDropdownOpen: () => {}
1011
});

client/components/RootPage.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ import { prop } from '../theme';
44
const RootPage = styled.div`
55
min-height: 100%;
66
display: flex;
7+
justify-content: start;
78
flex-direction: column;
89
color: ${prop('primaryTextColor')};
910
background-color: ${prop('backgroundColor')};
1011
height: ${({ fixedHeight }) => fixedHeight || 'initial'};
12+
13+
@media (max-width: 770px) {
14+
height: 100%;
15+
overflow: hidden;
16+
}
1117
`;
1218

1319
export default RootPage;

0 commit comments

Comments
 (0)