mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Roman <ixrock@gmail.com> Co-authored-by: Sebastian Malton <sebastian@malton.name> Co-authored-by: Sebastian Malton <smalton@mirantis.com> Co-authored-by: Lauri Nevala <lauri.nevala@gmail.com> Co-authored-by: Alex Andreev <alex.andreev.email@gmail.com>
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import "./components/app.scss"
|
|
import React from "react";
|
|
import { render } from "react-dom";
|
|
import { isMac } from "../common/vars";
|
|
import { userStore } from "../common/user-store";
|
|
import { workspaceStore } from "../common/workspace-store";
|
|
import { clusterStore, getHostedClusterId } from "../common/cluster-store";
|
|
import { i18nStore } from "./i18n";
|
|
import { themeStore } from "./theme.store";
|
|
import { App } from "./components/app";
|
|
import { LensApp } from "./lens-app";
|
|
|
|
type AppComponent = React.ComponentType & {
|
|
init?(): void;
|
|
}
|
|
|
|
export async function bootstrap(App: AppComponent) {
|
|
const rootElem = document.getElementById("app")
|
|
rootElem.classList.toggle("is-mac", isMac);
|
|
|
|
// preload common stores
|
|
await Promise.all([
|
|
userStore.load(),
|
|
workspaceStore.load(),
|
|
clusterStore.load(),
|
|
i18nStore.init(),
|
|
themeStore.init(),
|
|
]);
|
|
|
|
// init app's dependencies if any
|
|
if (App.init) {
|
|
await App.init();
|
|
}
|
|
render(<App/>, rootElem);
|
|
}
|
|
|
|
// run
|
|
bootstrap(getHostedClusterId() ? App : LensApp);
|