More cleaning up
This commit is contained in:
parent
778044d0fb
commit
4948524f91
22 changed files with 36 additions and 65 deletions
|
@ -1,6 +1,5 @@
|
|||
console.log("AVAILABLE LAYERS")
|
||||
import * as editorlayerindex from "../../assets/editor-layer-index.json"
|
||||
import {BaseLayer} from "../../Models/BaseLayer";
|
||||
import BaseLayer from "../../Models/BaseLayer";
|
||||
import * as L from "leaflet";
|
||||
import * as X from "leaflet-providers";
|
||||
import {UIEventSource} from "../UIEventSource";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {UIEventSource} from "../UIEventSource";
|
||||
import {BaseLayer} from "../../Models/BaseLayer";
|
||||
import BaseLayer from "../../Models/BaseLayer";
|
||||
import AvailableBaseLayers from "./AvailableBaseLayers";
|
||||
import Loc from "../../Models/Loc";
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import escapeHtml from "escape-html";
|
||||
// @ts-ignore
|
||||
import {OsmConnection, UserDetails} from "./OsmConnection";
|
||||
import {UIEventSource} from "../UIEventSource";
|
||||
import {ElementStorage} from "../ElementStorage";
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import {Basemap} from "../Leaflet/Basemap";
|
||||
import $ from "jquery"
|
||||
import State from "../../State";
|
||||
export class Geocoding {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {UIEventSource} from "../UIEventSource";
|
||||
import {OsmConnection, UserDetails} from "./OsmConnection";
|
||||
import UserDetails, {OsmConnection} from "./OsmConnection";
|
||||
import {Utils} from "../../Utils";
|
||||
|
||||
export class OsmPreferences {
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
import codegrid from "codegrid-js";
|
||||
|
||||
export default class CodeGrid {
|
||||
private static readonly grid = CodeGrid.InitGrid();
|
||||
|
||||
|
||||
public static getCode(lat: any, lon: any, handle: (error, code) => void) {
|
||||
CodeGrid.grid.getCode(lat, lon, handle);
|
||||
}
|
||||
|
||||
|
||||
private static InitGrid(): any {
|
||||
const grid = codegrid.CodeGrid("./tiles/");
|
||||
|
||||
// Heat up the caches
|
||||
grid.getCode(50.2, 3.2, (error, code) => {
|
||||
});
|
||||
grid.getCode(52.5072, 13.4248, (error, code) => {
|
||||
});
|
||||
grid.getCode(40.4781, -3.7034, () => {
|
||||
});
|
||||
return grid;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,7 +3,7 @@ import Link from "../Base/Link";
|
|||
import Svg from "../../Svg";
|
||||
import Combine from "../Base/Combine";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import {UserDetails} from "../../Logic/Osm/OsmConnection";
|
||||
import UserDetails from "../../Logic/Osm/OsmConnection";
|
||||
import Constants from "../../Models/Constants";
|
||||
import LayoutConfig from "../../Customizations/JSON/LayoutConfig";
|
||||
import Loc from "../../Models/Loc";
|
||||
|
@ -19,7 +19,7 @@ export default class Attribution extends UIElement {
|
|||
constructor(location: UIEventSource<Loc>,
|
||||
userDetails: UIEventSource<UserDetails>,
|
||||
layoutToUse: UIEventSource<LayoutConfig>,
|
||||
leafletMap: UIEventSource<L.Map>) {
|
||||
leafletMap: UIEventSource<LeafletMap>) {
|
||||
super(location);
|
||||
this._layoutToUse = layoutToUse;
|
||||
this.ListenTo(layoutToUse);
|
||||
|
@ -49,7 +49,7 @@ export default class Attribution extends UIElement {
|
|||
if (location !== undefined &&
|
||||
this._leafletMap.data !== undefined &&
|
||||
userDetails.csCount >= Constants.userJourney.tagsVisibleAndWikiLinked) {
|
||||
const bounds = this._leafletMap.data.getBounds();
|
||||
const bounds : any= this._leafletMap.data.getBounds();
|
||||
const top = bounds.getNorth();
|
||||
const bottom = bounds.getSouth();
|
||||
const right = bounds.getEast();
|
||||
|
|
|
@ -3,7 +3,7 @@ import {DropDown} from "../Input/DropDown";
|
|||
import Translations from "../i18n/Translations";
|
||||
import State from "../../State";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import {BaseLayer} from "../../Models/BaseLayer";
|
||||
import BaseLayer from "../../Models/BaseLayer";
|
||||
|
||||
export default class BackgroundSelector extends UIElement {
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import Combine from "../Base/Combine";
|
|||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
import Translations from "../i18n/Translations";
|
||||
import Constants from "../../Models/Constants";
|
||||
import LayerConfig from "../../Customizations/JSON/LayerConfig";
|
||||
|
||||
export default class SimpleAddUI extends UIElement {
|
||||
private readonly _addButtons: UIElement[];
|
||||
|
@ -24,7 +25,7 @@ export default class SimpleAddUI extends UIElement {
|
|||
icon: UIElement,
|
||||
tags: Tag[],
|
||||
layerToAddTo: {
|
||||
name: UIElement | string,
|
||||
layerDef: LayerConfig,
|
||||
isDisplayed: UIEventSource<boolean> }
|
||||
}>
|
||||
= new UIEventSource(undefined);
|
||||
|
@ -128,7 +129,7 @@ export default class SimpleAddUI extends UIElement {
|
|||
|
||||
if(!this._confirmPreset.data.layerToAddTo.isDisplayed.data){
|
||||
return new Combine([
|
||||
Translations.t.general.add.layerNotEnabled.Subs({layer: this._confirmPreset.data.layerToAddTo.name})
|
||||
Translations.t.general.add.layerNotEnabled.Subs({layer: this._confirmPreset.data.layerToAddTo.layerDef.name})
|
||||
.SetClass("alert"),
|
||||
this.openLayerControl,
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import {UIElement} from "../UIElement";
|
||||
import {VariableUiElement} from "../Base/VariableUIElement";
|
||||
import {UserDetails} from "../../Logic/Osm/OsmConnection";
|
||||
import UserDetails from "../../Logic/Osm/OsmConnection";
|
||||
import Svg from "../../Svg";
|
||||
import State from "../../State";
|
||||
import Combine from "../Base/Combine";
|
||||
|
|
|
@ -6,7 +6,7 @@ import {LayoutConfigJson} from "../../Customizations/JSON/LayoutConfigJson";
|
|||
import Combine from "../Base/Combine";
|
||||
import {GenerateEmpty} from "./GenerateEmpty";
|
||||
import LayerPanelWithPreview from "./LayerPanelWithPreview";
|
||||
import {UserDetails} from "../../Logic/Osm/OsmConnection";
|
||||
import UserDetails from "../../Logic/Osm/OsmConnection";
|
||||
import {MultiInput} from "../Input/MultiInput";
|
||||
import TagRenderingPanel from "./TagRenderingPanel";
|
||||
import SingleSetting from "./SingleSetting";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {UIElement} from "../UIElement";
|
||||
import {OsmConnection, UserDetails} from "../../Logic/Osm/OsmConnection";
|
||||
import UserDetails, {OsmConnection} from "../../Logic/Osm/OsmConnection";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import SingleSetting from "./SingleSetting";
|
||||
import GeneralSettings from "./GeneralSettings";
|
||||
|
@ -11,7 +11,6 @@ import AllLayersPanel from "./AllLayersPanel";
|
|||
import SharePanel from "./SharePanel";
|
||||
import {LayoutConfigJson} from "../../Customizations/JSON/LayoutConfigJson";
|
||||
import {SubtleButton} from "../Base/SubtleButton";
|
||||
import State from "../../State";
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
import SavePanel from "./SavePanel";
|
||||
import {LocalStorageSource} from "../../Logic/Web/LocalStorageSource";
|
||||
|
|
|
@ -16,8 +16,7 @@ import {TagRenderingConfigJson} from "../../Customizations/JSON/TagRenderingConf
|
|||
import {MultiInput} from "../Input/MultiInput";
|
||||
import {LayerConfigJson} from "../../Customizations/JSON/LayerConfigJson";
|
||||
import PresetInputPanel from "./PresetInputPanel";
|
||||
import {UserDetails} from "../../Logic/Osm/OsmConnection";
|
||||
import State from "../../State";
|
||||
import UserDetails from "../../Logic/Osm/OsmConnection";
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
import ValidatedTextField from "../Input/ValidatedTextField";
|
||||
import Svg from "../../Svg";
|
||||
|
|
|
@ -8,7 +8,7 @@ import {FromJSON} from "../../Customizations/JSON/FromJSON";
|
|||
import Combine from "../Base/Combine";
|
||||
import PageSplit from "../Base/PageSplit";
|
||||
import TagRenderingPreview from "./TagRenderingPreview";
|
||||
import {UserDetails} from "../../Logic/Osm/OsmConnection";
|
||||
import UserDetails from "../../Logic/Osm/OsmConnection";
|
||||
|
||||
|
||||
export default class LayerPanelWithPreview extends UIElement{
|
||||
|
|
|
@ -3,7 +3,7 @@ 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";
|
||||
import UserDetails from "../../Logic/Osm/OsmConnection";
|
||||
|
||||
export default class SharePanel extends UIElement {
|
||||
private _config: UIEventSource<LayoutConfigJson>;
|
||||
|
|
|
@ -12,8 +12,7 @@ import {MultiInput} from "../Input/MultiInput";
|
|||
import MappingInput from "./MappingInput";
|
||||
import {AndOrTagConfigJson} from "../../Customizations/JSON/TagConfigJson";
|
||||
import {TagRenderingConfigJson} from "../../Customizations/JSON/TagRenderingConfigJson";
|
||||
import {UserDetails} from "../../Logic/Osm/OsmConnection";
|
||||
import State from "../../State";
|
||||
import UserDetails from "../../Logic/Osm/OsmConnection";
|
||||
import {VariableUiElement} from "../Base/VariableUIElement";
|
||||
import ValidatedTextField from "../Input/ValidatedTextField";
|
||||
import SpecialVisualizations from "../SpecialVisualizations";
|
||||
|
|
|
@ -9,7 +9,7 @@ import Svg from "../../Svg";
|
|||
import {VariableUiElement} from "../Base/VariableUIElement";
|
||||
import {SaveButton} from "../Popup/SaveButton";
|
||||
import CheckBoxes from "../Input/Checkboxes";
|
||||
import {UserDetails} from "../../Logic/Osm/OsmConnection";
|
||||
import UserDetails from "../../Logic/Osm/OsmConnection";
|
||||
|
||||
export default class ReviewForm extends InputElement<Review> {
|
||||
|
||||
|
|
|
@ -39,12 +39,10 @@ export default class ShowDataLayer {
|
|||
|
||||
const feats = features.data.map(ff => ff.feature);
|
||||
const geoLayer = self.CreateGeojsonLayer(feats);
|
||||
|
||||
if (oldGeoLayer) {
|
||||
mp.removeLayer(oldGeoLayer);
|
||||
}
|
||||
|
||||
geoLayer.addTo(mp);
|
||||
mp.addLayer(geoLayer);
|
||||
oldGeoLayer = geoLayer;
|
||||
}
|
||||
|
||||
|
|
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -3589,6 +3589,14 @@
|
|||
"@types/leaflet": "*"
|
||||
}
|
||||
},
|
||||
"@types/leaflet.markercluster": {
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/leaflet.markercluster/-/leaflet.markercluster-1.4.3.tgz",
|
||||
"integrity": "sha512-X/b/Enz84PzmcA9z7pxsHEBEUNghmvznEBcRQeuxyYL/QU6jAR7LIb/ot03ATNPO56wSFzbCnsOf7yJ+7FzS1Q==",
|
||||
"requires": {
|
||||
"@types/leaflet": "*"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "7.10.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.10.11.tgz",
|
||||
|
@ -7058,6 +7066,11 @@
|
|||
"resolved": "https://registry.npmjs.org/leaflet-providers/-/leaflet-providers-1.10.2.tgz",
|
||||
"integrity": "sha512-1l867LObxwuFBeyPeBewip8PAXKOnvEoujq4/9y2TKTiZNHH76ksBD6dfktGjgUrOF+IdjsGHkpASPE+v2DQLw=="
|
||||
},
|
||||
"leaflet.markercluster": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/leaflet.markercluster/-/leaflet.markercluster-1.4.1.tgz",
|
||||
"integrity": "sha512-ZSEpE/EFApR0bJ1w/dUGwTSUvWlpalKqIzkaYdYB7jaftQA/Y2Jav+eT4CMtEYFj+ZK4mswP13Q2acnPBnhGOw=="
|
||||
},
|
||||
"leven": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
"license": "GPL",
|
||||
"dependencies": {
|
||||
"@types/leaflet-providers": "^1.2.0",
|
||||
"@types/leaflet.markercluster": "^1.4.3",
|
||||
"country-language": "^0.1.7",
|
||||
"email-validator": "^2.0.4",
|
||||
"escape-html": "^1.0.3",
|
||||
|
@ -38,6 +39,7 @@
|
|||
"latlon2country": "^1.0.8",
|
||||
"leaflet": "^1.7.1",
|
||||
"leaflet-providers": "^1.10.2",
|
||||
"leaflet.markercluster": "^1.4.1",
|
||||
"libphonenumber": "0.0.10",
|
||||
"libphonenumber-js": "^1.7.55",
|
||||
"mangrove-reviews": "^0.1.3",
|
||||
|
|
13
test.ts
13
test.ts
|
@ -6,19 +6,6 @@ import ReviewForm from "./UI/Reviews/ReviewForm";
|
|||
import Combine from "./UI/Base/Combine";
|
||||
import {FixedUiElement} from "./UI/Base/FixedUiElement";
|
||||
|
||||
const identity = '{"crv":"P-256","d":"6NHPmTFRedjNl-ZfLRAXhOaNKtRR9GYzPHsO1CzN5wQ","ext":true,"key_ops":["sign"],"kty":"EC","x":"Thm_pL5m0m9Jl41z9vgMTHNyja-9H58v0stJWT4KhTI","y":"PjBldCW85b8K6jEZbw0c2UZskpo-rrkwfPnD7s1MXSM","metadata":"Mangrove private key"}'
|
||||
|
||||
const mangroveReviews = new MangroveReviews(0, 0, "Null Island",
|
||||
new UIEventSource<string>(identity), true)
|
||||
|
||||
new ReviewElement(mangroveReviews.GetSubjectUri(), mangroveReviews.GetReviews()).AttachTo("maindiv");
|
||||
const form = new ReviewForm((r,done) => {
|
||||
mangroveReviews.AddReview(r, done);
|
||||
});
|
||||
form.AttachTo("extradiv")
|
||||
|
||||
form.GetValue().map(r => form.IsValid(r)).addCallback(d => console.log(d))
|
||||
|
||||
/*
|
||||
window.setTimeout(
|
||||
() => {
|
||||
|
|
Loading…
Reference in a new issue