import {UIElement} from "../UIElement"; import {UIEventSource} from "../../Logic/UIEventSource"; import {LayoutConfigJson} from "../../Customizations/JSON/LayoutConfigJson"; import Combine from "../Base/Combine"; import {VariableUiElement} from "../Base/VariableUIElement"; import UserDetails from "../../Logic/Osm/OsmConnection"; export default class SharePanel extends UIElement { private _config: UIEventSource; private _panel: UIElement; constructor(config: UIEventSource, liveUrl: UIEventSource, userDetails: UserDetails) { super(undefined); this._config = config; const proposedName = `User:${userDetails.name}/${config.data.id}` const proposedNameEnc = encodeURIComponent(`wiki:User:${userDetails.name}/${config.data.id}`) this._panel = new Combine([ "

Share

", "Share the following link with friends:
", new VariableUiElement(liveUrl.map(url => `${url}`)), "

Publish on OSM Wiki

", "In the list of 'hacks upon hacks to make MapComplete work', it is now possible to put the JSON-file onto a Wikipage*.
" + "This is a very stable and very well-tested solution. Using wikipages as source control! What could possibly go wrong???? /s

", "Why to publish the layout as a wikipage?", "
    ", ...["If something breaks, it can be fixed centrally", "If someone has a remark about your preset, the talk page can be used to point this out and discuss the preset", "In case of a grave error, everyone can step in to fix the prest"].map(li => `
  • ${li}
  • `), "
", "In order to make this work:", "
    ", ...[`Create a new page on the OSM-wiki, e.g. ${proposedName}`, "Click 'create page'", "Type <nowiki>, a few newlines and </nowiki>", "Copy the json configuration from the 'save-tab', paste it between the 'nowiki'-tags in the Wiki", "Click 'save' to save the wiki page", "Share the link with the url parameter userlayout=wiki:YOURWIKIPAGE, e.g. " + `https://${window.location.host}?userlayout=${proposedNameEnc}` ].map(li => `
  1. ${li}
  2. `), "
", "(* This has made a lot of people very angry and been widely regarded as a bad move.)", "" ]); } InnerRender(): string { return this._panel.Render(); } }