diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts
index af3b2d20b..6a08c9336 100644
--- a/Customizations/AllKnownLayouts.ts
+++ b/Customizations/AllKnownLayouts.ts
@@ -35,7 +35,7 @@ export class AllKnownLayouts {
new Artworks(),
new Smoothness(),
new Groen(),
-
+
/*
new Toilets(),
*/
diff --git a/Customizations/LayerDefinition.ts b/Customizations/LayerDefinition.ts
index 51f11ead9..1656da338 100644
--- a/Customizations/LayerDefinition.ts
+++ b/Customizations/LayerDefinition.ts
@@ -2,6 +2,7 @@ import {Tag, TagsFilter} from "../Logic/TagsFilter";
import {UIElement} from "../UI/UIElement";
import {TagDependantUIElementConstructor} from "./UIElementConstructor";
import {TagRenderingOptions} from "./TagRenderingOptions";
+import Translation from "../UI/i18n/Translation";
export interface Preset {
tags: Tag[],
@@ -21,7 +22,7 @@ export class LayerDefinition {
/***
* This is shown under the 'add new' button to indicate what kind of feature one is adding.
*/
- description: string | UIElement
+ description: string | Translation
/**
* These tags are added whenever a new point is added by the user on the map.
@@ -94,8 +95,8 @@ export class LayerDefinition {
static WAYHANDLING_CENTER_AND_WAY = 2;
constructor(id: string, options: {
- name: string | UIElement,
- description: string | UIElement,
+ name: string | Translation,
+ description: string | Translation,
presets: Preset[],
icon: string,
minzoom: number,
diff --git a/Customizations/Layers/BikeCafes.ts b/Customizations/Layers/BikeCafes.ts
index b518c881f..19a65cb5a 100644
--- a/Customizations/Layers/BikeCafes.ts
+++ b/Customizations/Layers/BikeCafes.ts
@@ -61,7 +61,7 @@ export default class BikeCafes extends LayerDefinition {
return {
color: "#00bb00",
icon: {
- iconUrl: self.icon,
+ iconUrl: "./assets/bike/cafe.svg",
iconSize: [50, 50],
iconAnchor: [25,50]
}
diff --git a/Customizations/Layers/BikeParkings.ts b/Customizations/Layers/BikeParkings.ts
index 4aed3bb02..b5c7d2807 100644
--- a/Customizations/Layers/BikeParkings.ts
+++ b/Customizations/Layers/BikeParkings.ts
@@ -49,7 +49,7 @@ export default class BikeParkings extends LayerDefinition {
return {
color: "#00bb00",
icon: {
- iconUrl: self.icon,
+ iconUrl: "./assets/bike/parking.svg",
iconSize: [50, 50],
iconAnchor: [25,50]
}
diff --git a/Customizations/Layers/ClimbingTree.ts b/Customizations/Layers/ClimbingTree.ts
index e6643026e..f423f1aeb 100644
--- a/Customizations/Layers/ClimbingTree.ts
+++ b/Customizations/Layers/ClimbingTree.ts
@@ -11,7 +11,7 @@ export class ClimbingTree extends LayerDefinition {
super("climbingtree");
const t = Translations.t.climbingTrees.layer;
this.title = new FixedText(t.title);
- const icon = "assets/walkbybrussels/tree.svg";
+ const icon = "./assets/themes/nature/tree.svg";
this.icon = icon;
this.description = t.description;
this.style = (tags) => {
diff --git a/Customizations/Layers/DrinkingWater.ts b/Customizations/Layers/DrinkingWater.ts
index 6266b97cf..e7fd086a5 100644
--- a/Customizations/Layers/DrinkingWater.ts
+++ b/Customizations/Layers/DrinkingWater.ts
@@ -54,7 +54,7 @@ export class DrinkingWater extends LayerDefinition {
return {
color: "#00bb00",
icon: {
- iconUrl: self.icon,
+ iconUrl: "./assets/bike/drinking_water.svg",
iconSize: [50, 50],
iconAnchor: [25,50]
}
diff --git a/Customizations/Layouts/ClimbingTrees.ts b/Customizations/Layouts/ClimbingTrees.ts
index fabf8e80f..8618b29b4 100644
--- a/Customizations/Layouts/ClimbingTrees.ts
+++ b/Customizations/Layouts/ClimbingTrees.ts
@@ -15,7 +15,7 @@ export class ClimbingTrees extends Layout {
4.3688,
Translations.t.climbingTrees.layout.welcome
);
- this.icon = "./assets/walkbybrussels/tree.svg"
+ this.icon = "./assets/themes/nature/tree.svg"
this.hideFromOverview = true;
}
}
\ No newline at end of file
diff --git a/Customizations/Layouts/Groen.ts b/Customizations/Layouts/Groen.ts
index 986cfcc8b..ba0d60551 100644
--- a/Customizations/Layouts/Groen.ts
+++ b/Customizations/Layouts/Groen.ts
@@ -52,7 +52,7 @@ export class Groen extends Layout {
""
);
- this.icon = "assets/groen.svg"
+ this.icon = "./assets/groen.svg"
this.locationContains = ["buurtnatuur.be"]
this.socialImage = "assets/BuurtnatuurFront.jpg"
this.description = "Met deze tool kan je natuur in je buurt in kaart brengen en meer informatie geven over je favoriete plekje"
diff --git a/Customizations/Layouts/MetaMap.ts b/Customizations/Layouts/MetaMap.ts
index 6486e9bd7..6a4b7d3f1 100644
--- a/Customizations/Layouts/MetaMap.ts
+++ b/Customizations/Layouts/MetaMap.ts
@@ -1,5 +1,4 @@
import {Layout} from "../Layout";
-import * as Layer from "../Layers/Bookcases";
import {Map} from "../Layers/Map";
export class MetaMap extends Layout{
@@ -15,6 +14,6 @@ export class MetaMap extends Layout{
"
Open Map Map
\n" +
"This map is a map of physical maps, as known by OpenStreetMap.");
- this.icon = "assets/osm-logo-buggy-attr.svg"
+ this.icon = "./assets/osm-logo-buggy-attr.svg"
}
}
\ No newline at end of file
diff --git a/Customizations/Layouts/StreetWidth.ts b/Customizations/Layouts/StreetWidth.ts
index 9ae9573e1..8f3aeb783 100644
--- a/Customizations/Layouts/StreetWidth.ts
+++ b/Customizations/Layouts/StreetWidth.ts
@@ -1,5 +1,4 @@
import {Layout} from "../Layout";
-import * as Layer from "../Layers/Bookcases";
import {Widths} from "../Layers/Widths";
export class StreetWidth extends Layout{
@@ -85,7 +84,7 @@ export class StreetWidth extends Layout{
"
Laat toeristen verplicht parkeren onder het zand; een (fiets)taxi kan hen naar hun hotel brengen
" +
"
Voorzie in elke straat enkele parkeerplaatsen voor kortparkeren. Zo kunnen leveringen, iemand afzetten,... gebeuren zonder dat er een fietspad of een straat geblokkeerd wordt
" +
"");
- this.icon = "assets/bug.svg";
+ this.icon = "./assets/bug.svg";
this.enableSearch = false;
this.enableUserBadge = false;
this.enableAdd = false;
diff --git a/Customizations/Questions/FixedText.ts b/Customizations/Questions/FixedText.ts
index 5884532fe..dfa70793a 100644
--- a/Customizations/Questions/FixedText.ts
+++ b/Customizations/Questions/FixedText.ts
@@ -1,8 +1,9 @@
import {UIElement} from "../../UI/UIElement";
import {TagRenderingOptions} from "../TagRenderingOptions";
+import Translation from "../../UI/i18n/Translation";
export default class FixedText extends TagRenderingOptions {
- constructor(category: string | UIElement) {
+ constructor(category: string | Translation) {
super({
mappings: [
{
diff --git a/Customizations/Questions/NameInline.ts b/Customizations/Questions/NameInline.ts
index 4e687f330..12c609727 100644
--- a/Customizations/Questions/NameInline.ts
+++ b/Customizations/Questions/NameInline.ts
@@ -2,11 +2,12 @@ import {And, Tag} from "../../Logic/TagsFilter";
import {UIElement} from "../../UI/UIElement";
import Translations from "../../UI/i18n/Translations";
import {TagRenderingOptions} from "../TagRenderingOptions";
+import Translation from "../../UI/i18n/Translation";
export class NameInline extends TagRenderingOptions{
- constructor(category: string | UIElement ) {
+ constructor(category: string | Translation ) {
super({
question: "",
diff --git a/UI/Image/ImageCarousel.ts b/UI/Image/ImageCarousel.ts
index 0f9f19c4a..e4cfcfbf5 100644
--- a/UI/Image/ImageCarousel.ts
+++ b/UI/Image/ImageCarousel.ts
@@ -29,6 +29,10 @@ export class ImageCarouselConstructor implements TagDependantUIElementConstructo
return new ImageCarousel(dependencies.tags);
}
+ GetContent(tags: any): string {
+ return undefined;
+ }
+
}
export class ImageCarousel extends TagDependantUIElement {
diff --git a/assets/themes/aed/aed.svg b/assets/themes/aed/aed.svg
new file mode 100644
index 000000000..04d23c107
--- /dev/null
+++ b/assets/themes/aed/aed.svg
@@ -0,0 +1,8 @@
+
+
diff --git a/assets/themes/nature/tree.svg b/assets/themes/nature/tree.svg
new file mode 100644
index 000000000..0b5a59550
--- /dev/null
+++ b/assets/themes/nature/tree.svg
@@ -0,0 +1,129 @@
+
+
diff --git a/createLayouts.ts b/createLayouts.ts
index 55db89ad5..efb2e5e0c 100644
--- a/createLayouts.ts
+++ b/createLayouts.ts
@@ -1,6 +1,11 @@
import {UIElement} from "./UI/UIElement";
// We HAVE to mark this while importing
UIElement.runningFromConsole = true;
+
+import {TagRendering} from "./Customizations/TagRendering";
+
+TagRendering.injectFunction();
+
import {AllKnownLayouts} from "./Customizations/AllKnownLayouts";
import {Layout} from "./Customizations/Layout";
import {readFileSync, writeFile, writeFileSync} from "fs";
@@ -8,6 +13,7 @@ import Locale from "./UI/i18n/Locale";
import svg2img from 'promise-svg2img';
import Translation from "./UI/i18n/Translation";
import Translations from "./UI/i18n/Translations";
+import {TagRenderingOptions} from "./Customizations/TagRenderingOptions";
console.log("Building the layouts")
@@ -88,6 +94,8 @@ function createIcon(iconPath: string, size: number) {
}
+ console.log("Creating icon ", name, newname)
+
svg2img(iconPath,
// @ts-ignore
{width: size, height: size, preserveAspectRatio: true})
@@ -95,21 +103,23 @@ function createIcon(iconPath: string, size: number) {
console.log("Writing icon", newname)
writeFileSync(newname, buffer);
}).catch((error) => {
- console.log("ERROR", error)
+ console.log("ERROR while writing" + iconPath, error)
});
return newname;
}
function createManifest(layout: Layout, relativePath: string) {
- const name = layout.name;
+ const name = layout.name;
const icons = [];
- if (layout.icon.endsWith(".svg")) {
+ let icon = layout.icon;
+ console.log(icon)
+ if (icon.endsWith(".svg")) {
// This is an svg. Lets create the needed pngs!
const sizes = [72, 96, 120, 128, 144, 152, 180, 192, 384, 512];
for (const size of sizes) {
- const name = createIcon(layout.icon, size);
+ const name = createIcon(icon, size);
icons.push({
src: name,
sizes: size + "x" + size,
@@ -117,7 +127,7 @@ function createManifest(layout: Layout, relativePath: string) {
})
}
icons.push({
- src: layout.icon,
+ src: icon,
sizes: "513x513",
type: "image/svg"
})
@@ -126,7 +136,7 @@ function createManifest(layout: Layout, relativePath: string) {
throw "Icon is not an svg for " + layout.name
}
const ogTitle = Translations.W(layout.title).InnerRender();
- const ogDescr = Translations.W(layout.description).InnerRender();
+ const ogDescr = Translations.W(layout.description ?? "").InnerRender();
const manif = {
name: name,
@@ -147,7 +157,7 @@ function createLandingPage(layout: Layout) {
Locale.language.setData(layout.supportedLanguages[0]);
const ogTitle = Translations.W(layout.title).InnerRender();
- const ogDescr = Translations.W(layout.description).InnerRender();
+ const ogDescr = Translations.W(layout.description ?? "").InnerRender();
const ogImage = layout.socialImage;
const og = `
@@ -183,10 +193,11 @@ for (const layoutName in all) {
writeFile(manifestLocation, manif, err);
const landing = createLandingPage(layout);
- console.log("Generating html-file for ",layout.name)
+ console.log("Generating html-file for ", layout.name)
writeFile(enc(layout.name) + ".html", landing, err)
console.log("done")
}
-console.log("COunting all translations")
+
+console.log("Counting all translations")
Translations.CountTranslations();
console.log("All done!")
\ No newline at end of file
diff --git a/deploy.sh b/deploy.sh
index cc8a8db92..87c63dc8d 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -4,13 +4,14 @@ ts-node createLayouts.ts
npm run build
rm -rf /home/pietervdvn/git/pietervdvn.github.io/MapComplete/*
cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/MapComplete/
-./clean.sh
+
cd /home/pietervdvn/git/pietervdvn.github.io/MapComplete/
git add .
git commit -m "New mapcomplete version"
git push
+cd -
# clean up the mess we made
# rm *.js
# rm Logic/*.js
diff --git a/package.json b/package.json
index faa9ab235..f10d3c962 100644
--- a/package.json
+++ b/package.json
@@ -7,14 +7,14 @@
"staticPath": [
{
"staticPath": "tiles",
- "staticOutDir": "tiles/"
+ "staticOutDir": "./tiles/"
}
]
},
"scripts": {
- "start": "parcel *.html UI/** Logic/** assets/**/* assets/**/**/* assets/* vendor/* vendor/*/*",
+ "start": "parcel *.html UI/** Logic/** assets/** a vendor/* vendor/*/*",
"generate": "ts-node createLayouts.ts",
- "build": "rm -rf dist/ && parcel build --public-url ./ *.html assets/* assets/**/* assets/**/**/* vendor/* vendor/*/*",
+ "build": "rm -rf dist/ && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
"clean": "./clean.sh",
"test": "echo \"Error: no test specified\" && exit 1"
},
diff --git a/Customizations/tsconfig.json b/tsconfig.json
similarity index 100%
rename from Customizations/tsconfig.json
rename to tsconfig.json