From 3fb7cc90fc4a8447f66c0127b29d5c37e5f63248 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Thu, 10 Mar 2022 23:18:40 +0100 Subject: [PATCH] Fix #691 --- UI/BigComponents/ExtraLinkButton.ts | 70 ++++++++++++++++------------- UI/DefaultGUI.ts | 14 +++++- css/index-tailwind-output.css | 8 ---- css/mobile.css | 23 ++++++++++ langs/en.json | 1 + langs/id.json | 8 ++-- langs/layers/id.json | 22 +-------- langs/nl.json | 2 +- langs/shared-questions/id.json | 20 +-------- langs/themes/en.json | 11 +++++ langs/themes/id.json | 12 +---- theme.html | 6 +-- 12 files changed, 100 insertions(+), 97 deletions(-) diff --git a/UI/BigComponents/ExtraLinkButton.ts b/UI/BigComponents/ExtraLinkButton.ts index 4d7c6e06c..ff9f90f06 100644 --- a/UI/BigComponents/ExtraLinkButton.ts +++ b/UI/BigComponents/ExtraLinkButton.ts @@ -2,46 +2,48 @@ import {UIElement} from "../UIElement"; import BaseUIElement from "../BaseUIElement"; import {UIEventSource} from "../../Logic/UIEventSource"; import ExtraLinkConfig from "../../Models/ThemeConfig/ExtraLinkConfig"; -import MapControlButton from "../MapControlButton"; -import Link from "../Base/Link"; import Img from "../Base/Img"; import {SubtleButton} from "../Base/SubtleButton"; import Toggle from "../Input/Toggle"; import Loc from "../../Models/Loc"; import Locale from "../i18n/Locale"; import {Utils} from "../../Utils"; +import Svg from "../../Svg"; +import Translations from "../i18n/Translations"; +import {Translation} from "../i18n/Translation"; -export default class ExtraLinkButton extends UIElement{ +export default class ExtraLinkButton extends UIElement { private readonly _config: ExtraLinkConfig; private readonly state: { - layoutToUse: {id: string}; - featureSwitchWelcomeMessage: UIEventSource, locationControl: UIEventSource}; + layoutToUse: { id: string, title: Translation }; + featureSwitchWelcomeMessage: UIEventSource, locationControl: UIEventSource + }; - constructor(state: {featureSwitchWelcomeMessage: UIEventSource, locationControl: UIEventSource, layoutToUse: {id: string}}, + constructor(state: { featureSwitchWelcomeMessage: UIEventSource, locationControl: UIEventSource, layoutToUse: { id: string, title: Translations } }, config: ExtraLinkConfig) { super(); this.state = state; this._config = config; } - protected InnerRender(): BaseUIElement { - if(this._config === undefined){ + protected InnerRender(): BaseUIElement { + if (this._config === undefined) { return undefined; } - + const c = this._config; const isIframe = window !== window.top - if(c.requirements.has("iframe") && !isIframe){ + if (c.requirements.has("iframe") && !isIframe) { return undefined } - if(c.requirements.has("no-iframe") && isIframe){ + if (c.requirements.has("no-iframe") && isIframe) { return undefined } - let link : BaseUIElement + let link: BaseUIElement const theme = this.state.layoutToUse?.id ?? "" const href = this.state.locationControl.map(loc => { const subs = { @@ -51,31 +53,35 @@ export default class ExtraLinkButton extends UIElement{ } return Utils.SubstituteKeys(c.href, subs) }) - - if(c.text === undefined){ - link = new MapControlButton( - new Link(new Img(c.icon), href, c.newTab).SetClass("block w-full h-full p-1.5") - ) - }else { - let img : BaseUIElement = undefined - if(c.icon !== undefined){ - img = new Img(c.icon).SetClass("h-6") - } - - link = new SubtleButton(img,c.text, {url: - href, - newTab: c.newTab}) + + + let img: BaseUIElement = Svg.pop_out_ui() + if (c.icon !== undefined) { + img = new Img(c.icon).SetClass("h-6") } - - if(c.requirements.has("no-welcome-message")){ + + let text: Translation + if (c.text === undefined) { + text = Translations.t.general.screenToSmall.Fuse(this.state.layoutToUse.title, "{theme}") + } else { + text = c.text.Clone() + } + + link = new SubtleButton(img, text, { + url: + href, + newTab: c.newTab + }) + + if (c.requirements.has("no-welcome-message")) { link = new Toggle(undefined, link, this.state.featureSwitchWelcomeMessage) } - if(c.requirements.has("welcome-message")){ - link = new Toggle(link, undefined, this.state.featureSwitchWelcomeMessage) + if (c.requirements.has("welcome-message")) { + link = new Toggle(link, undefined, this.state.featureSwitchWelcomeMessage) } - + return link; } - + } \ No newline at end of file diff --git a/UI/DefaultGUI.ts b/UI/DefaultGUI.ts index cfbb9aabc..a02bfbc72 100644 --- a/UI/DefaultGUI.ts +++ b/UI/DefaultGUI.ts @@ -25,6 +25,7 @@ import Combine from "./Base/Combine"; import AddNewMarker from "./BigComponents/AddNewMarker"; import FilteredLayer from "../Models/FilteredLayer"; import ExtraLinkButton from "./BigComponents/ExtraLinkButton"; +import {SubtleButton} from "./Base/SubtleButton"; /** @@ -163,11 +164,22 @@ export default class DefaultGUI { () => new UserBadge(state) ), Toggle.If(state.featureSwitchExtraLinkEnabled, - () => new ExtraLinkButton(state, state.layoutToUse.extraLink) + () => { + if (state.layoutToUse.extraLink.text === undefined) { + return Translations.t.general.screenToSmall + } + return new ExtraLinkButton(state, state.layoutToUse.extraLink); + } ) ]).SetClass("flex flex-col") .AttachTo("userbadge") + const el = state.layoutToUse.extraLink + new Combine([ + new ExtraLinkButton(state, {...state.layoutToUse.extraLink, newTab: true}) + ]).SetClass("flex items-center justify-center normal-background h-full") + .AttachTo("on-small-screen") + Toggle.If(state.featureSwitchSearch, () => new SearchAndGo(state)) .AttachTo("searchbox"); diff --git a/css/index-tailwind-output.css b/css/index-tailwind-output.css index ca9b1f473..f6586b3df 100644 --- a/css/index-tailwind-output.css +++ b/css/index-tailwind-output.css @@ -1103,10 +1103,6 @@ video { max-height: 2rem; } -.max-h-6 { - max-height: 1.5rem; -} - .w-full { width: 100%; } @@ -1504,10 +1500,6 @@ video { padding: 0px; } -.p-1\.5 { - padding: 0.375rem; -} - .p-0\.5 { padding: 0.125rem; } diff --git a/css/mobile.css b/css/mobile.css index a0b6cb896..7164b7506 100644 --- a/css/mobile.css +++ b/css/mobile.css @@ -9,6 +9,29 @@ Contains tweaks for small screens } } + +@media only screen and (min-height: 300px) and (min-width: 225px) { + .very-small-screen { + display: none !important; + } + + + .hidden-on-very-small-screen { + } + +} + + +@media not screen and (min-height: 300px) and (min-width: 225px) { + .very-small-screen { + } + + .hidden-on-very-small-screen { + display: none !important; + } + +} + @media only screen and (max-width: 768px), only screen and (max-height: 768px) { diff --git a/langs/en.json b/langs/en.json index 93ecab0bb..bffbdaec7 100644 --- a/langs/en.json +++ b/langs/en.json @@ -189,6 +189,7 @@ "removeLocationHistory": "Delete the location history", "returnToTheMap": "Return to the map", "save": "Save", + "screenToSmall": "Open {theme} in a new window", "search": { "error": "Something went wrong…", "nothing": "Nothing found…", diff --git a/langs/id.json b/langs/id.json index 45ef6bea2..bc6c86a08 100644 --- a/langs/id.json +++ b/langs/id.json @@ -8,12 +8,12 @@ "delete": { "cancel": "Batal", "cannotBeDeleted": "Fitur ini tidak dapat dihapus", + "delete": "Hapus", "explanations": { "selectReason": "Silahkan pilih mengapa fitur ini harus dihapus" }, - "isntAPoint": "Hanya titik yang dapat dihapus, fitur yang dipilih adalah jalan, area, atau relasi.", - "delete": "Hapus", - "isDeleted": "Fitur ini telah dihapus" + "isDeleted": "Fitur ini telah dihapus", + "isntAPoint": "Hanya titik yang dapat dihapus, fitur yang dipilih adalah jalan, area, atau relasi." }, "favourite": { "reload": "Muat ulang data" @@ -115,4 +115,4 @@ "split": { "cancel": "Batal" } -} +} \ No newline at end of file diff --git a/langs/layers/id.json b/langs/layers/id.json index 195ee3b89..5c3035690 100644 --- a/langs/layers/id.json +++ b/langs/layers/id.json @@ -11,17 +11,8 @@ "0": { "then": "Bangunan ini tidak memiliki nomor rumah" } - }, - "question": "Berapa nomor rumah ini?", - "render": "Nomor rumah ini {addr:housenumber}" - }, - "street": { - "question": "Alamat ini di jalan apa?", - "render": "Alamat ini ada di jalan {addr:street}" + } } - }, - "title": { - "render": "Alamat yang diketahui" } }, "artwork": { @@ -386,14 +377,5 @@ }, "watermill": { "name": "Kincir Air" - }, - "ambulancestation": { - "name": "Peta stasiun ambulans", - "presets": { - "0": { - "description": "Tambahkan stasiun ambulans ke peta", - "title": "Stasiun ambulans" - } - } } -} +} \ No newline at end of file diff --git a/langs/nl.json b/langs/nl.json index ce59b8a58..2f8dfeee0 100644 --- a/langs/nl.json +++ b/langs/nl.json @@ -54,7 +54,7 @@ "importTags": "Het element zal deze tags krijgen: {tags}", "officialThemesOnly": "In onofficiële thema's is de importeerknop uitgeschakeld om ongelukjes te vermijden", "wrongType": "Dit object is geen punt of lijn, en kan daarom niet geïmporteerd worden", - "zoomInMore": "Zoom verder in om dit kaart-object te kunnen importeren" + "zoomInMore": "Zoom verder in om dit object af te handelen" }, "importTags": "Het object zal deze tags krijgen: {tags}", "intro": "Kies hieronder welk punt je wilt toevoegen
", diff --git a/langs/shared-questions/id.json b/langs/shared-questions/id.json index 6cebfc7ad..3bf4b6d9d 100644 --- a/langs/shared-questions/id.json +++ b/langs/shared-questions/id.json @@ -13,12 +13,8 @@ }, "2": { "then": "Anjing diperbolehkan, tetapi mereka harus diikat" - }, - "3": { - "then": "Anjing diperbolehkan dan dapat berkeliaran dengan bebas" } - }, - "question": "Apakah anjing diperbolehkan dalam bisnis ini?" + } }, "email": { "question": "Apa alamat surel dari {title()}?" @@ -27,18 +23,6 @@ "mappings": { "3": { "then": "Berlokasi di lantai pertama" - }, - "1": { - "then": "Terletak di lantai dasar" - }, - "0": { - "then": "Terletak di bawah tanah" - }, - "2": { - "then": "Terletak di lantai dasar" - }, - "4": { - "then": "Terletak di lantai basement pertama" } }, "question": "Pada tingkat apa fitur ini diletakkan?" @@ -61,4 +45,4 @@ "question": "Apa situs web dari {title()}?" } } -} +} \ No newline at end of file diff --git a/langs/themes/en.json b/langs/themes/en.json index 5997286d9..deae423e0 100644 --- a/langs/themes/en.json +++ b/langs/themes/en.json @@ -879,6 +879,17 @@ "question": "What kind of building is this?" } } + }, + "6": { + "tagRenderings": { + "Import-button": { + "mappings": { + "0": { + "then": "Did not yet calculate the metatags... Reopen this popup" + } + } + } + } } } }, diff --git a/langs/themes/id.json b/langs/themes/id.json index efe1d30c2..d9fabf17f 100644 --- a/langs/themes/id.json +++ b/langs/themes/id.json @@ -8,8 +8,7 @@ "title": "Buka Peta Karya Seni" }, "benches": { - "title": "Bangku", - "shortDescription": "Peta bangku" + "title": "Bangku" }, "cafes_and_pubs": { "title": "Kafe dan pub" @@ -283,12 +282,5 @@ }, "waste_basket": { "title": "Keranjang Sampah" - }, - "bicyclelib": { - "title": "Perpustakaan sepeda" - }, - "bicycle_rental": { - "title": "Sewa sepeda", - "shortDescription": "Peta dengan stasiun persewaan sepeda dan toko penyewaan sepeda" } -} +} \ No newline at end of file diff --git a/theme.html b/theme.html index d032d0174..e7bb263a8 100644 --- a/theme.html +++ b/theme.html @@ -47,8 +47,9 @@ - -
+
+ +
'
@@ -83,7 +84,6 @@
-