Reformat all files with prettier
This commit is contained in:
parent
e22d189376
commit
b541d3eab4
382 changed files with 50893 additions and 35566 deletions
82
index.ts
82
index.ts
|
@ -1,46 +1,49 @@
|
|||
import {FixedUiElement} from "./UI/Base/FixedUiElement";
|
||||
import Combine from "./UI/Base/Combine";
|
||||
import MinimapImplementation from "./UI/Base/MinimapImplementation";
|
||||
import {Utils} from "./Utils";
|
||||
import AllThemesGui from "./UI/AllThemesGui";
|
||||
import DetermineLayout from "./Logic/DetermineLayout";
|
||||
import LayoutConfig from "./Models/ThemeConfig/LayoutConfig";
|
||||
import DefaultGUI from "./UI/DefaultGUI";
|
||||
import State from "./State";
|
||||
import ShowOverlayLayerImplementation from "./UI/ShowDataLayer/ShowOverlayLayerImplementation";
|
||||
import {DefaultGuiState} from "./UI/DefaultGuiState";
|
||||
import {QueryParameters} from "./Logic/Web/QueryParameters";
|
||||
import DashboardGui from "./UI/DashboardGui";
|
||||
import StatisticsGUI from "./UI/StatisticsGUI";
|
||||
import { FixedUiElement } from "./UI/Base/FixedUiElement"
|
||||
import Combine from "./UI/Base/Combine"
|
||||
import MinimapImplementation from "./UI/Base/MinimapImplementation"
|
||||
import { Utils } from "./Utils"
|
||||
import AllThemesGui from "./UI/AllThemesGui"
|
||||
import DetermineLayout from "./Logic/DetermineLayout"
|
||||
import LayoutConfig from "./Models/ThemeConfig/LayoutConfig"
|
||||
import DefaultGUI from "./UI/DefaultGUI"
|
||||
import State from "./State"
|
||||
import ShowOverlayLayerImplementation from "./UI/ShowDataLayer/ShowOverlayLayerImplementation"
|
||||
import { DefaultGuiState } from "./UI/DefaultGuiState"
|
||||
import { QueryParameters } from "./Logic/Web/QueryParameters"
|
||||
import DashboardGui from "./UI/DashboardGui"
|
||||
import StatisticsGUI from "./UI/StatisticsGUI"
|
||||
|
||||
// Workaround for a stupid crash: inject some functions which would give stupid circular dependencies or crash the other nodejs scripts running from console
|
||||
MinimapImplementation.initialize()
|
||||
ShowOverlayLayerImplementation.Implement();
|
||||
ShowOverlayLayerImplementation.Implement()
|
||||
// Miscelleanous
|
||||
Utils.DisableLongPresses()
|
||||
|
||||
class Init {
|
||||
public static Init(layoutToUse: LayoutConfig) {
|
||||
|
||||
if (layoutToUse === null) {
|
||||
// Something went wrong, error message is already on screen
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
if (layoutToUse === undefined) {
|
||||
// No layout found
|
||||
new AllThemesGui().setup()
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
const guiState = new DefaultGuiState()
|
||||
State.state = new State(layoutToUse);
|
||||
DefaultGuiState.state = guiState;
|
||||
State.state = new State(layoutToUse)
|
||||
DefaultGuiState.state = guiState
|
||||
// This 'leaks' the global state via the window object, useful for debugging
|
||||
// @ts-ignore
|
||||
window.mapcomplete_state = State.state;
|
||||
window.mapcomplete_state = State.state
|
||||
|
||||
const mode = QueryParameters.GetQueryParameter("mode", "map", "The mode the application starts in, e.g. 'map', 'dashboard' or 'statistics'")
|
||||
const mode = QueryParameters.GetQueryParameter(
|
||||
"mode",
|
||||
"map",
|
||||
"The mode the application starts in, e.g. 'map', 'dashboard' or 'statistics'"
|
||||
)
|
||||
if (mode.data === "dashboard") {
|
||||
new DashboardGui(State.state, guiState).setup()
|
||||
} else {
|
||||
|
@ -49,24 +52,25 @@ class Init {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
document.getElementById("decoration-desktop").remove();
|
||||
new Combine(["Initializing... <br/>",
|
||||
new FixedUiElement("<a>If this message persist, something went wrong - click here to try again</a>")
|
||||
document.getElementById("decoration-desktop").remove()
|
||||
new Combine([
|
||||
"Initializing... <br/>",
|
||||
new FixedUiElement(
|
||||
"<a>If this message persist, something went wrong - click here to try again</a>"
|
||||
)
|
||||
.SetClass("link-underline small")
|
||||
.onClick(() => {
|
||||
localStorage.clear();
|
||||
window.location.reload(true);
|
||||
|
||||
})])
|
||||
.AttachTo("centermessage"); // Add an initialization and reset button if something goes wrong
|
||||
localStorage.clear()
|
||||
window.location.reload(true)
|
||||
}),
|
||||
]).AttachTo("centermessage") // Add an initialization and reset button if something goes wrong
|
||||
|
||||
// @ts-ignore
|
||||
DetermineLayout.GetLayout().then(value => {
|
||||
console.log("Got ", value)
|
||||
Init.Init(value)
|
||||
}).catch(err => {
|
||||
console.error("Error while initializing: ", err, err.stack)
|
||||
})
|
||||
|
||||
|
||||
DetermineLayout.GetLayout()
|
||||
.then((value) => {
|
||||
console.log("Got ", value)
|
||||
Init.Init(value)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("Error while initializing: ", err, err.stack)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue