-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
60 lines (57 loc) · 2 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import 'bootstrap/dist/css/bootstrap.min.css';
import React from 'react';
import { Navigation } from './ui/other-components/menu/Navigation';
import { InjectionContext } from './di/injector-context';
import { container } from './di/config/brandi-config';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import { EditorViewComponent } from './ui/other-components/views/EditorViewComponent';
import { WizardViewComponent } from './ui/other-components/views/WizardViewComponent';
import { ResourcesEditorViewComponent } from './ui/other-components/views/ResourcesEditorViewComponent';
import { CommandListViewComponent } from './ui/other-components/views/CommandListViewComponent';
import {
COMMAND_LIST_PATH,
ELEMENT_EDITOR_PATH,
PREFERENCES_PATH,
RESOURCE_EDITOR_PATH,
WIZARD_PATH,
} from './core/common/consts';
import { PreferencesComponent } from './ui/other-components/menu/preferences/PreferencesComponent';
const App: React.FC<{}> = () => {
const getPath = (path: string): string => {
if (path.startsWith('/')) {
path = path.slice(1);
}
return `${path}/*`;
};
return (
<InjectionContext.Provider value={container}>
<BrowserRouter>
<Navigation />
<Routes>
<Route
path={getPath(COMMAND_LIST_PATH)}
element={<CommandListViewComponent />}
/>
<Route
path={getPath(ELEMENT_EDITOR_PATH)}
element={<EditorViewComponent />}
/>
<Route
path={getPath(PREFERENCES_PATH)}
element={<PreferencesComponent />}
/>
<Route
path={getPath(RESOURCE_EDITOR_PATH)}
element={<ResourcesEditorViewComponent />}
/>
<Route
path={getPath(WIZARD_PATH)}
element={<WizardViewComponent />}
/>
<Route path="*" element={<Navigate to={WIZARD_PATH} replace />} />
</Routes>
</BrowserRouter>
</InjectionContext.Provider>
);
};
export default App;