forked from MapComplete/MapComplete
Add custom theme generator
This commit is contained in:
parent
14930e2f93
commit
8d3c8ed9d9
8 changed files with 570 additions and 16 deletions
20
customGenerator.ts
Normal file
20
customGenerator.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import {OsmConnection, UserDetails} from "./Logic/Osm/OsmConnection";
|
||||
import {UIEventSource} from "./UI/UIEventSource";
|
||||
import {VariableUiElement} from "./UI/Base/VariableUIElement";
|
||||
import {Preview, ThemeGenerator} from "./themeGenerator";
|
||||
|
||||
const connection = new OsmConnection(true, new UIEventSource<string>(undefined), false);
|
||||
connection.AttemptLogin();
|
||||
|
||||
new VariableUiElement(connection.userDetails.map<string>((userdetails : UserDetails) => {
|
||||
if(userdetails.loggedIn){
|
||||
return "Logged in as "+userdetails.name
|
||||
}else{
|
||||
return "Not logged in"
|
||||
}
|
||||
})).AttachTo("loggedIn").onClick(() => connection.LogOut());
|
||||
|
||||
const themeGenerator = new ThemeGenerator(connection, window.location.hash?.substr(1));
|
||||
themeGenerator.AttachTo("layoutCreator")
|
||||
|
||||
new Preview(themeGenerator.url).AttachTo("preview");
|
Loading…
Add table
Add a link
Reference in a new issue