Fix: show tags that will be deleted with strikethrough in TagHint

This commit is contained in:
Pieter Vander Vennet 2023-06-01 14:54:34 +02:00
parent 14e96094c2
commit 15a481f864
4 changed files with 7 additions and 4 deletions

View file

@ -82,9 +82,9 @@ export class Tag extends TagsFilter {
if (shorten) { if (shorten) {
v = Utils.EllipsesAfter(v, 25) 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 // 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 // This tag is not present in the current properties, so this tag doesn't change anything
return "" return ""
} }

View file

@ -228,6 +228,7 @@ export default class DeleteWizard extends Toggle {
new SvelteUIElement(TagHint, { new SvelteUIElement(TagHint, {
osmConnection: state.osmConnection, osmConnection: state.osmConnection,
tags: retag, tags: retag,
currentProperties: currentTags.data
}), }),
]) ])
} }

View file

@ -11,13 +11,15 @@
*/ */
export let tags: TagsFilter; export let tags: TagsFilter;
export let state: SpecialVisualizationState; export let state: SpecialVisualizationState;
export let currentProperties: Record<string, string | any> = {}
/** /**
* If given, this function will be called to embed the given tags hint into this translation * If given, this function will be called to embed the given tags hint into this translation
*/ */
export let embedIn: ((string: string) => Translation) | undefined = undefined; export let embedIn: ((string: string) => Translation) | undefined = undefined;
const userDetails = state.osmConnection.userDetails; const userDetails = state.osmConnection.userDetails;
let tagsExplanation = ""; let tagsExplanation = "";
$: tagsExplanation = tags?.asHumanString(true, false, {}); $: tagsExplanation = tags?.asHumanString(true, false, currentProperties);
</script> </script>
{#if $userDetails.loggedIn} {#if $userDetails.loggedIn}

View file

@ -212,7 +212,7 @@
</div> </div>
{#if $showTags === "yes" || $showTags === "always" || ($showTags === "" && numberOfCs >= Constants.userJourney.tagsVisibleAt) || $featureSwitchIsTesting || $featureSwitchIsDebugging} {#if $showTags === "yes" || $showTags === "always" || ($showTags === "" && numberOfCs >= Constants.userJourney.tagsVisibleAt) || $featureSwitchIsTesting || $featureSwitchIsDebugging}
<span class="flex justify-between flex-wrap"> <span class="flex justify-between flex-wrap">
<TagHint {state} tags={selectedTags}></TagHint> <TagHint {state} tags={selectedTags} currentProperties={$tags}></TagHint>
<span class="flex flex-wrap"> <span class="flex flex-wrap">
{#if $featureSwitchIsTesting} {#if $featureSwitchIsTesting}
Testmode &nbsp; Testmode &nbsp;