forked from MapComplete/MapComplete
Hide the newly-created banner after a while (only on reload though), fix #1227
This commit is contained in:
parent
b1f57b7066
commit
9473f1cc7d
2 changed files with 8 additions and 2 deletions
|
@ -100,7 +100,7 @@ export default class SimpleAddUI extends LoginToggle {
|
||||||
location: { lat: number; lon: number },
|
location: { lat: number; lon: number },
|
||||||
snapOntoWay?: OsmWay
|
snapOntoWay?: OsmWay
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
tags.push(Tag.newlyCreated)
|
tags.push(new Tag(Tag.newlyCreated.key, new Date().toISOString()))
|
||||||
const newElementAction = new CreateNewNodeAction(tags, location.lat, location.lon, {
|
const newElementAction = new CreateNewNodeAction(tags, location.lat, location.lon, {
|
||||||
theme: state.layoutToUse?.id ?? "unkown",
|
theme: state.layoutToUse?.id ?? "unkown",
|
||||||
changeType: "create",
|
changeType: "create",
|
||||||
|
|
|
@ -124,9 +124,15 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
|
||||||
tags
|
tags
|
||||||
.map((data) => data[Tag.newlyCreated.key])
|
.map((data) => data[Tag.newlyCreated.key])
|
||||||
.map((isCreated) => {
|
.map((isCreated) => {
|
||||||
if (isCreated !== Tag.newlyCreated.value) {
|
if (isCreated === undefined) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
const createdDate = new Date(isCreated)
|
||||||
|
const secondsSinceCreation = (Date.now() - createdDate.getTime()) / 1000
|
||||||
|
if (secondsSinceCreation >= 60 * 5) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
const els = []
|
const els = []
|
||||||
const thanks = new Combine([
|
const thanks = new Combine([
|
||||||
Svg.party_svg().SetClass(
|
Svg.party_svg().SetClass(
|
||||||
|
|
Loading…
Reference in a new issue