|
|
@ -459,18 +459,7 @@ export default class DiscoverView extends Vue { |
|
|
|
this.userProfiles = []; |
|
|
|
const plans: PlanData[] = results.data; |
|
|
|
if (plans) { |
|
|
|
for (const plan of plans) { |
|
|
|
const { name, description, handleId, image, issuerDid, rowId } = |
|
|
|
plan; |
|
|
|
this.projects.push({ |
|
|
|
name, |
|
|
|
description, |
|
|
|
handleId, |
|
|
|
image, |
|
|
|
issuerDid, |
|
|
|
rowId, |
|
|
|
}); |
|
|
|
} |
|
|
|
this.projects.push(...plans); |
|
|
|
this.remoteCount = this.projects.length; |
|
|
|
} else { |
|
|
|
throw JSON.stringify(results); |
|
|
@ -562,22 +551,9 @@ export default class DiscoverView extends Vue { |
|
|
|
|
|
|
|
if (this.isProjectsActive) { |
|
|
|
this.userProfiles = []; |
|
|
|
if (results.data) { |
|
|
|
if (beforeId) { |
|
|
|
const plans: PlanData[] = results.data; |
|
|
|
for (const plan of plans) { |
|
|
|
const { name, description, handleId, issuerDid, rowId } = plan; |
|
|
|
this.projects.push({ |
|
|
|
name, |
|
|
|
description, |
|
|
|
handleId, |
|
|
|
issuerDid, |
|
|
|
rowId, |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.projects = results.data; |
|
|
|
} |
|
|
|
if (plans) { |
|
|
|
this.projects.push(...plans); |
|
|
|
this.localCount = this.projects.length; |
|
|
|
} else { |
|
|
|
throw JSON.stringify(results); |
|
|
@ -626,7 +602,7 @@ export default class DiscoverView extends Vue { |
|
|
|
} else if (this.isAnywhereActive) { |
|
|
|
this.searchAll(latestProject.rowId); |
|
|
|
} |
|
|
|
} else if (!this.isProjectsActive && this.userProfiles.length > 0) { |
|
|
|
} else if (this.isPeopleActive && this.userProfiles.length > 0) { |
|
|
|
const latestProfile = this.userProfiles[this.userProfiles.length - 1]; |
|
|
|
if (this.isLocalActive || this.isMappedActive) { |
|
|
|
this.searchLocal(latestProfile.rowId || ""); |
|
|
@ -637,6 +613,11 @@ export default class DiscoverView extends Vue { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
clearMarkers() { |
|
|
|
Object.values(this.markers).forEach((marker) => marker.remove()); |
|
|
|
this.markers = {}; |
|
|
|
} |
|
|
|
|
|
|
|
async onMapReady(map: L.Map) { |
|
|
|
// doing this here instead of the l-map element avoids a recentering after the first drag |
|
|
|
map.setView([this.localCenterLat, this.localCenterLong], 2); |
|
|
@ -662,8 +643,7 @@ export default class DiscoverView extends Vue { |
|
|
|
|
|
|
|
onZoomStart(/* event: L.LocationEvent */) { |
|
|
|
// remove markers because otherwise they jump around at zoom end |
|
|
|
Object.values(this.markers).forEach((marker) => marker.remove()); |
|
|
|
this.markers = {}; |
|
|
|
this.clearMarkers(); |
|
|
|
|
|
|
|
this.zoomedSoDoNotMove = true; |
|
|
|
} |
|
|
@ -686,8 +666,7 @@ export default class DiscoverView extends Vue { |
|
|
|
: this.partnerApiServer + "/api/partner/userProfileCountsByBBox"; |
|
|
|
const response = await fetch(endpoint + "?" + queryParams); |
|
|
|
if (response.status === 200) { |
|
|
|
Object.values(this.markers).forEach((marker) => marker.remove()); |
|
|
|
this.markers = {}; |
|
|
|
this.clearMarkers(); |
|
|
|
const results = await response.json(); |
|
|
|
if (results.data?.tiles?.length > 0) { |
|
|
|
for (const tile: Tile of results.data.tiles) { |
|
|
@ -711,10 +690,22 @@ export default class DiscoverView extends Vue { |
|
|
|
}; |
|
|
|
this.searchLocal(); |
|
|
|
}); |
|
|
|
this.markers["" + tile.indexLat + "X" + tile.indexLon] = marker; |
|
|
|
this.markers[ |
|
|
|
"" + |
|
|
|
tile.indexLat + |
|
|
|
"X" + |
|
|
|
tile.indexLon + |
|
|
|
"_" + |
|
|
|
tile.minFoundLat + |
|
|
|
"X" + |
|
|
|
tile.minFoundLon + |
|
|
|
"-" + |
|
|
|
tile.maxFoundLat + |
|
|
|
"X" + |
|
|
|
tile.maxFoundLon |
|
|
|
] = marker; |
|
|
|
} |
|
|
|
} |
|
|
|
await this.searchLocal(); |
|
|
|
} else { |
|
|
|
throw { |
|
|
|
message: "Got an error loading projects on the map.", |
|
|
|