fixed portals

This commit is contained in:
erik 2025-06-24 19:13:31 +00:00
parent dffd295091
commit 7ff94b59a8
4 changed files with 475 additions and 134 deletions

View file

@ -480,8 +480,8 @@ async function fetchPortalData() {
}
const data = await response.json();
portalData = data.portals; // [{character_name, portal_name, ns, ew, z}]
console.log(`Loaded ${portalData.length} portal discoveries from last 24 hours`);
portalData = data.portals; // [{portal_name, coordinates: {ns, ew, z}, discovered_by, discovered_at}]
console.log(`Loaded ${portalData.length} portals from last hour`);
renderPortals();
} catch (err) {
console.error('Failed to fetch portal data:', err);
@ -526,9 +526,9 @@ function renderPortals() {
clearPortals();
for (const portal of portalData) {
// Coordinates are already floats from the API
const ns = portal.ns;
const ew = portal.ew;
// Extract coordinates from new API format
const ns = portal.coordinates.ns;
const ew = portal.coordinates.ew;
// Convert to pixel coordinates
const { x, y } = worldToPx(ew, ns);
@ -538,7 +538,7 @@ function renderPortals() {
icon.className = 'portal-icon';
icon.style.left = `${x}px`;
icon.style.top = `${y}px`;
icon.title = `${portal.portal_name} (discovered by ${portal.character_name})`;
icon.title = `${portal.portal_name} (discovered by ${portal.discovered_by})`;
portalContainer.appendChild(icon);
}