1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/index.tsx
Roman 323a4c141e cluster-status -- part 2
Signed-off-by: Roman <ixrock@gmail.com>
2020-07-20 19:00:07 +03:00

51 lines
1.6 KiB
TypeScript

import "../common/system-ca"
import React from "react";
import { render } from "react-dom";
import { Route, Router, Switch } from "react-router";
import { observer } from "mobx-react";
import { userStore } from "../common/user-store";
import { workspaceStore } from "../common/workspace-store";
import { clusterStore } from "../common/cluster-store";
import { I18nProvider } from "@lingui/react";
import { browserHistory } from "./navigation";
import { isMac } from "../common/vars";
import { _i18n } from "./i18n";
import { ClusterManager } from "./components/cluster-manager";
import { ErrorBoundary } from "./components/error-boundary";
import { WhatsNew, whatsNewRoute } from "./components/+whats-new";
import { Preferences, preferencesRoute } from "./components/+preferences";
@observer
class LensApp extends React.Component {
static async init() {
await Promise.all([
userStore.load(),
workspaceStore.load(),
clusterStore.load(),
]);
const elem = document.getElementById("app");
elem.classList.toggle("is-mac", isMac);
render(<LensApp/>, elem);
}
render() {
return (
<I18nProvider i18n={_i18n}>
<Router history={browserHistory}>
<ErrorBoundary>
<Switch>
{userStore.isNewVersion && <Route component={WhatsNew}/>}
<Route component={WhatsNew} {...whatsNewRoute}/>
<Route component={Preferences} {...preferencesRoute}/>
<Route component={ClusterManager}/>
</Switch>
</ErrorBoundary>
</Router>
</I18nProvider>
)
}
}
// run
LensApp.init();