Skip to content

Commit d14189f

Browse files
committed
Merge branch 'release-2.19.4' into release
2 parents 33d0d39 + 245b966 commit d14189f

27 files changed

Lines changed: 4236 additions & 1702 deletions

client/common/Button.stories.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { action } from '@storybook/addon-actions';
33

4-
import { Button, ButtonDisplays, ButtonKinds, ButtonTypes } from './Button';
4+
import { Button, ButtonDisplays, ButtonTypes } from './Button';
55
import { GithubIcon, DropdownArrowIcon, PlusIcon } from './icons';
66

77
export default {

client/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { useTranslation } from 'react-i18next';
77
import browserHistory from './browserHistory';
88
import { setupStore } from './store';
99
import Routing from './routes';
10-
import ThemeProvider from './modules/App/components/ThemeProvider';
11-
import Loader from './modules/App/components/loader';
10+
import { ThemeProvider } from './modules/App/components/ThemeProvider';
11+
import { Loader } from './modules/App/components/Loader';
1212
import './i18n';
1313
import { SkipLink } from './components/SkipLink';
1414

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
1-
import PropTypes from 'prop-types';
21
import React, { useEffect, useRef, useState } from 'react';
32
import { useDispatch, useSelector } from 'react-redux';
43
import { useLocation } from 'react-router-dom';
54
import { showReduxDevTools } from '../../store';
6-
import DevTools from './components/DevTools';
5+
import { DevTools } from './components/DevTools';
76
import { setPreviousPath } from '../IDE/actions/ide';
87
import { setLanguage } from '../IDE/actions/preferences';
98
import { CookieConsent } from '../User/components/CookieConsent';
9+
import type { RootState } from '../../reducers';
1010

11-
function hideCookieConsent(pathname) {
11+
function hideCookieConsent(pathname: string) {
1212
if (pathname.includes('/full/') || pathname.includes('/embed/')) {
1313
return true;
1414
}
1515
return false;
1616
}
1717

18-
const App = ({ children }) => {
18+
export const App = ({ children }: { children?: React.ReactNode }) => {
1919
const dispatch = useDispatch();
2020

21-
const location = useLocation();
21+
const location = useLocation<{ skipSavingPath?: boolean }>();
2222

23-
const theme = useSelector((state) => state.preferences.theme);
23+
const theme = useSelector((state: RootState) => state.preferences.theme);
2424
useEffect(() => {
2525
document.body.className = theme;
2626
}, [theme]);
2727

2828
// TODO: this is only needed for the initial load and would be better handled elsewhere - Linda
29-
const language = useSelector((state) => state.preferences.language);
29+
const language = useSelector(
30+
(state: RootState) => state.preferences.language
31+
);
3032
useEffect(() => {
3133
dispatch(setLanguage(language, { persistPreference: false }));
3234
}, [language]);
3335

34-
// TODO: do we actually need this? - Linda
35-
const [isMounted, setIsMounted] = useState(false);
36-
useEffect(() => setIsMounted(true), []);
37-
3836
const previousLocationRef = useRef(location);
3937
useEffect(() => {
4038
const prevLocation = previousLocationRef.current;
@@ -52,18 +50,8 @@ const App = ({ children }) => {
5250
return (
5351
<div className="app">
5452
<CookieConsent hide={hide} />
55-
{isMounted && showReduxDevTools() && <DevTools />}
53+
{showReduxDevTools() && <DevTools />}
5654
{children}
5755
</div>
5856
);
5957
};
60-
61-
App.propTypes = {
62-
children: PropTypes.element
63-
};
64-
65-
App.defaultProps = {
66-
children: null
67-
};
68-
69-
export default App;

client/modules/App/components/DevTools.jsx renamed to client/modules/App/components/DevTools.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ const devTools = (
99
</DockMonitor>
1010
);
1111

12-
export default createDevTools(devTools);
12+
export const DevTools = createDevTools(devTools);
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ const LoaderCircle = styled.div`
4444
}
4545
`;
4646

47-
const Loader = () => (
47+
export const Loader = () => (
4848
<Container>
4949
<LoaderWrapper>
5050
<LoaderCircle />
5151
<LoaderCircle />
5252
</LoaderWrapper>
5353
</Container>
5454
);
55-
export default Loader;
Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,37 @@
1-
import PropTypes from 'prop-types';
21
import React, { useCallback, useRef } from 'react';
32
import MediaQuery from 'react-responsive';
43
import { useSelector } from 'react-redux';
54
import { useHistory } from 'react-router-dom';
65
import { useTranslation } from 'react-i18next';
76
import { useModalClose } from '../../../common/useModalClose';
7+
import type { RootState } from '../../../reducers';
88

99
import ExitIcon from '../../../images/exit.svg';
1010

11-
const Overlay = ({
11+
type OverlayProps = {
12+
children?: React.ReactElement;
13+
actions?: React.ReactElement;
14+
closeOverlay?: () => void;
15+
title?: string;
16+
ariaLabel?: string;
17+
isFixedHeight?: boolean;
18+
};
19+
20+
export const Overlay = ({
1221
actions,
13-
ariaLabel,
22+
ariaLabel = 'modal',
1423
children,
1524
closeOverlay,
16-
isFixedHeight,
17-
title
18-
}) => {
25+
isFixedHeight = false,
26+
title = 'Modal'
27+
}: OverlayProps) => {
1928
const { t } = useTranslation();
2029

21-
const previousPath = useSelector((state) => state.ide.previousPath);
30+
const previousPath = useSelector(
31+
(state: RootState) => state.ide.previousPath
32+
);
2233

23-
const ref = useRef(null);
34+
const ref = useRef<HTMLElement>(null);
2435

2536
const browserHistory = useHistory();
2637

@@ -29,7 +40,7 @@ const Overlay = ({
2940
if (!node) return;
3041
// Only close if it is the last (and therefore the topmost overlay)
3142
const overlays = document.getElementsByClassName('overlay');
32-
if (node.parentElement.parentElement !== overlays[overlays.length - 1])
43+
if (node.parentElement?.parentElement !== overlays[overlays.length - 1])
3344
return;
3445

3546
if (!closeOverlay) {
@@ -76,23 +87,3 @@ const Overlay = ({
7687
</div>
7788
);
7889
};
79-
80-
Overlay.propTypes = {
81-
children: PropTypes.element,
82-
actions: PropTypes.element,
83-
closeOverlay: PropTypes.func,
84-
title: PropTypes.string,
85-
ariaLabel: PropTypes.string,
86-
isFixedHeight: PropTypes.bool
87-
};
88-
89-
Overlay.defaultProps = {
90-
children: null,
91-
actions: null,
92-
title: 'Modal',
93-
closeOverlay: null,
94-
ariaLabel: 'modal',
95-
isFixedHeight: false
96-
};
97-
98-
export default Overlay;

client/modules/App/components/ThemeProvider.jsx

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react';
2+
import { useSelector } from 'react-redux';
3+
import { ThemeProvider as TProvider } from 'styled-components';
4+
import theme from '../../../theme';
5+
import type { RootState } from '../../../reducers';
6+
7+
export const ThemeProvider = ({ children }: { children: React.ReactNode }) => {
8+
const currentTheme = useSelector(
9+
(state: RootState) => state.preferences.theme
10+
);
11+
return <TProvider theme={{ ...theme[currentTheme] }}>{children}</TProvider>;
12+
};

client/modules/IDE/components/AddToCollectionList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Helmet } from 'react-helmet';
44
import { useTranslation } from 'react-i18next';
55
import { useDispatch, useSelector } from 'react-redux';
66
import styled from 'styled-components';
7-
import Loader from '../../App/components/loader';
7+
import { Loader } from '../../App/components/Loader';
88
import {
99
addToCollection,
1010
getCollections,

client/modules/IDE/components/AddToCollectionSketchList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
66
import { addToCollection, removeFromCollection } from '../actions/collections';
77
import { getProjects } from '../actions/projects';
88
import getSortedSketches from '../selectors/projects';
9-
import Loader from '../../App/components/loader';
9+
import { Loader } from '../../App/components/Loader';
1010
import QuickAddList from './QuickAddList';
1111
import {
1212
CollectionAddSketchWrapper,

0 commit comments

Comments
 (0)