From 15a481f864b4afb7b650fd150f0ce7d46c9d1e78 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 1 Jun 2023 14:54:34 +0200 Subject: [PATCH] Fix: show tags that will be deleted with strikethrough in TagHint --- Logic/Tags/Tag.ts | 4 ++-- UI/Popup/DeleteWizard.ts | 1 + UI/Popup/TagHint.svelte | 4 +++- UI/Popup/TagRendering/TagRenderingQuestion.svelte | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Logic/Tags/Tag.ts b/Logic/Tags/Tag.ts index a40df5453..3db63a9c3 100644 --- a/Logic/Tags/Tag.ts +++ b/Logic/Tags/Tag.ts @@ -82,9 +82,9 @@ export class Tag extends TagsFilter { if (shorten) { v = Utils.EllipsesAfter(v, 25) } - if (v === "" || (v === undefined && currentProperties !== undefined)) { + if ((v === "" || v === undefined) && currentProperties !== undefined) { // This tag will be removed if in the properties, so we indicate this with special rendering - if (currentProperties !== undefined && (currentProperties[this.key] ?? "") === "") { + if ((currentProperties[this.key] ?? "") === "") { // This tag is not present in the current properties, so this tag doesn't change anything return "" } diff --git a/UI/Popup/DeleteWizard.ts b/UI/Popup/DeleteWizard.ts index 637fb3267..beab1237c 100644 --- a/UI/Popup/DeleteWizard.ts +++ b/UI/Popup/DeleteWizard.ts @@ -228,6 +228,7 @@ export default class DeleteWizard extends Toggle { new SvelteUIElement(TagHint, { osmConnection: state.osmConnection, tags: retag, + currentProperties: currentTags.data }), ]) } diff --git a/UI/Popup/TagHint.svelte b/UI/Popup/TagHint.svelte index d4ba075bf..14f2424d5 100644 --- a/UI/Popup/TagHint.svelte +++ b/UI/Popup/TagHint.svelte @@ -11,13 +11,15 @@ */ export let tags: TagsFilter; export let state: SpecialVisualizationState; + + export let currentProperties: Record = {} /** * If given, this function will be called to embed the given tags hint into this translation */ export let embedIn: ((string: string) => Translation) | undefined = undefined; const userDetails = state.osmConnection.userDetails; let tagsExplanation = ""; - $: tagsExplanation = tags?.asHumanString(true, false, {}); + $: tagsExplanation = tags?.asHumanString(true, false, currentProperties); {#if $userDetails.loggedIn} diff --git a/UI/Popup/TagRendering/TagRenderingQuestion.svelte b/UI/Popup/TagRendering/TagRenderingQuestion.svelte index 18f8d0261..0bf235798 100644 --- a/UI/Popup/TagRendering/TagRenderingQuestion.svelte +++ b/UI/Popup/TagRendering/TagRenderingQuestion.svelte @@ -212,7 +212,7 @@ {#if $showTags === "yes" || $showTags === "always" || ($showTags === "" && numberOfCs >= Constants.userJourney.tagsVisibleAt) || $featureSwitchIsTesting || $featureSwitchIsDebugging} - + {#if $featureSwitchIsTesting} Testmode