From 0ba6c7fc2fad9aa35840cac46f4334723f3c6703 Mon Sep 17 00:00:00 2001 From: secondl1ght Date: Thu, 11 Apr 2024 19:37:50 -0600 Subject: [PATCH] add outdated url query --- src/routes/map/+page.svelte | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/routes/map/+page.svelte b/src/routes/map/+page.svelte index ca63e78..6df0f16 100644 --- a/src/routes/map/+page.svelte +++ b/src/routes/map/+page.svelte @@ -110,6 +110,9 @@ // allow to view map with only legacy nodes const legacy = $page.url.searchParams.has('legacy'); + // allow to view map with only outdated nodes + const outdated = $page.url.searchParams.has('outdated'); + // allow to view map with only boosted locations const boosts = $page.url.searchParams.has('boosts'); @@ -160,6 +163,9 @@ const elementOSM = element['osm_json']; + let verified = verifiedArr(elementOSM); + let upToDate = verified.length && Date.parse(verified[0]) > verifiedDate; + if ( (onchain ? elementOSM.tags && elementOSM.tags['payment:onchain'] === 'yes' : true) && (lightning ? elementOSM.tags && elementOSM.tags['payment:lightning'] === 'yes' : true) && @@ -167,6 +173,7 @@ ? elementOSM.tags && elementOSM.tags['payment:lightning_contactless'] === 'yes' : true) && (legacy ? elementOSM.tags && elementOSM.tags['payment:bitcoin'] === 'yes' : true) && + (outdated ? !upToDate : true) && (boosts ? boosted : true) ) { const lat = latCalc(elementOSM); @@ -187,9 +194,7 @@ element.tags.issues ); - let verified = verifiedArr(elementOSM); - - if (verified.length && Date.parse(verified[0]) > verifiedDate) { + if (upToDate) { upToDateLayer.addLayer(marker); } else { outdatedLayer.addLayer(marker); @@ -231,13 +236,16 @@ map.addLayer(markers); let overlayMaps: MapGroups = { - 'Up-To-Date': upToDateLayer, + ...(!outdated ? { 'Up-To-Date': upToDateLayer } : {}), Outdated: outdatedLayer, Legacy: legacyLayer, 'Third Party App': thirdPartyLayer }; - map.addLayer(upToDateLayer); + if (!outdated) { + map.addLayer(upToDateLayer); + } + map.addLayer(outdatedLayer); map.addLayer(legacyLayer); map.addLayer(thirdPartyLayer);