-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathApp.tsx
71 lines (67 loc) · 2.38 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
61
62
63
64
65
66
67
68
69
70
71
/*
* Copyright The OpenZipkin Authors
* SPDX-License-Identifier: Apache-2.0
*/
import MomentUtils from '@date-io/moment';
import {
CircularProgress,
ThemeProvider as MuiThemeProvider,
} from '@material-ui/core';
import { MuiPickersUtilsProvider } from '@material-ui/pickers';
import React, { Suspense, useMemo } from 'react';
import { Provider } from 'react-redux';
import { BrowserRouter, Route } from 'react-router-dom';
import { useTitle } from 'react-use';
import { ThemeProvider } from 'styled-components';
import Layout from './Layout';
import DependenciesPage from '../DependenciesPage';
import DiscoverPage from '../DiscoverPage';
import TracePage from '../TracePage';
import { UiConfig, UiConfigConsumer } from '../UiConfig';
import configureStore from '../../store/configure-store';
import { theme } from '../../constants/color';
import AlertSnackbar from './AlertSnackbar';
import { BASE_PATH } from '../../constants/api';
const App: React.FC = () => {
useTitle('Zipkin');
const baseName = useMemo(() => {
return import.meta.env.DEV ? '/zipkin' : BASE_PATH;
}, []);
return (
<Suspense fallback={<CircularProgress />}>
<UiConfig>
<MuiPickersUtilsProvider utils={MomentUtils}>
<ThemeProvider theme={theme}>
<MuiThemeProvider theme={theme}>
<UiConfigConsumer>
{(config) => (
<Provider store={configureStore(config)}>
<AlertSnackbar />
<BrowserRouter basename={baseName}>
<Layout>
<Route exact path="/" component={DiscoverPage} />
{config.dependency.enabled && (
<Route
exact
path="/dependency"
component={DependenciesPage}
/>
)}
<Route
exact
path={['/traces/:traceId', '/traceViewer']}
component={TracePage}
/>
</Layout>
</BrowserRouter>
</Provider>
)}
</UiConfigConsumer>
</MuiThemeProvider>
</ThemeProvider>
</MuiPickersUtilsProvider>
</UiConfig>
</Suspense>
);
};
export default App;