feat(notifications): new match format with Gmaps + lazyflat deep-link

New Telegram match layout:
  Karl-Ziegler-Straße 7           (linked → Google Maps)
  12489 Treptow-Köpenick
  Miete: 944.12 (18.51 €/m²)
  Fläche: 51.0
  Zimmer: 2.0
  WBS: nicht erforderlich

  Zur original Anzeige            (→ flat URL)
  Zur lazyflat Seite              (→ /?flat=<id>)

Deep-link behavior on lazyflat: ?flat=<id> expands the matching row,
scrolls it into view, and pulses a yellow highlight for 3s. The query
param is stripped from history afterwards so reload stays clean.
Unknown flat IDs drop the param silently.

Helpers: _address_lines splits the scraper's "Street, PLZ, District"
into two display lines; _gmaps_url falls back to a maps.google query
when the payload has no explicit link; _wbs_label normalises the
German WBS variants to "erforderlich" / "nicht erforderlich".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
EiSiMo 2026-04-23 10:28:04 +02:00
parent 77246d1381
commit 81d6b65eae
3 changed files with 108 additions and 7 deletions

View file

@ -95,3 +95,36 @@ document.addEventListener("click", (ev) => {
pane.innerHTML = '<div class="px-4 py-5 text-sm text-slate-500">Detail konnte nicht geladen werden.</div>';
});
});
// Deep-link landing: ?flat=<id> on first load expands + highlights that row.
// Used from Telegram match notifications so "Zur lazyflat Seite" jumps
// straight to the relevant card.
function openDeepLinkedFlat() {
const params = new URLSearchParams(location.search);
const targetId = params.get("flat");
if (!targetId) return;
let found = null;
for (const btn of document.querySelectorAll(".flat-expand-btn")) {
if (btn.dataset.flatId === targetId) { found = btn; break; }
}
if (!found) {
// Flat not in the visible list (filter/age/rejected). Drop the param so
// a reload doesn't keep failing silently.
params.delete("flat");
const qs = params.toString();
history.replaceState(null, "", location.pathname + (qs ? "?" + qs : "") + location.hash);
return;
}
const row = found.closest(".flat-row");
if (!found.classList.contains("open")) found.click();
if (row) {
row.scrollIntoView({ behavior: "smooth", block: "center" });
row.classList.add("flat-highlight");
setTimeout(() => row.classList.remove("flat-highlight"), 3000);
}
params.delete("flat");
const qs = params.toString();
history.replaceState(null, "", location.pathname + (qs ? "?" + qs : "") + location.hash);
}
document.addEventListener("DOMContentLoaded", openDeepLinkedFlat);