Merged PR 170: Add new eslint rules
- naming-convention - prefer-arrow-callback - func-style - import/no-default-export
This commit is contained in:
parent
3f58c5ba5e
commit
ad126c6c28
65 changed files with 781 additions and 784 deletions
|
@ -1,8 +1,8 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import React, { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
||||
import './App.scss';
|
||||
import { MainMenu } from '../MainMenu/MainMenu';
|
||||
import { ContainerModel } from '../../Interfaces/IContainerModel';
|
||||
import Editor from '../Editor/Editor';
|
||||
import { Editor } from '../Editor/Editor';
|
||||
import { IEditorState } from '../../Interfaces/IEditorState';
|
||||
import { LoadState } from './Actions/Load';
|
||||
import { LoadEditor, NewEditor } from './Actions/MenuActions';
|
||||
|
@ -14,28 +14,11 @@ interface IAppProps {
|
|||
root: Element | Document
|
||||
}
|
||||
|
||||
export const App: React.FunctionComponent<IAppProps> = (props) => {
|
||||
const [isLoaded, setLoaded] = useState<boolean>(false);
|
||||
|
||||
const defaultMainContainer = new ContainerModel(
|
||||
null,
|
||||
DEFAULT_MAINCONTAINER_PROPS
|
||||
);
|
||||
|
||||
const [editorState, setEditorState] = useState<IEditorState>({
|
||||
configuration: DEFAULT_CONFIG,
|
||||
history: [{
|
||||
LastAction: '',
|
||||
MainContainer: defaultMainContainer,
|
||||
SelectedContainerId: defaultMainContainer.properties.id,
|
||||
TypeCounters: {},
|
||||
Symbols: new Map(),
|
||||
SelectedSymbolId: ''
|
||||
}],
|
||||
historyCurrentStep: 0
|
||||
});
|
||||
|
||||
// TODO: move this into a variable
|
||||
function UseHTTPGETStatePreloading(
|
||||
isLoaded: boolean,
|
||||
setEditorState: Dispatch<SetStateAction<IEditorState>>,
|
||||
setLoaded: Dispatch<SetStateAction<boolean>>
|
||||
): void {
|
||||
useEffect(() => {
|
||||
const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
|
@ -56,6 +39,30 @@ export const App: React.FunctionComponent<IAppProps> = (props) => {
|
|||
}, (error) => { throw new Error(error); });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export function App(props: IAppProps): JSX.Element {
|
||||
const [isLoaded, setLoaded] = useState<boolean>(false);
|
||||
|
||||
const defaultMainContainer = new ContainerModel(
|
||||
null,
|
||||
DEFAULT_MAINCONTAINER_PROPS
|
||||
);
|
||||
|
||||
const [editorState, setEditorState] = useState<IEditorState>({
|
||||
configuration: DEFAULT_CONFIG,
|
||||
history: [{
|
||||
lastAction: '',
|
||||
mainContainer: defaultMainContainer,
|
||||
selectedContainerId: defaultMainContainer.properties.id,
|
||||
typeCounters: {},
|
||||
symbols: new Map(),
|
||||
selectedSymbolId: ''
|
||||
}],
|
||||
historyCurrentStep: 0
|
||||
});
|
||||
|
||||
UseHTTPGETStatePreloading(isLoaded, setEditorState, setLoaded);
|
||||
|
||||
if (isLoaded) {
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue