From 9473f1cc7d5837640272fe9b07df4f339375f647 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 9 Jan 2023 20:56:39 +0100 Subject: [PATCH] Hide the newly-created banner after a while (only on reload though), fix #1227 --- UI/BigComponents/SimpleAddUI.ts | 2 +- UI/Popup/FeatureInfoBox.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/UI/BigComponents/SimpleAddUI.ts b/UI/BigComponents/SimpleAddUI.ts index 8ce8be8d1d..b9dbcbb5b1 100644 --- a/UI/BigComponents/SimpleAddUI.ts +++ b/UI/BigComponents/SimpleAddUI.ts @@ -100,7 +100,7 @@ export default class SimpleAddUI extends LoginToggle { location: { lat: number; lon: number }, snapOntoWay?: OsmWay ): Promise { - tags.push(Tag.newlyCreated) + tags.push(new Tag(Tag.newlyCreated.key, new Date().toISOString())) const newElementAction = new CreateNewNodeAction(tags, location.lat, location.lon, { theme: state.layoutToUse?.id ?? "unkown", changeType: "create", diff --git a/UI/Popup/FeatureInfoBox.ts b/UI/Popup/FeatureInfoBox.ts index 306ba121d6..45be26ad1b 100644 --- a/UI/Popup/FeatureInfoBox.ts +++ b/UI/Popup/FeatureInfoBox.ts @@ -124,9 +124,15 @@ export default class FeatureInfoBox extends ScrollableFullScreen { tags .map((data) => data[Tag.newlyCreated.key]) .map((isCreated) => { - if (isCreated !== Tag.newlyCreated.value) { + if (isCreated === undefined) { return undefined } + const createdDate = new Date(isCreated) + const secondsSinceCreation = (Date.now() - createdDate.getTime()) / 1000 + if (secondsSinceCreation >= 60 * 5) { + return undefined + } + const els = [] const thanks = new Combine([ Svg.party_svg().SetClass(