From 72376092ed243497a8971a1b8fb5141a89dcd16a Mon Sep 17 00:00:00 2001 From: Weblate Date: Thu, 24 Jun 2021 12:24:26 +0200 Subject: [PATCH 01/12] Added translation using Weblate (* (generated) (*)) --- langs/*.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 langs/*.json diff --git a/langs/*.json b/langs/*.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/langs/*.json @@ -0,0 +1 @@ +{} From 5b3bd2cbdb622282e5c6da73fc78a868526e0a89 Mon Sep 17 00:00:00 2001 From: Weblate Date: Thu, 24 Jun 2021 12:24:32 +0200 Subject: [PATCH 02/12] Added translation using Weblate (* (generated) (*)) --- langs/shared-questions/*.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 langs/shared-questions/*.json diff --git a/langs/shared-questions/*.json b/langs/shared-questions/*.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/langs/shared-questions/*.json @@ -0,0 +1 @@ +{} From 30429908458616547b5c4613b13f024f1cdc1474 Mon Sep 17 00:00:00 2001 From: Vinicius Date: Mon, 28 Jun 2021 00:54:14 +0000 Subject: [PATCH 03/12] Translated using Weblate (Portuguese (Brazil)) Currently translated at 25.1% (37 of 147 strings) Translation: MapComplete/Core Translate-URL: https://hosted.weblate.org/projects/mapcomplete/core/pt_BR/ --- langs/pt_BR.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/langs/pt_BR.json b/langs/pt_BR.json index f39644528..e914ed5bf 100644 --- a/langs/pt_BR.json +++ b/langs/pt_BR.json @@ -8,6 +8,16 @@ "pleaseLogin": "Faça login para adicionar uma imagem", "uploadingMultiple": "Fazendo upload de {count} imagens…", "uploadingPicture": "Enviando sua imagem…", - "addPicture": "Adicionar imagem" + "addPicture": "Adicionar imagem", + "isDeleted": "Excluída", + "doDelete": "Remover imagem", + "dontDelete": "Cancelar", + "uploadDone": "Sua foto foi adicionada. Obrigado por ajudar!", + "uploadFailed": "Não foi possível enviar sua foto. Você está conectado à Internet e permite APIs de terceiros? O navegador Brave ou o plugin uMatrix podem bloqueá-los." + }, + "centerMessage": { + "ready": "Concluído!", + "zoomIn": "Amplie para ver ou editar os dados", + "loadingData": "Carregando dados…" } } From 0ef73c1c74a3cf1772a559db31a08e056ffa3f09 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Thu, 1 Jul 2021 22:04:46 +0200 Subject: [PATCH 04/12] Upload data less aggressively --- Logic/Actors/PendingChangesUploader.ts | 32 -------------------------- Models/Constants.ts | 2 +- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/Logic/Actors/PendingChangesUploader.ts b/Logic/Actors/PendingChangesUploader.ts index 2fd038755..e4a296606 100644 --- a/Logic/Actors/PendingChangesUploader.ts +++ b/Logic/Actors/PendingChangesUploader.ts @@ -21,38 +21,6 @@ export default class PendingChangesUploader{ }); - selectedFeature - .stabilized(10000) - .addCallback(feature => { - if(feature === undefined){ - // The popup got closed - we flush - changes.flushChanges("Flushing changes due to popup closed"); - } - }); - - document.addEventListener('mouseout', e => { - // @ts-ignore - if (!e.toElement && !e.relatedTarget) { - changes.flushChanges("Flushing changes due to focus lost"); - } - }); - - document.onfocus = () => { - changes.flushChanges("OnFocus") - } - - document.onblur = () => { - changes.flushChanges("OnFocus") - } - try{ - document.addEventListener("visibilitychange", () => { - changes.flushChanges("Visibility change") - }, false); - }catch(e){ - console.warn("Could not register visibility change listener", e) - } - - window.onbeforeunload = function(e){ if(changes.pending.data.length == 0){ diff --git a/Models/Constants.ts b/Models/Constants.ts index 4cbec2930..a5a11c9f2 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -22,7 +22,7 @@ export default class Constants { * Used by 'PendingChangesUploader', which waits this amount of seconds to upload changes. * (Note that pendingChanges might upload sooner if the popup is closed or similar) */ - static updateTimeoutSec: number = 30; + static updateTimeoutSec: number = 180; private static isRetina(): boolean { if (Utils.runningFromConsole) { From 70f3ff939bcffee97929d9044a57e710386fd487 Mon Sep 17 00:00:00 2001 From: Artem Date: Fri, 2 Jul 2021 11:32:42 +0000 Subject: [PATCH 05/12] Translated using Weblate (Russian) Currently translated at 34.8% (142 of 407 strings) Translation: MapComplete/themes Translate-URL: https://hosted.weblate.org/projects/mapcomplete/themes/ru/ --- langs/themes/ru.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/langs/themes/ru.json b/langs/themes/ru.json index 6466db783..efdf2dc6e 100644 --- a/langs/themes/ru.json +++ b/langs/themes/ru.json @@ -1,6 +1,6 @@ { "aed": { - "title": "Открытая карта AED (Автоматизированных внешних дефибрилляторов)", + "title": "Открытая карта АВД (Автоматизированных внешних дефибрилляторов)", "description": "На этой карте вы можете найти и отметить ближайшие дефибрилляторы" }, "artworks": { @@ -522,4 +522,4 @@ "trees": { "title": "Деревья" } -} \ No newline at end of file +} From d686a756fb27a4a9ea9121fb49a6d04d89fbc11b Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 3 Jul 2021 14:36:26 +0200 Subject: [PATCH 06/12] Revert "Upload data less aggressively": mobile browsers don't ask for confirmation when closing This reverts commit 0ef73c1c74a3cf1772a559db31a08e056ffa3f09. --- Logic/Actors/PendingChangesUploader.ts | 32 ++++++++++++++++++++++++++ Models/Constants.ts | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Logic/Actors/PendingChangesUploader.ts b/Logic/Actors/PendingChangesUploader.ts index e4a296606..2fd038755 100644 --- a/Logic/Actors/PendingChangesUploader.ts +++ b/Logic/Actors/PendingChangesUploader.ts @@ -21,6 +21,38 @@ export default class PendingChangesUploader{ }); + selectedFeature + .stabilized(10000) + .addCallback(feature => { + if(feature === undefined){ + // The popup got closed - we flush + changes.flushChanges("Flushing changes due to popup closed"); + } + }); + + document.addEventListener('mouseout', e => { + // @ts-ignore + if (!e.toElement && !e.relatedTarget) { + changes.flushChanges("Flushing changes due to focus lost"); + } + }); + + document.onfocus = () => { + changes.flushChanges("OnFocus") + } + + document.onblur = () => { + changes.flushChanges("OnFocus") + } + try{ + document.addEventListener("visibilitychange", () => { + changes.flushChanges("Visibility change") + }, false); + }catch(e){ + console.warn("Could not register visibility change listener", e) + } + + window.onbeforeunload = function(e){ if(changes.pending.data.length == 0){ diff --git a/Models/Constants.ts b/Models/Constants.ts index a5a11c9f2..4cbec2930 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -22,7 +22,7 @@ export default class Constants { * Used by 'PendingChangesUploader', which waits this amount of seconds to upload changes. * (Note that pendingChanges might upload sooner if the popup is closed or similar) */ - static updateTimeoutSec: number = 180; + static updateTimeoutSec: number = 30; private static isRetina(): boolean { if (Utils.runningFromConsole) { From b6d9a3127c335be3ca18c77954299091314c6872 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 3 Jul 2021 14:48:07 +0200 Subject: [PATCH 07/12] Add 'pagehide' to ask confirmation on ipads --- Logic/Actors/PendingChangesUploader.ts | 46 ++++++++++++++------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/Logic/Actors/PendingChangesUploader.ts b/Logic/Actors/PendingChangesUploader.ts index 2fd038755..b2a8e100d 100644 --- a/Logic/Actors/PendingChangesUploader.ts +++ b/Logic/Actors/PendingChangesUploader.ts @@ -2,33 +2,33 @@ import {Changes} from "../Osm/Changes"; import Constants from "../../Models/Constants"; import {UIEventSource} from "../UIEventSource"; -export default class PendingChangesUploader{ - - private lastChange : Date; - +export default class PendingChangesUploader { + + private lastChange: Date; + constructor(changes: Changes, selectedFeature: UIEventSource) { const self = this; this.lastChange = new Date(); changes.pending.addCallback(() => { self.lastChange = new Date(); - + window.setTimeout(() => { const diff = (new Date().getTime() - self.lastChange.getTime()) / 1000; - if(Constants.updateTimeoutSec >= diff - 1){ + if (Constants.updateTimeoutSec >= diff - 1) { changes.flushChanges("Flushing changes due to timeout"); } }, Constants.updateTimeoutSec * 1000); }); - - + + selectedFeature .stabilized(10000) .addCallback(feature => { - if(feature === undefined){ - // The popup got closed - we flush - changes.flushChanges("Flushing changes due to popup closed"); - } - }); + if (feature === undefined) { + // The popup got closed - we flush + changes.flushChanges("Flushing changes due to popup closed"); + } + }); document.addEventListener('mouseout', e => { // @ts-ignore @@ -36,7 +36,7 @@ export default class PendingChangesUploader{ changes.flushChanges("Flushing changes due to focus lost"); } }); - + document.onfocus = () => { changes.flushChanges("OnFocus") } @@ -44,18 +44,17 @@ export default class PendingChangesUploader{ document.onblur = () => { changes.flushChanges("OnFocus") } - try{ + try { document.addEventListener("visibilitychange", () => { changes.flushChanges("Visibility change") }, false); - }catch(e){ + } catch (e) { console.warn("Could not register visibility change listener", e) } - window.onbeforeunload = function(e){ - - if(changes.pending.data.length == 0){ + function onunload(e) { + if (changes.pending.data.length == 0) { return; } changes.flushChanges("onbeforeunload - probably closing or something similar"); @@ -63,8 +62,11 @@ export default class PendingChangesUploader{ return "Saving your last changes..." } + window.onbeforeunload = onunload + // https://stackoverflow.com/questions/3239834/window-onbeforeunload-not-working-on-the-ipad#4824156 + window.addEventListener("pagehide", onunload) + } - - - + + } \ No newline at end of file From 69d4ea765ceca3aac8e872bc33c0225ed77c335b Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 3 Jul 2021 14:54:35 +0200 Subject: [PATCH 08/12] Tweak styling for small screens --- UI/BigComponents/AttributionPanel.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UI/BigComponents/AttributionPanel.ts b/UI/BigComponents/AttributionPanel.ts index 8b68a868d..a8fa38660 100644 --- a/UI/BigComponents/AttributionPanel.ts +++ b/UI/BigComponents/AttributionPanel.ts @@ -105,7 +105,7 @@ export default class AttributionPanel extends Combine { const sources = Utils.NoNull(Utils.NoEmpty(license.sources)) return new Combine([ - ``, + ``, new Combine([ new FixedUiElement(license.authors.join("; ")).SetClass("font-bold"), new Combine([license.license, @@ -122,7 +122,7 @@ export default class AttributionPanel extends Combine { ] ).SetClass("block") ]).SetClass("flex flex-col") - ]).SetClass("flex") + ]).SetClass("flex flex-wrap") } private static GenerateLicenses() { From e2591f3dfe454a432ba343c913d985477bd49fb4 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 3 Jul 2021 20:18:52 +0200 Subject: [PATCH 09/12] Toggle in the userbadge on small screens - more map space --- UI/BigComponents/Basemap.ts | 6 ----- UI/BigComponents/UserBadge.ts | 50 ++++++++++++++++++++--------------- css/mobile.css | 25 ------------------ css/userbadge.css | 43 +----------------------------- index.css | 12 +++++++++ index.html | 6 ++--- 6 files changed, 44 insertions(+), 98 deletions(-) diff --git a/UI/BigComponents/Basemap.ts b/UI/BigComponents/Basemap.ts index 4ad5bc8f6..2da6415b6 100644 --- a/UI/BigComponents/Basemap.ts +++ b/UI/BigComponents/Basemap.ts @@ -26,12 +26,6 @@ export class Basemap { attributionControl: extraAttribution !== undefined }); - L.control.scale( - { - position: 'topright', - } - ).addTo(this.map) - // Users are not allowed to zoom to the 'copies' on the left and the right, stuff goes wrong then // We give a bit of leeway for people on the edges diff --git a/UI/BigComponents/UserBadge.ts b/UI/BigComponents/UserBadge.ts index 26214661a..576c47a55 100644 --- a/UI/BigComponents/UserBadge.ts +++ b/UI/BigComponents/UserBadge.ts @@ -1,6 +1,3 @@ -/** - * Handles and updates the user badge - */ import {VariableUiElement} from "../Base/VariableUIElement"; import Svg from "../../Svg"; import State from "../../State"; @@ -21,7 +18,7 @@ export default class UserBadge extends Toggle { const loginButton = Translations.t.general.loginWithOpenStreetMap .Clone() - .SetClass("userbadge-login pt-3 w-full") + .SetClass("userbadge-login pt-3 w-full h-full") .onClick(() => State.state.osmConnection.AttemptLogin()); @@ -32,7 +29,7 @@ export default class UserBadge extends Toggle { }); - const userBadge = userDetails.map(user => { + const userBadge = new VariableUiElement(userDetails.map(user => { { const homeButton = new VariableUiElement( userDetails.map((userinfo) => { @@ -78,7 +75,7 @@ export default class UserBadge extends Toggle { let dryrun = new FixedUiElement(""); if (user.dryRun) { - dryrun = new FixedUiElement("TESTING").SetClass("alert"); + dryrun = new FixedUiElement("TESTING").SetClass("alert font-xs p-0 max-h-4"); } const settings = @@ -87,15 +84,7 @@ export default class UserBadge extends Toggle { true) - const userIcon = new Link( - new Img(user.img) - .SetClass("rounded-full opacity-0 m-0 p-0 duration-500 w-16 h16 float-left") - , - `https://www.openstreetmap.org/user/${encodeURIComponent(user.name)}`, - true - ); - - + const userName = new Link( new FixedUiElement(user.name), `https://www.openstreetmap.org/user/${user.name}`, @@ -113,24 +102,41 @@ export default class UserBadge extends Toggle { .SetClass("userstats") const usertext = new Combine([ - userName, - dryrun, + new Combine([userName, dryrun]).SetClass("flex justify-end w-full"), userStats - ]).SetClass("usertext") + ]).SetClass("flex flex-col sm:w-auto sm:pl-2 overflow-hidden w-0") + const userIcon = + new Img(user.img).SetClass("rounded-full opacity-0 m-0 p-0 duration-500 w-16 min-width-16 h16 float-left") + .onClick(() => { + if(usertext.HasClass("w-0")){ + usertext.RemoveClass("w-0") + usertext.SetClass("w-min pl-2") + }else{ + usertext.RemoveClass("w-min") + usertext.RemoveClass("pl-2") + usertext.SetClass("w-0") + } + }) + return new Combine([ - userIcon, usertext, - ]).SetClass("h-16") + userIcon, + ]).SetClass("h-16 flex bg-white") + } - }); + })); + userBadge.SetClass("inline-block m-0 w-full").SetStyle("pointer-events: all") super( - new VariableUiElement(userBadge), + userBadge, loginButton, State.state.osmConnection.isLoggedIn ) + + this.SetClass("shadow rounded-full h-min overflow-hidden block w-max") + } diff --git a/css/mobile.css b/css/mobile.css index 7165f0cd7..0fd405ac4 100644 --- a/css/mobile.css +++ b/css/mobile.css @@ -15,15 +15,6 @@ Contains tweaks for small screens display: none !important; } - #help-button-mobile div { - box-shadow: 0 0 10px #0006; - margin-bottom: 10px; - } - - #geolocate-button { - display: block; - } - #centermessage { top: 30%; left: 15%; @@ -57,21 +48,5 @@ Contains tweaks for small screens } -@media only screen and (max-width: 600px) { - /* Portrait */ - #userbadge-and-search { - display: inline-block; - width: auto; - max-width: 100vw; - } - - .userbadge-login { - min-width: unset; - } - - #userbadge { - margin-bottom: 0.3em; - } -} diff --git a/css/userbadge.css b/css/userbadge.css index 2fe2efec1..8d9897cfe 100644 --- a/css/userbadge.css +++ b/css/userbadge.css @@ -1,16 +1,4 @@ -#userbadge { - display: inline-block; - background-color: var(--background-color); - color: var(--foreground-color); - margin: 0; - margin-bottom: 0.5em; - width: 100%; - min-width: 20em; - pointer-events: all; - border-radius: 999em; - max-width: 100vw; - overflow-x: hidden; -} + .userstats { display: flex; @@ -45,28 +33,6 @@ display: block; } -.usertext { - display: block; - width: max-content; - margin: 0; - - padding: 0.9em; - padding-left: 4.7em; /* Should be half of profile-pic's width + actual padding (same as padding-right)*/ - padding-right: 1.5em; - border-radius: 2em; /*Half border radius width/height*/ - height: 2.2em; /*SHould equal profile-pic height - padding*/ - z-index: 5000; - text-align: left; - background-color: var(--background-color); - color: var(--foreground-color); - background-size: 100%; - - line-height: 0.75em; -} - - - - .userbadge-login { font-weight: bold; font-size: large; @@ -81,10 +47,3 @@ min-width: 20em; pointer-events: all; } - -#userbadge-and-search { - display: inline-block; - width: min-content; - overflow-x: hidden; - max-width: 100vw; -} diff --git a/index.css b/index.css index ebf83ca4b..47178a06f 100644 --- a/index.css +++ b/index.css @@ -93,6 +93,18 @@ a { color: var(--foreground-color); } +.h-min { + height: min-content; +} + +.w-min { + width: min-content; +} + +.space-between{ + justify-content: space-between; +} + .link-underline a { text-decoration: underline 1px #0078a855;; color: #0078A8; diff --git a/index.html b/index.html index eb45c805a..22113fa9d 100644 --- a/index.html +++ b/index.html @@ -59,9 +59,9 @@
- From 3861c5c6343ab1d28bf1556b31f0808d567fcf17 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 3 Jul 2021 20:50:28 +0200 Subject: [PATCH 10/12] Version bump --- Models/Constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Models/Constants.ts b/Models/Constants.ts index 4cbec2930..4f16c97ac 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -2,7 +2,7 @@ import { Utils } from "../Utils"; export default class Constants { - public static vNumber = "0.8.2"; + public static vNumber = "0.8.2a"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { From 952e3e2bc7fb83fa96459a29706e985c48ae3661 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 3 Jul 2021 21:18:19 +0200 Subject: [PATCH 11/12] Styling tweaks --- UI/BigComponents/AttributionPanel.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/UI/BigComponents/AttributionPanel.ts b/UI/BigComponents/AttributionPanel.ts index a8fa38660..cd87c2bf3 100644 --- a/UI/BigComponents/AttributionPanel.ts +++ b/UI/BigComponents/AttributionPanel.ts @@ -65,8 +65,8 @@ export default class AttributionPanel extends Combine { ...Utils.NoNull(Array.from(layoutToUse.data.ExtractImages())) .map(AttributionPanel.IconAttribution) ]); - this.SetClass("flex flex-col link-underline") - this.SetStyle("max-width: calc(100vw - 5em); width: 40em;") + this.SetClass("flex flex-col link-underline overflow-hidden") + this.SetStyle("max-width: calc(100vw - 5em); width: 40rem;") } private static CodeContributors(): BaseUIElement { @@ -120,9 +120,10 @@ export default class AttributionPanel extends Combine { return new Link(sourceLinkContent, lnk, true); }) ] - ).SetClass("block") - ]).SetClass("flex flex-col") - ]).SetClass("flex flex-wrap") + ).SetClass("block m-2") + + ]).SetClass("flex flex-col").SetStyle("width: calc(100% - 50px - 0.5em); min-width: 12rem;") + ]).SetClass("flex flex-wrap border-b border-gray-300 m-2 border-box") } private static GenerateLicenses() { From 6ec261e5164947e409fd2ee9cfd39d2a0a437239 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 3 Jul 2021 21:23:11 +0200 Subject: [PATCH 12/12] Add space between value and denomination, fixes #383 --- Customizations/JSON/Denomination.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Customizations/JSON/Denomination.ts b/Customizations/JSON/Denomination.ts index d460a26d9..fd9308319 100644 --- a/Customizations/JSON/Denomination.ts +++ b/Customizations/JSON/Denomination.ts @@ -151,7 +151,7 @@ export class Denomination { if (stripped === null) { return null; } - return stripped + this.canonical + return stripped + " " + this.canonical.trim() } /**