Skip to content

Commit ec5146f

Browse files
authored
Merge branch 'develop' into issue-#2652
2 parents ad3c27f + 6bb0bde commit ec5146f

File tree

19 files changed

+589
-495
lines changed

19 files changed

+589
-495
lines changed

client/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const availableLanguages = [
4242

4343
export function languageKeyToLabel(lang) {
4444
const languageMap = {
45-
be: 'Bengali',
45+
be: 'বাংলা',
4646
de: 'Deutsch',
4747
'en-US': 'English',
4848
'es-419': 'Español',

client/middleware.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createListenerMiddleware } from '@reduxjs/toolkit';
2+
3+
const listenerMiddleware = createListenerMiddleware();
4+
5+
export default listenerMiddleware;

client/modules/App/App.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
22
import React, { useEffect, useRef, useState } from 'react';
33
import { useDispatch, useSelector } from 'react-redux';
44
import { useLocation } from 'react-router-dom';
5-
import getConfig from '../../utils/getConfig';
5+
import { showReduxDevTools } from '../../store';
66
import DevTools from './components/DevTools';
77
import { setPreviousPath } from '../IDE/actions/ide';
88
import { setLanguage } from '../IDE/actions/preferences';
@@ -52,9 +52,7 @@ const App = ({ children }) => {
5252
return (
5353
<div className="app">
5454
<CookieConsent hide={hide} />
55-
{isMounted &&
56-
!window.devToolsExtension &&
57-
getConfig('NODE_ENV') === 'development' && <DevTools />}
55+
{isMounted && showReduxDevTools() && <DevTools />}
5856
{children}
5957
</div>
6058
);

client/modules/IDE/components/PreviewFrame.jsx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Frame = styled.iframe`
1111
border-width: 0;
1212
`;
1313

14-
function PreviewFrame({ fullView }) {
14+
function PreviewFrame({ fullView, isOverlayVisible }) {
1515
const iframe = useRef();
1616
const previewUrl = getConfig('PREVIEW_URL');
1717
useEffect(() => {
@@ -28,28 +28,36 @@ function PreviewFrame({ fullView }) {
2828
hid; microphone; magnetometer; midi; payment; usb; serial; vr; xr-spatial-tracking`;
2929

3030
return (
31-
<Frame
32-
title="sketch preview"
33-
src={frameUrl}
34-
sandbox={sandboxAttributes}
35-
allow={allow}
36-
scrolling="auto"
37-
allowtransparency
38-
allowpaymentrequest
39-
allowFullScreen
40-
frameBorder="0"
41-
ref={iframe}
42-
fullView={fullView}
43-
/>
31+
<>
32+
<div
33+
className="preview-frame-overlay"
34+
style={{ display: isOverlayVisible ? 'block' : 'none' }}
35+
/>
36+
<Frame
37+
title="sketch preview"
38+
src={frameUrl}
39+
sandbox={sandboxAttributes}
40+
allow={allow}
41+
scrolling="auto"
42+
allowtransparency
43+
allowpaymentrequest
44+
allowFullScreen
45+
frameBorder="0"
46+
ref={iframe}
47+
fullView={fullView}
48+
/>
49+
</>
4450
);
4551
}
4652

4753
PreviewFrame.propTypes = {
48-
fullView: PropTypes.bool
54+
fullView: PropTypes.bool,
55+
isOverlayVisible: PropTypes.bool
4956
};
5057

5158
PreviewFrame.defaultProps = {
52-
fullView: false
59+
fullView: false,
60+
isOverlayVisible: false
5361
};
5462

5563
export default PreviewFrame;

client/modules/IDE/pages/IDEView.jsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ const IDEView = () => {
173173
primary="second"
174174
size={ide.consoleIsExpanded ? consoleSize : 29}
175175
minSize={29}
176-
onChange={(size) => setConsoleSize(size)}
176+
onChange={(size) => {
177+
setConsoleSize(size);
178+
}}
177179
allowResize={ide.consoleIsExpanded}
178180
className="editor-preview-subpanel"
179181
>
@@ -191,16 +193,10 @@ const IDEView = () => {
191193
</h2>
192194
</header>
193195
<div className="preview-frame__content">
194-
<div
195-
className="preview-frame-overlay"
196-
style={{ display: isOverlayVisible ? 'block' : 'none' }}
196+
<PreviewFrame
197+
cmController={cmRef.current}
198+
isOverlayVisible={isOverlayVisible}
197199
/>
198-
<div>
199-
{((preferences.textOutput || preferences.gridOutput) &&
200-
ide.isPlaying) ||
201-
ide.isAccessibleOutputPlaying}
202-
</div>
203-
<PreviewFrame cmController={cmRef.current} />
204200
</div>
205201
</section>
206202
</SplitPane>
@@ -215,11 +211,18 @@ const IDEView = () => {
215211
split="horizontal"
216212
primary="second"
217213
minSize={200}
214+
onChange={() => {
215+
setIsOverlayVisible(true);
216+
}}
217+
onDragFinished={() => {
218+
setIsOverlayVisible(false);
219+
}}
218220
>
219221
<PreviewFrame
220222
fullView
221223
hide={!ide.isPlaying}
222224
cmController={cmRef.current}
225+
isOverlayVisible={isOverlayVisible}
223226
/>
224227
<Console />
225228
</SplitPane>

client/modules/IDE/selectors/collections.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createSelector } from 'reselect';
1+
import { createSelector } from '@reduxjs/toolkit';
22
import differenceInMilliseconds from 'date-fns/differenceInMilliseconds';
33
import { find, orderBy } from 'lodash';
44
import { DIRECTION } from '../actions/sorting';

client/modules/IDE/selectors/files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createSelector } from 'reselect';
1+
import { createSelector } from '@reduxjs/toolkit';
22

33
const selectFiles = (state) => state.files;
44

client/modules/IDE/selectors/project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createSelector } from 'reselect';
1+
import { createSelector } from '@reduxjs/toolkit';
22

33
export const selectProjectOwner = (state) => state.project.owner;
44
export const selectProjectId = (state) => state.project.id;

client/modules/IDE/selectors/projects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createSelector } from 'reselect';
1+
import { createSelector } from '@reduxjs/toolkit';
22
import differenceInMilliseconds from 'date-fns/differenceInMilliseconds';
33
import { orderBy } from 'lodash';
44
import { DIRECTION } from '../actions/sorting';

client/modules/IDE/selectors/users.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createSelector } from 'reselect';
1+
import { createSelector } from '@reduxjs/toolkit';
22
import getConfig from '../../../utils/getConfig';
33

44
export const getAuthenticated = (state) => state.user.authenticated;

client/modules/User/pages/SignupView.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { Link } from 'react-router-dom';
33
import { Helmet } from 'react-helmet';
4-
import { useTranslation } from 'react-i18next';
4+
import { useTranslation, Trans } from 'react-i18next';
55
import SignupForm from '../components/SignupForm';
66
import SocialAuthButton from '../components/SocialAuthButton';
77
import Nav from '../../IDE/components/Header/Nav';
@@ -27,9 +27,13 @@ function SignupView() {
2727
<SocialAuthButton service={SocialAuthButton.services.google} />
2828
</div>
2929
<p className="form__navigation-options">
30-
By signing up, you agree to the p5.js Editor&apos;s{' '}
31-
<Link to="/terms-of-use">Terms of Use</Link> and{' '}
32-
<Link to="/privacy-policy">Privacy Policy</Link>.
30+
<Trans
31+
i18nKey="SignupView.Warning"
32+
components={[
33+
<Link to="/terms-of-use">Terms of use</Link>,
34+
<Link to="/privacy-policy">Privacy Policy</Link>
35+
]}
36+
/>
3337
</p>
3438
<p className="form__navigation-options">
3539
{t('SignupView.AlreadyHave')}{' '}

client/store.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
1-
import { createStore, applyMiddleware, compose } from 'redux';
2-
import thunk from 'redux-thunk';
1+
import { configureStore } from '@reduxjs/toolkit';
2+
import listenerMiddleware from './middleware';
33
import DevTools from './modules/App/components/DevTools';
44
import rootReducer from './reducers';
55
import { clearState, loadState } from './persistState';
66
import getConfig from './utils/getConfig';
77

8-
export default function configureStore(initialState) {
9-
const enhancers = [applyMiddleware(thunk)];
10-
11-
if (getConfig('CLIENT') && getConfig('NODE_ENV') === 'development') {
12-
// Enable DevTools only when rendering on client and during development.
13-
enhancers.push(
14-
window.devToolsExtension
15-
? window.devToolsExtension()
16-
: DevTools.instrument()
17-
);
18-
}
8+
// Enable DevTools only when rendering on client and during development.
9+
// Display the dock monitor only if no browser extension is found.
10+
export function showReduxDevTools() {
11+
return (
12+
getConfig('CLIENT') &&
13+
getConfig('NODE_ENV') === 'development' &&
14+
!window.__REDUX_DEVTOOLS_EXTENSION__
15+
);
16+
}
1917

18+
export default function setupStore(initialState) {
2019
const savedState = loadState();
2120
clearState();
2221

23-
const store = createStore(
24-
rootReducer,
25-
savedState != null ? savedState : initialState,
26-
compose(...enhancers)
27-
);
22+
const store = configureStore({
23+
reducer: rootReducer,
24+
middleware: (getDefaultMiddleware) =>
25+
getDefaultMiddleware({
26+
thunk: true,
27+
serializableCheck: true,
28+
// TODO: enable immutableCheck once the mutations are fixed.
29+
immutableCheck: false
30+
}).concat(listenerMiddleware.middleware),
31+
preloadedState: savedState || initialState,
32+
enhancers: showReduxDevTools() ? [DevTools.instrument()] : []
33+
});
2834

2935
if (module.hot) {
3036
// Enable Webpack hot module replacement for reducers

client/styles/components/_toolbar.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,6 @@
144144
.checkbox__autorefresh{
145145
cursor: pointer;
146146
@include themify(){
147-
color:getThemifyVariable('logo-color');
147+
accent-color:getThemifyVariable('logo-color');
148148
}
149149
}

0 commit comments

Comments
 (0)