Skip to content

Commit 268144a

Browse files
authored
Merge branch 'develop' into open-image
2 parents 9e23cbd + 81eb18c commit 268144a

Some content is hidden

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

62 files changed

+3095
-627
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ jobs:
77
name: Test and lint code base
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
- name: Use Node.js
12-
uses: actions/setup-node@v1
13-
with:
14-
node-version: '18.20.x'
15-
- run: npm install
16-
- run: npm run test
17-
- run: npm run lint
18-
19-
10+
- uses: actions/checkout@v2
11+
- name: Use Node.js
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: '18.20.x'
15+
- run: npm install
16+
- run: npm run test
17+
- run: npm run typecheck
18+
- run: npm run lint

.storybook/preview.js

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

5-
import configureStore from '../client/store';
5+
import { setupStore } from '../client/store';
66
import '../client/i18n-test';
7-
import '../client/styles/storybook.css'
7+
import '../client/styles/storybook.css';
88
import { withThemeProvider, themeToolbarItem } from './decorator-theme';
99

1010
const initialState = window.__INITIAL_STATE__;
1111

12-
const store = configureStore(initialState);
12+
const store = setupStore(initialState);
1313

1414
export const decorators = [
1515
(Story) => (

client/custom.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,18 @@ declare module '*.svg' {
44
const ReactComponent: React.FunctionComponent<
55
React.SVGProps<SVGSVGElement> & { title?: string }
66
>;
7+
// eslint-disable-next-line import/no-default-export
78
export default ReactComponent;
89
}
10+
11+
// Extend window for Redux DevTools
12+
interface Window {
13+
__REDUX_DEVTOOLS_EXTENSION__?: () => any;
14+
}
15+
16+
// Extend NodeModule for hot reloading
17+
interface NodeModule {
18+
hot?: {
19+
accept(path?: string, callback?: () => void): void;
20+
};
21+
}

client/index.integration.test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import React from 'react';
44
import Routing from './routes';
55

66
import { reduxRender, act, waitFor, screen, within } from './test-utils';
7-
import configureStore from './store';
7+
import { setupStore } from './store';
88
import * as Actions from './modules/User/actions';
99
import { userResponse } from './testData/testServerResponses';
1010

1111
// setup for the app
1212
const initialState = window.__INITIAL_STATE__;
13-
const store = configureStore(initialState);
13+
const store = setupStore(initialState);
1414

1515
// need to mock this file or it'll throw ERRCONNECTED
1616
jest.mock('./i18n');

client/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Router } from 'react-router-dom';
55

66
import { useTranslation } from 'react-i18next';
77
import browserHistory from './browserHistory';
8-
import configureStore from './store';
8+
import { setupStore } from './store';
99
import Routing from './routes';
1010
import ThemeProvider from './modules/App/components/ThemeProvider';
1111
import Loader from './modules/App/components/loader';
@@ -19,7 +19,7 @@ require('./images/p5js-square-logo.png');
1919

2020
const initialState = window.__INITIAL_STATE__;
2121

22-
const store = configureStore(initialState);
22+
const store = setupStore(initialState);
2323

2424
const DONATE_LOGO_IMAGE_URL = 'https://donorbox.org/images/white_logo.svg';
2525

client/modules/About/pages/About.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const About = () => {
9595
))}
9696

9797
<Contact>
98-
<h2>{t('Contact')}</h2>
98+
<h2>{t('About.Contact')}</h2>
9999
<div>
100100
<ContactTitle>{t('About.Email')}</ContactTitle>
101101
<ContactHandles>

client/modules/IDE/actions/preferences.js renamed to client/modules/IDE/actions/preferences.ts

Lines changed: 55 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
11
import i18next from 'i18next';
2+
import { UpdatePreferencesRequestBody } from '../../../../common/types';
23
import { apiClient } from '../../../utils/apiClient';
34
import * as ActionTypes from '../../../constants';
5+
import type {
6+
UpdatePreferencesDispatch,
7+
SetPreferencesTabValue,
8+
SetFontSizeValue,
9+
GetRootState,
10+
SetLineNumbersValue,
11+
SetAutocloseBracketsQuotesValue,
12+
SetAutocompleteHinterValue,
13+
SetAutosaveValue,
14+
SetLinewrapValue,
15+
SetLintWarningValue,
16+
SetTextOutputValue,
17+
SetAllAccessibleOutputValue,
18+
SetAutorefreshValue,
19+
SetGridOutputValue,
20+
SetLanguageValue,
21+
SetThemeValue
22+
} from './preferences.types';
423

5-
function updatePreferences(formParams, dispatch) {
24+
function updatePreferences(
25+
formParams: UpdatePreferencesRequestBody,
26+
dispatch: UpdatePreferencesDispatch
27+
) {
628
apiClient
729
.put('/preferences', formParams)
830
.then(() => {})
@@ -14,15 +36,15 @@ function updatePreferences(formParams, dispatch) {
1436
});
1537
}
1638

17-
export function setPreferencesTab(value) {
39+
export function setPreferencesTab(value: SetPreferencesTabValue) {
1840
return {
1941
type: ActionTypes.SET_PREFERENCES_TAB,
2042
value
2143
};
2244
}
2345

24-
export function setFontSize(value) {
25-
return (dispatch, getState) => {
46+
export function setFontSize(value: SetFontSizeValue) {
47+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
2648
// eslint-disable-line
2749
dispatch({
2850
type: ActionTypes.SET_FONT_SIZE,
@@ -40,8 +62,8 @@ export function setFontSize(value) {
4062
};
4163
}
4264

43-
export function setLineNumbers(value) {
44-
return (dispatch, getState) => {
65+
export function setLineNumbers(value: SetLineNumbersValue) {
66+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
4567
dispatch({
4668
type: ActionTypes.SET_LINE_NUMBERS,
4769
value
@@ -58,8 +80,10 @@ export function setLineNumbers(value) {
5880
};
5981
}
6082

61-
export function setAutocloseBracketsQuotes(value) {
62-
return (dispatch, getState) => {
83+
export function setAutocloseBracketsQuotes(
84+
value: SetAutocloseBracketsQuotesValue
85+
) {
86+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
6387
dispatch({
6488
type: ActionTypes.SET_AUTOCLOSE_BRACKETS_QUOTES,
6589
value
@@ -76,8 +100,8 @@ export function setAutocloseBracketsQuotes(value) {
76100
};
77101
}
78102

79-
export function setAutocompleteHinter(value) {
80-
return (dispatch, getState) => {
103+
export function setAutocompleteHinter(value: SetAutocompleteHinterValue) {
104+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
81105
dispatch({
82106
type: ActionTypes.SET_AUTOCOMPLETE_HINTER,
83107
value
@@ -94,8 +118,8 @@ export function setAutocompleteHinter(value) {
94118
};
95119
}
96120

97-
export function setAutosave(value) {
98-
return (dispatch, getState) => {
121+
export function setAutosave(value: SetAutosaveValue) {
122+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
99123
dispatch({
100124
type: ActionTypes.SET_AUTOSAVE,
101125
value
@@ -112,8 +136,8 @@ export function setAutosave(value) {
112136
};
113137
}
114138

115-
export function setLinewrap(value) {
116-
return (dispatch, getState) => {
139+
export function setLinewrap(value: SetLinewrapValue) {
140+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
117141
dispatch({
118142
type: ActionTypes.SET_LINEWRAP,
119143
value
@@ -130,8 +154,8 @@ export function setLinewrap(value) {
130154
};
131155
}
132156

133-
export function setLintWarning(value) {
134-
return (dispatch, getState) => {
157+
export function setLintWarning(value: SetLintWarningValue) {
158+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
135159
dispatch({
136160
type: ActionTypes.SET_LINT_WARNING,
137161
value
@@ -148,8 +172,8 @@ export function setLintWarning(value) {
148172
};
149173
}
150174

151-
export function setTextOutput(value) {
152-
return (dispatch, getState) => {
175+
export function setTextOutput(value: SetTextOutputValue) {
176+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
153177
dispatch({
154178
type: ActionTypes.SET_TEXT_OUTPUT,
155179
value
@@ -166,8 +190,8 @@ export function setTextOutput(value) {
166190
};
167191
}
168192

169-
export function setGridOutput(value) {
170-
return (dispatch, getState) => {
193+
export function setGridOutput(value: SetGridOutputValue) {
194+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
171195
dispatch({
172196
type: ActionTypes.SET_GRID_OUTPUT,
173197
value
@@ -184,12 +208,8 @@ export function setGridOutput(value) {
184208
};
185209
}
186210

187-
export function setTheme(value) {
188-
// return {
189-
// type: ActionTypes.SET_THEME,
190-
// value
191-
// };
192-
return (dispatch, getState) => {
211+
export function setTheme(value: SetThemeValue) {
212+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
193213
dispatch({
194214
type: ActionTypes.SET_THEME,
195215
value
@@ -206,12 +226,8 @@ export function setTheme(value) {
206226
};
207227
}
208228

209-
export function setAutorefresh(value) {
210-
// return {
211-
// type: ActionTypes.SET_AUTOREFRESH,
212-
// value
213-
// };
214-
return (dispatch, getState) => {
229+
export function setAutorefresh(value: SetAutorefreshValue) {
230+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
215231
dispatch({
216232
type: ActionTypes.SET_AUTOREFRESH,
217233
value
@@ -228,15 +244,18 @@ export function setAutorefresh(value) {
228244
};
229245
}
230246

231-
export function setAllAccessibleOutput(value) {
232-
return (dispatch) => {
247+
export function setAllAccessibleOutput(value: SetAllAccessibleOutputValue) {
248+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
233249
dispatch(setTextOutput(value));
234250
dispatch(setGridOutput(value));
235251
};
236252
}
237253

238-
export function setLanguage(value, { persistPreference = true } = {}) {
239-
return (dispatch, getState) => {
254+
export function setLanguage(
255+
value: SetLanguageValue,
256+
{ persistPreference = true } = {}
257+
) {
258+
return (dispatch: UpdatePreferencesDispatch, getState: GetRootState) => {
240259
i18next.changeLanguage(value);
241260
dispatch({
242261
type: ActionTypes.SET_LANGUAGE,

0 commit comments

Comments
 (0)