Skip to content

Commit 43e9bbe

Browse files
authored
Merge branch 'develop' into Issue#2866
2 parents a9c11d8 + 740203b commit 43e9bbe

File tree

95 files changed

+6094
-1845
lines changed

Some content is hidden

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

95 files changed

+6094
-1845
lines changed

.storybook/decorator-theme.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { upperFirst } from 'lodash';
2+
import React from 'react';
3+
import styled, { ThemeProvider } from 'styled-components';
4+
import theme, { prop } from '../client/theme';
5+
6+
const PreviewArea = styled.div`
7+
background: ${prop('backgroundColor')};
8+
flex-grow: 1;
9+
padding: 2rem;
10+
& > h4 {
11+
margin-top: 0;
12+
color: ${prop('primaryTextColor')};
13+
}
14+
`;
15+
16+
const themeKeys = Object.keys(theme);
17+
18+
export const withThemeProvider = (Story, context) => {
19+
const setting = context.globals.theme;
20+
if (setting === 'all') {
21+
return (
22+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
23+
{Object.keys(theme).map((themeName) => (
24+
<ThemeProvider theme={theme[themeName]} key={themeName}>
25+
<PreviewArea className={themeName}>
26+
<h4>{upperFirst(themeName)}</h4>
27+
<Story />
28+
</PreviewArea>
29+
</ThemeProvider>
30+
))}
31+
</div>
32+
);
33+
} else {
34+
const themeName = setting;
35+
return (
36+
<ThemeProvider theme={theme[themeName]}>
37+
<PreviewArea className={themeName}>
38+
<Story />
39+
</PreviewArea>
40+
</ThemeProvider>
41+
);
42+
}
43+
};
44+
45+
export const themeToolbarItem = {
46+
description: 'Global theme for components',
47+
defaultValue: 'all',
48+
toolbar: {
49+
title: 'Theme',
50+
icon: 'mirror',
51+
items: [...themeKeys, 'all']
52+
}
53+
};

.storybook/preview.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import React from 'react';
22
import { Provider } from 'react-redux';
33
import { MemoryRouter } from 'react-router';
44

5-
import ThemeProvider from '../client/modules/App/components/ThemeProvider';
65
import configureStore from '../client/store';
76
import '../client/i18n-test';
87
import '../client/styles/storybook.css'
8+
import { withThemeProvider, themeToolbarItem } from './decorator-theme';
99

1010
const initialState = window.__INITIAL_STATE__;
1111

@@ -21,5 +21,9 @@ export const decorators = [
2121
</MemoryRouter>
2222
</Provider>
2323
),
24-
]
24+
withThemeProvider
25+
];
2526

27+
export const globalTypes = {
28+
theme: themeToolbarItem
29+
};

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ FROM base as development
1010
ENV NODE_ENV development
1111
COPY package.json package-lock.json ./
1212
RUN npm install
13-
RUN npm rebuild node-sass
1413
COPY .babelrc index.js nodemon.json ./
1514
COPY ./webpack ./webpack
1615
COPY client ./client
@@ -27,6 +26,5 @@ FROM base as production
2726
ENV NODE_ENV=production
2827
COPY package.json package-lock.json index.js ./
2928
RUN npm install --production
30-
RUN npm rebuild node-sass
3129
COPY --from=build $APP_HOME/dist ./dist
3230
CMD ["npm", "run", "start:prod"]

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.11.0 MINOR Release: By January 16, 2023
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/constants.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@ export const SET_SORT_PARAMS = 'SET_SORT_PARAMS';
137137
export const SET_SEARCH_TERM = 'SET_SEARCH_TERM';
138138
export const CLOSE_SKETCHLIST_MODAL = 'CLOSE_SKETCHLIST_MODAL';
139139

140-
export const START_LOADING = 'START_LOADING';
141-
export const STOP_LOADING = 'STOP_LOADING';
142-
143140
export const START_SAVING_PROJECT = 'START_SAVING_PROJECT';
144141
export const END_SAVING_PROJECT = 'END_SAVING_PROJECT';
145142

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { connect } from 'react-redux';
3+
import { useSelector } from 'react-redux';
44
import { ThemeProvider } from 'styled-components';
5+
import theme from '../../../theme';
56

6-
import theme, { Theme } from '../../../theme';
7-
8-
const Provider = ({ children, currentTheme }) => (
9-
<ThemeProvider theme={{ ...theme[currentTheme] }}>{children}</ThemeProvider>
10-
);
7+
const Provider = ({ children }) => {
8+
const currentTheme = useSelector((state) => state.preferences.theme);
9+
return (
10+
<ThemeProvider theme={{ ...theme[currentTheme] }}>{children}</ThemeProvider>
11+
);
12+
};
1113

1214
Provider.propTypes = {
13-
children: PropTypes.node.isRequired,
14-
currentTheme: PropTypes.oneOf(Object.keys(Theme)).isRequired
15+
children: PropTypes.node.isRequired
1516
};
1617

17-
function mapStateToProps(state) {
18-
return {
19-
currentTheme: state.preferences.theme
20-
};
21-
}
22-
23-
export default connect(mapStateToProps)(Provider);
18+
export default Provider;

client/modules/IDE/actions/assets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import apiClient from '../../../utils/apiClient';
22
import * as ActionTypes from '../../../constants';
3-
import { startLoader, stopLoader } from './loader';
3+
import { startLoader, stopLoader } from '../reducers/loading';
44
import { assetsActions } from '../reducers/assets';
55

66
const { setAssets, deleteAsset } = assetsActions;

client/modules/IDE/actions/collections.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import browserHistory from '../../../browserHistory';
22
import apiClient from '../../../utils/apiClient';
33
import * as ActionTypes from '../../../constants';
4-
import { startLoader, stopLoader } from './loader';
4+
import { startLoader, stopLoader } from '../reducers/loading';
55
import { setToastText, showToast } from './toast';
66

77
const TOAST_DISPLAY_TIME_MS = 1500;
@@ -80,7 +80,7 @@ export function addToCollection(collectionId, projectId) {
8080

8181
const collectionName = response.data.name;
8282

83-
dispatch(setToastText(`Added to "${collectionName}`));
83+
dispatch(setToastText(`Added to "${collectionName}"`));
8484
dispatch(showToast(TOAST_DISPLAY_TIME_MS));
8585

8686
return response.data;
@@ -110,7 +110,7 @@ export function removeFromCollection(collectionId, projectId) {
110110

111111
const collectionName = response.data.name;
112112

113-
dispatch(setToastText(`Removed from "${collectionName}`));
113+
dispatch(setToastText(`Removed from "${collectionName}"`));
114114
dispatch(showToast(TOAST_DISPLAY_TIME_MS));
115115

116116
return response.data;

client/modules/IDE/actions/loader.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

client/modules/IDE/actions/projects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import apiClient from '../../../utils/apiClient';
22
import * as ActionTypes from '../../../constants';
3-
import { startLoader, stopLoader } from './loader';
3+
import { startLoader, stopLoader } from '../reducers/loading';
44

55
// eslint-disable-next-line
66
export function getProjects(username) {

client/modules/IDE/actions/projects.unit.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { rest } from 'msw';
55

66
import * as ProjectActions from './projects';
77
import * as ActionTypes from '../../../constants';
8+
import { startLoader, stopLoader } from '../reducers/loading';
89
import {
910
initialTestState,
1011
mockProjects
@@ -33,9 +34,9 @@ describe('projects action creator tests', () => {
3334
store = mockStore(initialTestState);
3435

3536
const expectedActions = [
36-
{ type: ActionTypes.START_LOADING },
37+
{ type: startLoader.type },
3738
{ type: ActionTypes.SET_PROJECTS, projects: mockProjects },
38-
{ type: ActionTypes.STOP_LOADING }
39+
{ type: stopLoader.type }
3940
];
4041

4142
return store

client/modules/IDE/components/About.jsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function About(props) {
2828
/>
2929
<div className="about__content-column">
3030
<p className="about__version-info">
31-
Web Editor: <span>v{packageData?.version}</span>
31+
{t('About.WebEditor')}: <span>v{packageData?.version}</span>
3232
</p>
3333
<p className="about__version-info">
3434
p5.js: <span>v{p5version}</span>
@@ -44,7 +44,7 @@ function About(props) {
4444
aria-hidden="true"
4545
focusable="false"
4646
/>
47-
Home
47+
{t('About.Home')}
4848
</a>
4949
</p>
5050
<p className="about__content-column-list">
@@ -86,7 +86,7 @@ function About(props) {
8686
aria-hidden="true"
8787
focusable="false"
8888
/>
89-
Twitter
89+
{t('About.Twitter')}
9090
</a>
9191
</p>
9292
<p className="about__content-column-list">
@@ -100,7 +100,7 @@ function About(props) {
100100
aria-hidden="true"
101101
focusable="false"
102102
/>
103-
Instagram
103+
{t('About.Instagram')}
104104
</a>
105105
</p>
106106
</div>
@@ -159,7 +159,21 @@ function About(props) {
159159
aria-hidden="true"
160160
focusable="false"
161161
/>
162-
Discord
162+
{t('About.Discord')}
163+
</a>
164+
</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
163177
</a>
164178
</p>
165179
<p className="about__content-column-list">

0 commit comments

Comments
 (0)