forked from MapComplete/MapComplete
Various small fixes
This commit is contained in:
parent
1ea285d303
commit
2dd428497e
45 changed files with 776 additions and 587 deletions
|
@ -19,7 +19,7 @@ export class SubtleButton extends UIElement{
|
|||
if ((imageUrl ?? "") === "") {
|
||||
this.image = new FixedUiElement("");
|
||||
} else if (typeof (imageUrl) === "string") {
|
||||
this.image = new FixedUiElement(`<img src="${imageUrl}">`);
|
||||
this.image = new FixedUiElement(`<img style="height:3em" src="${imageUrl}">`);
|
||||
} else {
|
||||
this.image = imageUrl;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ export default class CustomGeneratorPanel extends UIElement {
|
|||
const encoded = es.map(config => btoa(JSON.stringify(config)));
|
||||
encoded.addCallback(encoded => LocalStorageSource.Get("last-custom-theme"))
|
||||
const liveUrl = encoded.map(encoded => `./index.html?userlayout=${es.data.id}#${encoded}`)
|
||||
const iframe = liveUrl.map(url => `<iframe src='${url}' width='100%' height='99%' style="box-sizing: border-box" title='Theme Preview'></iframe>`);
|
||||
const testUrl = encoded.map(encoded => `./index.html?test=true&userlayout=${es.data.id}#${encoded}`)
|
||||
const iframe = testUrl.map(url => `<iframe src='${url}' width='100%' height='99%' style="box-sizing: border-box" title='Theme Preview'></iframe>`);
|
||||
const currentSetting = new UIEventSource<SingleSetting<any>>(undefined)
|
||||
const generalSettings = new GeneralSettings(es, currentSetting);
|
||||
const languages = generalSettings.languages;
|
||||
|
|
|
@ -43,8 +43,10 @@ export default class GeneralSettingsPanel extends UIElement {
|
|||
"Supported languages", "Which languages do you want to support in this theme? Type the two letter code representing your language, seperated by <span class='literal-code'>;</span>. For example:<span class='literal-code'>en;nl</span> "),
|
||||
new SingleSetting(configuration, new MultiLingualTextFields(this.languages), "title",
|
||||
"Title", "The title as shown in the welcome message, in the browser title bar, in the more screen, ..."),
|
||||
new SingleSetting(configuration, new MultiLingualTextFields(this.languages), "shortDescription","Short description",
|
||||
"The short description is shown as subtext in the social preview and on the 'more screen'-buttons. It should be at most one sentence of around ~25words"),
|
||||
new SingleSetting(configuration, new MultiLingualTextFields(this.languages, true),
|
||||
"description", "Description", "The description is shown in the welcomemessage. It is a small text welcoming users"),
|
||||
"description", "Description", "The description is shown in the welcome-message when opening MapComplete. It is a small text welcoming users"),
|
||||
new SingleSetting(configuration, TextField.StringInput(), "icon",
|
||||
"Icon", "A visual representation for your theme; used as logo in the welcomeMessage. If your theme is official, used as favicon and webapp logo",
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@ export class GenerateEmpty {
|
|||
return {
|
||||
id: "id",
|
||||
title: {},
|
||||
shortDescription: {},
|
||||
description: {},
|
||||
language: [],
|
||||
maintainer: "",
|
||||
|
@ -51,6 +52,7 @@ export class GenerateEmpty {
|
|||
return {
|
||||
id: "test",
|
||||
title: {"en": "Test layout"},
|
||||
shortDescription: {},
|
||||
description: {"en": "A layout for testing"},
|
||||
language: ["en"],
|
||||
maintainer: "Pieter Vander Vennet",
|
||||
|
|
|
@ -115,30 +115,16 @@ export class FeatureInfoBox extends UIElement {
|
|||
|
||||
let questionElement: UIElement;
|
||||
|
||||
if (!State.state.osmConnection.userDetails.data.loggedIn) {
|
||||
let mostImportantQuestion ;
|
||||
let score = -1000;
|
||||
for (const question of questions) {
|
||||
|
||||
if (mostImportantQuestion === undefined || question.Priority() > score) {
|
||||
mostImportantQuestion = question;
|
||||
score = question.Priority();
|
||||
}
|
||||
}
|
||||
|
||||
questionElement = mostImportantQuestion;
|
||||
} else if (questions.length > 0) {
|
||||
if (questions.length > 0) {
|
||||
// We select the most important question and render that one
|
||||
let mostImportantQuestion;
|
||||
let score = -1000;
|
||||
for (const question of questions) {
|
||||
|
||||
if (mostImportantQuestion === undefined || question.Priority() > score) {
|
||||
if (mostImportantQuestion === undefined) {
|
||||
mostImportantQuestion = question;
|
||||
score = question.Priority();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
questionElement = mostImportantQuestion;
|
||||
} else if (skippedQuestions == 1) {
|
||||
questionElement = this._oneSkipped;
|
||||
|
|
|
@ -153,21 +153,22 @@ export class SimpleAddUI extends UIElement {
|
|||
|
||||
let header: UIElement = Translations.t.general.add.header;
|
||||
|
||||
|
||||
if(userDetails === undefined){
|
||||
|
||||
if (userDetails === undefined) {
|
||||
return header.Render();
|
||||
}
|
||||
|
||||
|
||||
if (!userDetails.data.loggedIn) {
|
||||
return new Combine([header, this._loginButton]).Render()
|
||||
}
|
||||
|
||||
if (userDetails.data.unreadMessages > 0) {
|
||||
if (userDetails.data.unreadMessages > 0 && userDetails.data.csCount < State.userJourney.addNewPointWithUnreadMessagesUnlock) {
|
||||
return new Combine([header, "<span class='alert'>",
|
||||
Translations.t.general.readYourMessages,
|
||||
"</span>",
|
||||
this.goToInboxButton
|
||||
]).Render();
|
||||
|
||||
}
|
||||
|
||||
if (userDetails.data.dryRun) {
|
||||
|
@ -178,7 +179,7 @@ export class SimpleAddUI extends UIElement {
|
|||
]);
|
||||
}
|
||||
|
||||
if (userDetails.data.csCount < 5) {
|
||||
if (userDetails.data.csCount < State.userJourney.addNewPointsUnlock) {
|
||||
return new Combine([header, "<span class='alert'>",
|
||||
Translations.t.general.fewChangesBefore,
|
||||
"</span>"]).Render();
|
||||
|
|
|
@ -21,7 +21,6 @@ import {FixedUiElement} from "./Base/FixedUiElement";
|
|||
export class TagRendering extends UIElement implements TagDependantUIElement {
|
||||
|
||||
|
||||
private readonly _priority: number;
|
||||
private readonly _question: string | Translation;
|
||||
private readonly _mapping: { k: TagsFilter, txt: string | UIElement, priority?: number }[];
|
||||
|
||||
|
@ -58,8 +57,6 @@ export class TagRendering extends UIElement implements TagDependantUIElement {
|
|||
}
|
||||
|
||||
constructor(tags: UIEventSource<any>, options: {
|
||||
priority?: number
|
||||
|
||||
question?: string | Translation,
|
||||
freeform?: {
|
||||
key: string,
|
||||
|
@ -80,8 +77,6 @@ export class TagRendering extends UIElement implements TagDependantUIElement {
|
|||
|
||||
const self = this;
|
||||
|
||||
this._priority = options.priority ?? 0;
|
||||
|
||||
this.currentTags = this._source.map(tags =>
|
||||
{
|
||||
|
||||
|
@ -525,10 +520,6 @@ export class TagRendering extends UIElement implements TagDependantUIElement {
|
|||
}
|
||||
|
||||
|
||||
Priority(): number {
|
||||
return this._priority;
|
||||
}
|
||||
|
||||
private ApplyTemplate(template: string | Translation): UIElement {
|
||||
if (template === undefined || template === null) {
|
||||
return undefined;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {UIElement} from "../UIElement"
|
||||
import Locale from "./Locale"
|
||||
import Combine from "../Base/Combine";
|
||||
import {Utils} from "../../Utils";
|
||||
|
||||
|
||||
export default class Translation extends UIElement {
|
||||
|
@ -87,4 +88,16 @@ export default class Translation extends UIElement {
|
|||
}
|
||||
|
||||
|
||||
FirstSentence() {
|
||||
|
||||
const tr = {};
|
||||
for (const lng in this.translations) {
|
||||
let txt = this.translations[lng];
|
||||
txt = txt.replace(/\..*/, "");
|
||||
txt = Utils.EllipsesAfter(txt, 255);
|
||||
tr[lng] = txt;
|
||||
}
|
||||
|
||||
return new Translation(tr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,97 +12,6 @@ export default class Translations {
|
|||
|
||||
|
||||
static t = {
|
||||
|
||||
cyclofix: {
|
||||
title: new T({
|
||||
en: 'Cyclofix - an open map for cyclists',
|
||||
nl: 'Cyclofix - een open kaart voor fietsers',
|
||||
fr: 'Cyclofix - Une carte ouverte pour les cyclistes',
|
||||
gl: 'Cyclofix - Un mapa aberto para os ciclistas',
|
||||
de: 'Cyclofix - eine offene Karte für Radfahrer'
|
||||
}),
|
||||
description: new T({
|
||||
en: "The goal of this map is to present cyclists with an easy-to-use solution to find the appropriate infrastructure for their needs.<br><br>" + //this works in spoken language: ; think about the nearest bike repair station for example
|
||||
"You can track your precise location (mobile only) and select layers that are relevant for you in the bottom left corner. " +
|
||||
"You can also use this tool to add or edit pins (points of interest) to the map and provide more data by answering the questions.<br><br>" +
|
||||
"All changes you make will automatically be saved in the global database of OpenStreetMap and can be freely re-used by others.<br><br>" +
|
||||
"For more information about the cyclofix project, go to <a href='https://cyclofix.osm.be/'>cyclofix.osm.be</a>.",
|
||||
nl: "Het doel van deze kaart is om fietsers een gebruiksvriendelijke oplossing te bieden voor het vinden van de juiste infrastructuur voor hun behoeften.<br><br>" + //; denk bijvoorbeeld aan de dichtstbijzijnde fietsherstelplaats.
|
||||
"U kunt uw exacte locatie volgen (enkel mobiel) en in de linkerbenedenhoek categorieën selecteren die voor u relevant zijn. " +
|
||||
"U kunt deze tool ook gebruiken om 'spelden' aan de kaart toe te voegen of te bewerken en meer gegevens te verstrekken door de vragen te beantwoorden.<br><br>" +
|
||||
"Alle wijzigingen die u maakt worden automatisch opgeslagen in de wereldwijde database van OpenStreetMap en kunnen door anderen vrij worden hergebruikt.<br><br>" +
|
||||
"Bekijk voor meer info over cyclofix ook <a href='https://cyclofix.osm.be/'>cyclofix.osm.be</a>.",
|
||||
fr: "Le but de cette carte est de présenter aux cyclistes une solution facile à utiliser pour trouver l'infrastructure appropriée à leurs besoins.<br><br>" + //; pensez par exemple à la station de réparation de vélos la plus proche.
|
||||
"Vous pouvez suivre votre localisation précise (mobile uniquement) et sélectionner les couches qui vous concernent dans le coin inférieur gauche. " +
|
||||
"Vous pouvez également utiliser cet outil pour ajouter ou modifier des épingles (points d'intérêt) sur la carte et fournir plus de données en répondant aux questions.<br><br>" +
|
||||
"Toutes les modifications que vous apportez seront automatiquement enregistrées dans la base de données mondiale d'OpenStreetMap et peuvent être librement réutilisées par d'autres.<br><br>" +
|
||||
"Pour plus d'informations sur le projet cyclofix, rendez-vous sur <a href='https://cyclofix.osm.be/'>cyclofix.osm.be</a>.",
|
||||
gl: "O obxectivo deste mapa é amosar ós ciclistas unha solución doada de empregar para atopar a infraestrutura axeitada para as súas necesidades.<br><br>" + //isto funciona na lingua falada: ; pensa na estación de arranxo de bicicletas máis preta, por exemplo.
|
||||
"Podes obter a túa localización precisa (só para dispositivos móbiles) e escoller as capas que sexan relevantes para ti na esquina inferior esquerda. " +
|
||||
"Tamén podes empregar esta ferramenta para engadir ou editar puntos de interese ó mapa e fornecer máis datos respondendo as cuestións.<br><br>" +
|
||||
"Todas as modificacións que fagas serán gardadas de xeito automático na base de datos global do OpenStreetMap e outros poderán reutilizalos libremente.<br><br>" +
|
||||
"Para máis información sobre o proxecto cyclofix, vai a <a href='https://cyclofix.osm.be/'>cyclofix.osm.be</a>.",
|
||||
de: "Das Ziel dieser Karte ist es, den Radfahrern eine einfach zu benutzende Lösung zu präsentieren, um die geeignete Infrastruktur für ihre Bedürfnisse zu finden.<br><br>" + //dies funktioniert in gesprochener Sprache: ; denken Sie zum Beispiel an die nächste Fahrradreparaturstation
|
||||
"Sie können Ihren genauen Standort verfolgen (nur mobil) und in der linken unteren Ecke die für Sie relevanten Ebenen auswählen. " +
|
||||
"Sie können dieses Tool auch verwenden, um Pins (Points of Interest/Interessante Orte) zur Karte hinzuzufügen oder zu bearbeiten und mehr Daten durch Beantwortung der Fragen bereitstellen.<br><br>" +
|
||||
"Alle Änderungen, die Sie vornehmen, werden automatisch in der globalen Datenbank von OpenStreetMap gespeichert und können von anderen frei wiederverwendet werden.<br><br>" +
|
||||
"Weitere Informationen über das Projekt Cyclofix finden Sie unter <a href='https://cyclofix.osm.be/'>cyclofix.osm.be</a>."
|
||||
}),
|
||||
nonBikeShop: {
|
||||
name: new T({
|
||||
en: "shop that sells/repairs bikes",
|
||||
nl: "winkel die fietsen verkoopt/herstelt",
|
||||
fr: "magasin qui repare/vend des vélos",
|
||||
gl: "tenda que vende/arranxa bicicletas",
|
||||
de: "geschäft, das Fahrräder verkauft/repariert"
|
||||
}),
|
||||
|
||||
title: new T({
|
||||
en: "Shop that sells/repairs bikes",
|
||||
nl: "Winkel die fietsen verkoopt/herstelt",
|
||||
fr: "Magasin qui répare/vend des vélos",
|
||||
gl: "Tenda que vende/arranxa bicicletas",
|
||||
de: "Geschäft, das Fahrräder verkauft/repariert"
|
||||
}),
|
||||
titleRepair: new T({
|
||||
en: "Shop that repairs bikes",
|
||||
nl: "Winkel die fietsen herstelt",
|
||||
fr: "Magasin qui répare les vélos",
|
||||
gl: "Tenda que arranxa bicicletas",
|
||||
de: "Geschäft, das Fahrräder repariert"
|
||||
}),
|
||||
titleShop: new T({
|
||||
en: "Shop that sells bikes",
|
||||
nl: "Winkel die fietsen verkoopt",
|
||||
fr: "Magasin qui vend des vélos",
|
||||
gl: "Tenda que vende bicicletas",
|
||||
de: "Geschäft, das Fahrräder verkauft"
|
||||
}),
|
||||
|
||||
titleNamed: new T({
|
||||
en: "{name} (sells/repairs bikes)",
|
||||
nl: "{name} (verkoopt/herstelt fietsen)",
|
||||
fr: "vend/repare les vélos",
|
||||
gl: "{name} (vende/arranxa bicicletas)",
|
||||
de: "{name} (verkauft/repariert Fahrräder)"
|
||||
}),
|
||||
titleRepairNamed: new T({
|
||||
en: "{name} (repairs bikes)",
|
||||
nl: "{name} (herstelt fietsen)",
|
||||
fr: "{name} (répare les vélos)",
|
||||
gl: "{name} (arranxa bicicletas)",
|
||||
de: "{name} (repariert Fahrräder)"
|
||||
}),
|
||||
titleShopNamed: new T({
|
||||
en: "{name} (sells bikes)",
|
||||
nl: "{name} (verkoopt fietsen)",
|
||||
fr: "{name} (vend des vélos)",
|
||||
gl: "{name} (vende bicicletas)",
|
||||
de: "{name} (verkauft Fahrräder)"
|
||||
}),
|
||||
}
|
||||
},
|
||||
|
||||
image: {
|
||||
addPicture: new T({
|
||||
en: 'Add picture',
|
||||
|
@ -568,7 +477,7 @@ export default class Translations {
|
|||
},
|
||||
openStreetMapIntro: new T({
|
||||
en: "<h3>An Open Map</h3>" +
|
||||
"<p>Wouldn't it be cool if there was a single map, which everyone could freely use and edit?" +
|
||||
"<p>Wouldn't it be cool if there was a single map, which everyone could freely use and edit? " +
|
||||
"A single place to store all geo-information? Then, all those websites with different, small and incompatible maps (which are always outdated) wouldn't be needed anymore.</p>" +
|
||||
"<p><b><a href='https://OpenStreetMap.org' target='_blank'>OpenStreetMap</a></b> is this map. The map data can be used for free (with <a href='https://osm.org/copyright' target='_blank'>attribution and publication of changes to that data</a>)." +
|
||||
" On top of that, everyone can freely add new data and fix errors. This website uses OpenStreetMap as well. All the data is from there, and your answers and corrections are added there as well.</p>" +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue