forked from weaveworks/weave-gitops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
61 lines (59 loc) · 2.03 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
import { MuiThemeProvider } from "@material-ui/core";
import qs from "query-string";
import * as React from "react";
import {
BrowserRouter as Router,
Redirect,
Route,
Switch,
} from "react-router-dom";
import { ToastContainer } from "react-toastify";
import { ThemeProvider } from "styled-components";
import ErrorBoundary from "./components/ErrorBoundary";
import Layout from "./components/Layout";
import AppContextProvider from "./contexts/AppContext";
import { Applications as appsClient } from "./lib/api/applications/applications.pb";
import theme, { GlobalStyle, muiTheme } from "./lib/theme";
import { PageRoute } from "./lib/types";
import ApplicationDetail from "./pages/ApplicationDetail";
import Applications from "./pages/Applications";
import Error from "./pages/Error";
export default function App() {
return (
<MuiThemeProvider theme={muiTheme}>
<ThemeProvider theme={theme}>
<GlobalStyle />
<Router>
<AppContextProvider applicationsClient={appsClient}>
<Layout>
<ErrorBoundary>
<Switch>
<Route
exact
path={PageRoute.Applications}
component={Applications}
/>
<Route
exact
path={PageRoute.ApplicationDetail}
component={({ location }) => {
const params = qs.parse(location.search);
return <ApplicationDetail name={params.name as string} />;
}}
/>
<Redirect exact from="/" to={PageRoute.Applications} />
<Route exact path="*" component={Error} />
</Switch>
</ErrorBoundary>
<ToastContainer
position="top-center"
autoClose={10000}
newestOnTop={false}
/>
</Layout>
</AppContextProvider>
</Router>
</ThemeProvider>
</MuiThemeProvider>
);
}