2019-12-03 09:21:06 +00:00
|
|
|
import React, { lazy, Suspense } from "react";
|
2020-01-14 09:47:45 +00:00
|
|
|
import { Helmet } from "react-helmet";
|
2019-03-16 11:33:15 +00:00
|
|
|
import ReactDOM from "react-dom";
|
|
|
|
|
import { Provider } from "react-redux";
|
2019-12-03 09:21:06 +00:00
|
|
|
import Loader from "pages/common/Loader";
|
2019-03-16 11:33:15 +00:00
|
|
|
import "./index.css";
|
|
|
|
|
import * as serviceWorker from "./serviceWorker";
|
2020-01-15 04:49:36 +00:00
|
|
|
import { Router, Route, Switch, Redirect } from "react-router-dom";
|
2019-10-25 05:35:20 +00:00
|
|
|
import history from "./utils/history";
|
2019-12-30 07:35:16 +00:00
|
|
|
import { ThemeProvider, theme } from "constants/DefaultTheme";
|
2019-09-09 10:30:22 +00:00
|
|
|
import { DndProvider } from "react-dnd";
|
2019-10-09 09:08:55 +00:00
|
|
|
import HTML5Backend from "react-dnd-html5-backend";
|
2019-12-30 07:35:16 +00:00
|
|
|
import { appInitializer } from "utils/AppsmithUtils";
|
2019-09-10 11:01:48 +00:00
|
|
|
import ProtectedRoute from "./pages/common/ProtectedRoute";
|
2019-12-23 12:16:33 +00:00
|
|
|
import store from "./store";
|
2019-10-31 08:36:04 +00:00
|
|
|
import {
|
|
|
|
|
BASE_URL,
|
|
|
|
|
BUILDER_URL,
|
|
|
|
|
APP_VIEW_URL,
|
2019-11-07 04:59:40 +00:00
|
|
|
APPLICATIONS_URL,
|
2019-12-23 12:16:33 +00:00
|
|
|
ORG_URL,
|
2019-12-16 08:49:10 +00:00
|
|
|
USER_AUTH_URL,
|
2020-01-15 04:49:36 +00:00
|
|
|
AUTH_LOGIN_URL,
|
|
|
|
|
SIGN_UP_URL,
|
|
|
|
|
BASE_LOGIN_URL,
|
|
|
|
|
BASE_SIGNUP_URL,
|
2019-12-30 07:35:16 +00:00
|
|
|
} from "constants/routes";
|
2019-12-03 09:21:06 +00:00
|
|
|
|
|
|
|
|
const loadingIndicator = <Loader />;
|
|
|
|
|
const App = lazy(() => import("./App"));
|
2019-12-16 08:49:10 +00:00
|
|
|
const UserAuth = lazy(() => import("./pages/UserAuth"));
|
2019-12-03 09:21:06 +00:00
|
|
|
const Editor = lazy(() => import("./pages/Editor"));
|
|
|
|
|
const Applications = lazy(() => import("./pages/Applications"));
|
|
|
|
|
const PageNotFound = lazy(() => import("./pages/common/PageNotFound"));
|
|
|
|
|
const AppViewer = lazy(() => import("./pages/AppViewer"));
|
2019-12-23 12:16:33 +00:00
|
|
|
const Organization = lazy(() => import("./pages/organization"));
|
2019-09-05 17:47:50 +00:00
|
|
|
|
2019-09-02 15:36:24 +00:00
|
|
|
appInitializer();
|
2019-11-21 10:52:49 +00:00
|
|
|
|
2019-02-07 05:07:09 +00:00
|
|
|
ReactDOM.render(
|
2019-10-09 09:08:55 +00:00
|
|
|
<DndProvider backend={HTML5Backend}>
|
2019-08-26 12:41:21 +00:00
|
|
|
<Provider store={store}>
|
|
|
|
|
<ThemeProvider theme={theme}>
|
2020-01-14 09:47:45 +00:00
|
|
|
<Helmet>
|
|
|
|
|
<meta charSet="utf-8" />
|
|
|
|
|
<link rel="shortcut icon" href="/favicon-orange.ico" />
|
|
|
|
|
</Helmet>
|
2019-10-25 05:35:20 +00:00
|
|
|
<Router history={history}>
|
2019-12-03 09:21:06 +00:00
|
|
|
<Suspense fallback={loadingIndicator}>
|
|
|
|
|
<Switch>
|
2019-12-23 12:16:33 +00:00
|
|
|
<ProtectedRoute exact path={BASE_URL} component={App} />
|
|
|
|
|
<ProtectedRoute path={ORG_URL} component={Organization} />
|
2019-12-16 08:49:10 +00:00
|
|
|
<Route path={USER_AUTH_URL} component={UserAuth} />
|
2020-01-15 04:49:36 +00:00
|
|
|
<Redirect exact from={BASE_LOGIN_URL} to={AUTH_LOGIN_URL} />
|
|
|
|
|
<Redirect exact from={BASE_SIGNUP_URL} to={SIGN_UP_URL} />
|
2019-12-03 09:21:06 +00:00
|
|
|
<ProtectedRoute
|
|
|
|
|
exact
|
|
|
|
|
path={APPLICATIONS_URL}
|
|
|
|
|
component={Applications}
|
|
|
|
|
/>
|
2019-12-23 12:16:33 +00:00
|
|
|
<ProtectedRoute path={BUILDER_URL} component={Editor} />
|
|
|
|
|
<ProtectedRoute path={APP_VIEW_URL} component={AppViewer} />
|
2019-12-03 09:21:06 +00:00
|
|
|
<Route component={PageNotFound} />
|
|
|
|
|
</Switch>
|
|
|
|
|
</Suspense>
|
2019-10-25 05:35:20 +00:00
|
|
|
</Router>
|
2019-08-26 12:41:21 +00:00
|
|
|
</ThemeProvider>
|
|
|
|
|
</Provider>
|
|
|
|
|
</DndProvider>,
|
2019-09-09 10:30:22 +00:00
|
|
|
document.getElementById("root"),
|
2019-03-16 11:33:15 +00:00
|
|
|
);
|
2019-01-21 15:11:10 +00:00
|
|
|
|
|
|
|
|
// If you want your app to work offline and load faster, you can change
|
|
|
|
|
// unregister() to register() below. Note this comes with some pitfalls.
|
|
|
|
|
// Learn more about service workers: http://bit.ly/CRA-PWA
|
2019-03-16 11:33:15 +00:00
|
|
|
serviceWorker.unregister();
|