Skip to content

Replace Leaflet map tab with grouped locations panel - #119

Merged
potemkin666 merged 5 commits into
mainfrom
copilot/remove-leaflet-map
May 2, 2026
Merged

Replace Leaflet map tab with grouped locations panel#119
potemkin666 merged 5 commits into
mainfrom
copilot/remove-leaflet-map

Conversation

Copilot AI commented May 2, 2026

Copy link
Copy Markdown
Contributor

This change removes the Leaflet-based map experience entirely and replaces it with a lightweight locations view. The tab keeps the existing London / World / Near me modes, but now renders grouped location intelligence instead of an interactive slippy map.

  • UI replacement

    • Renames the map tab presentation to a locations-oriented experience.
    • Replaces the Leaflet mount point with a rendered locations panel shell in /index.html.
    • Updates copy and empty states to match the non-map workflow.
  • Rendering model

    • Reworks /shared/map-watch.mjs from Leaflet asset/bootstrap logic into a pure renderer for:
      • grouped locations
      • severity rollups
      • summary chips
      • direct openDetail actions
    • Preserves mode behavior:
      • World groups by country
      • London / Near me group by local area
      • Near me still reflects geolocation availability and radius context
  • Asset/runtime removal

    • Deletes vendored Leaflet JS/CSS and removes HTML references to those assets.
    • Simplifies CSP/image dependencies now that external tile imagery is no longer used.
    • Keeps existing tab/mode wiring intact so the rest of the app flow does not change.
  • Styling

    • Replaces map/tile/popup-specific styles with locations panel styles for:
      • summary chips
      • grouped sections
      • per-alert action rows
      • responsive stacked layouts
    • Removes Leaflet-specific visual and control styling.
  • Test coverage

    • Removes tests tied to Leaflet popups/assets.
    • Adds coverage for:
      • country normalization
      • grouping behavior by mode
      • nearby-mode summaries
      • rendered detail-action markup
    • Retains nearby distance/filtering assertions, updated for the new non-Leaflet semantics.

Example of the new rendering shape:

const groups = buildLocationGroups(alerts, MAP_VIEW_MODES.world);

mapElement.innerHTML = renderLocationsMarkup({
  alerts,
  groups,
  state,
  mode: MAP_VIEW_MODES.world
});

Copilot AI and others added 3 commits May 2, 2026 08:42
Agent-Logs-Url: https://github.com/potemkin666/AlbertAlert/sessions/c41dfd9b-638a-42ed-a740-0645eb9fa650

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/AlbertAlert/sessions/c41dfd9b-638a-42ed-a740-0645eb9fa650

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/AlbertAlert/sessions/c41dfd9b-638a-42ed-a740-0645eb9fa650

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
@potemkin666
potemkin666 marked this pull request as ready for review May 2, 2026 19:20
Copilot AI review requested due to automatic review settings May 2, 2026 19:20
@potemkin666

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

Agent-Logs-Url: https://github.com/potemkin666/AlbertAlert/sessions/b254742b-d035-43b2-9f66-6c21d9745e11

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the Leaflet-based map implementation and repurposes the existing map tab into a lightweight grouped locations panel, keeping the existing London / World / Near me mode wiring while changing the rendering model underneath.

Changes:

  • Replaces Leaflet-driven map rendering with grouped location markup generated in shared/map-watch.mjs.
  • Updates the app shell and styles to present the tab as a locations panel instead of an interactive map.
  • Removes Leaflet assets/tests and adds focused tests for grouping, summaries, and rendered detail actions.

Reviewed changes

Copilot reviewed 13 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/nearby-map-mode.test.mjs Renames nearby-radius test copy to match the non-Leaflet implementation.
tests/map-popup-accessibility.test.mjs Removes popup-specific accessibility tests tied to deleted Leaflet UI.
tests/map-improvements.test.mjs Removes legacy Leaflet/map behavior tests that no longer apply.
tests/location-panel.test.mjs Adds tests for country normalization, grouping, summaries, and locations markup.
tests/leaflet-sri.test.mjs Reworks asset tests to assert Leaflet references/assets are gone.
styles.css Replaces map/popup/tile styling with grouped locations panel styling.
source-quarantine.html Updates generated quarantine dashboard metadata snapshot.
shared/map-watch.mjs Replaces Leaflet controller logic with grouped locations rendering/controller behavior.
index.html Renames map UI copy to Locations and swaps the Leaflet mount for the new panel shell.
data/top-20-source-remediation.json Updates generated remediation snapshot data.
data/source-remediation-sweep.json Updates generated remediation sweep snapshot data.
assets/vendor/leaflet/leaflet.js Removes vendored Leaflet runtime asset.
assets/vendor/leaflet/leaflet.css Removes vendored Leaflet stylesheet asset.
assets/vendor/leaflet/LICENSE Removes vendored Leaflet license file alongside asset removal.
app/boot/elements.mjs Points bootstrapped map element lookup at the new locations panel container.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread shared/map-watch.mjs
currentAlerts = alerts;
if (mapStatusLine) mapStatusLine.textContent = statusLine(mode, alerts.length, hasUserLocation);
if (mapEmptyState) mapEmptyState.classList.toggle('hidden', alerts.length > 0);
mapElement.innerHTML = alerts.length > 0 ? renderLocationsMarkup({ alerts, groups, state, mode }) : '';
Comment thread shared/map-watch.mjs
Comment on lines +189 to +203
const preview = group.alerts.slice(0, GROUP_PREVIEW_LIMIT).map(renderAlertButton).join('');
const remaining = group.alerts.length - GROUP_PREVIEW_LIMIT;

function setupPopupAccessibility(popupElement, marker, map) {
if (!popupElement) return;
const focusableElements = popupElement.querySelectorAll(FOCUSABLE_SELECTOR);
const firstFocusable = focusableElements[0];
if (firstFocusable) firstFocusable.focus();
return `
<article class="location-group" data-severity="${escapeHtml(group.severity)}">
<div class="location-group-header">
<div>
<p class="location-group-kicker">${escapeHtml(group.kicker)}</p>
<h4>${escapeHtml(group.label)}</h4>
<p class="location-group-meta">${escapeHtml(countLabel(group.alerts.length))} • Highest ${escapeHtml(severityLabel(group.severity))}</p>
</div>
<span class="location-group-count">${group.alerts.length}</span>
</div>
<div class="location-group-list">${preview}</div>
${remaining > 0 ? `<p class="location-group-more">+${remaining} more alerts in this area</p>` : ''}
Comment thread shared/map-watch.mjs
Comment on lines +215 to +218
<section class="locations-panel" aria-label="Locations overview">
<p class="panel-copy locations-intro">${escapeHtml(intro)}</p>
<div class="locations-summary">${renderSummaryItems(buildSummaryItems(alerts, groups, state, mode))}</div>
<div class="locations-groups" role="list">${groups.map(renderGroup).join('')}</div>
Comment thread source-quarantine.html
Comment on lines +272 to +278
<span class="pill">Generated: 2026-05-02T19:15:49.792Z</span>
<span class="pill">Low-health sources: 205</span>
<span class="pill suggest">Pending suggestions: 0</span>
<span class="pill">SLA: deprioritised, auto-recheck 24h+</span>
<span class="pill warn">New this week: 202</span>
<span class="pill">Avg health score: 1/100</span>
<span class="pill">Avg time in quarantine: 25h</span>
<span class="pill">Avg time in quarantine: 37h</span>
Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>

Copilot AI commented May 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved in 58aa0ca with a true merge commit from origin/main, so the PR now includes the base branch history and the generated feed/catalog conflicts are cleared.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13b465dcfc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shared/map-watch.mjs
Comment on lines +139 to +143
.sort((left, right) => {
if (right.alerts.length !== left.alerts.length) return right.alerts.length - left.alerts.length;
const severityDelta = SEVERITY_RANK[right.severity] - SEVERITY_RANK[left.severity];
if (severityDelta !== 0) return severityDelta;
return left.label.localeCompare(right.label);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Sort nearby groups by distance from the user

In MAP_VIEW_MODES.nearby, groups are still ordered by alert count and severity, not proximity, so a farther location with more/severer alerts can appear before a closer one. This breaks the nearby-mode behavior described in the panel copy (“Surface the closest places first”) and makes the “Near me” tab unreliable for quick local triage when multiple areas are within radius.

Useful? React with 👍 / 👎.

Comment thread shared/map-watch.mjs
Comment on lines +189 to +190
const preview = group.alerts.slice(0, GROUP_PREVIEW_LIMIT).map(renderAlertButton).join('');
const remaining = group.alerts.length - GROUP_PREVIEW_LIMIT;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Render all alerts in each location group

Each group only renders the first three alerts (slice(0, GROUP_PREVIEW_LIMIT)), and the remaining alerts are shown as plain text (“+N more”) without any openDetail action. In groups with more than three alerts, users cannot open those additional incidents from the Locations tab, which is a functional regression from the prior map behavior where every visible alert was actionable.

Useful? React with 👍 / 👎.

Copilot AI requested a review from potemkin666 May 2, 2026 19:25
@potemkin666
potemkin666 merged commit 60b68ab into main May 2, 2026
1 check passed
@potemkin666
potemkin666 deleted the copilot/remove-leaflet-map branch May 2, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants