From 852d569994e9e7e3cab269cafc9cb42a0ef31c54 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 16 Nov 2021 04:16:51 +0100 Subject: [PATCH] Add privacy policy --- UI/BigComponents/CopyrightPanel.ts | 4 +++- UI/BigComponents/PrivacyPolicy.ts | 26 ++++++++++++++++++++++++++ scripts/generateLayerOverview.ts | 2 +- scripts/generateTranslations.ts | 5 +++++ test.html | 1 - test.ts | 3 +++ 6 files changed, 38 insertions(+), 3 deletions(-) diff --git a/UI/BigComponents/CopyrightPanel.ts b/UI/BigComponents/CopyrightPanel.ts index ceef210e7..8b92d77ae 100644 --- a/UI/BigComponents/CopyrightPanel.ts +++ b/UI/BigComponents/CopyrightPanel.ts @@ -21,6 +21,7 @@ import Loc from "../../Models/Loc"; import Toggle from "../Input/Toggle"; import {OsmConnection} from "../../Logic/Osm/OsmConnection"; import Constants from "../../Models/Constants"; +import PrivacyPolicy from "./PrivacyPolicy"; /** * The attribution panel shown on mobile @@ -143,7 +144,8 @@ export default class CopyrightPanel extends Combine { })), CopyrightPanel.CodeContributors(), new Title(t.iconAttribution.title, 3), - ...iconAttributions + ...iconAttributions, + new PrivacyPolicy() ].map(e => e?.SetClass("mt-4"))); this.SetClass("flex flex-col link-underline overflow-hidden") this.SetStyle("max-width: calc(100vw - 3em); width: 40rem; margin-left: 0.75rem; margin-right: 0.5rem") diff --git a/UI/BigComponents/PrivacyPolicy.ts b/UI/BigComponents/PrivacyPolicy.ts index e69de29bb..b6955cb36 100644 --- a/UI/BigComponents/PrivacyPolicy.ts +++ b/UI/BigComponents/PrivacyPolicy.ts @@ -0,0 +1,26 @@ +import Combine from "../Base/Combine"; +import Translations from "../i18n/Translations"; +import Title from "../Base/Title"; + +export default class PrivacyPolicy extends Combine { + constructor() { + const t = Translations.t.privacy + super([ + new Title(t.title, 2), + t.intro, + + new Title(t.trackingTitle), + t.tracking, + new Title(t.geodataTitle), + t.geodata, + new Title(t.editingTitle), + t.editing, + new Title(t.miscCookiesTitle), + t.miscCookies, + new Title(t.whileYoureHere), + t.surveillance, + + ]); + this.SetClass("link-underline") + } +} \ No newline at end of file diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index fb4161601..c24fd4b03 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -188,7 +188,7 @@ class LayerOverviewUtils { allTranslations .filter(t => t.tr.translations[neededLanguage] === undefined && t.tr.translations["*"] === undefined) .forEach(missing => { - themeErrorCount.push("The theme " + theme.id + " should be translation-complete for " + neededLanguage + ", but it lacks a translation for " + missing.context+".\n\tThe full translation is "+missing.tr.translations) + themeErrorCount.push("The theme " + theme.id + " should be translation-complete for " + neededLanguage + ", but it lacks a translation for " + missing.context+".\n\tThe english translation is "+missing.tr.textFor('en')) }) } diff --git a/scripts/generateTranslations.ts b/scripts/generateTranslations.ts index ccbc7c2ba..9137ca84a 100644 --- a/scripts/generateTranslations.ts +++ b/scripts/generateTranslations.ts @@ -208,10 +208,15 @@ function compileTranslationsFromWeblate() { const allTranslations = new TranslationPart() for (const translationFile of translations) { + try{ + const contents = JSON.parse(readFileSync(translationFile, "utf-8")); let language = translationFile.substring(translationFile.lastIndexOf("/") + 1) language = language.substring(0, language.length - 5) allTranslations.add(language, contents) + }catch (e) { + throw "Could not read file "+ translationFile+" due to "+e + } } writeFileSync("./assets/generated/translations.json", JSON.stringify(JSON.parse(allTranslations.toJson()), null, " ")) diff --git a/test.html b/test.html index 76279a8a6..bb618f4d0 100644 --- a/test.html +++ b/test.html @@ -23,7 +23,6 @@
'extradiv' not attached
- diff --git a/test.ts b/test.ts index e69de29bb..32f6eeddc 100644 --- a/test.ts +++ b/test.ts @@ -0,0 +1,3 @@ +import PrivacyPolicy from "./UI/BigComponents/PrivacyPolicy"; + +new PrivacyPolicy().AttachTo("maindiv") \ No newline at end of file