# BW Map Magnet — Session Log

Append-only history of development sessions. Newest entries at the top.

## Format

```
## YYYY-MM-DD HH:MM — <dev name>

**Goal:** What we set out to do
**Done:** What got done
**Left off at:** Where we stopped
**Notes:** Anything worth remembering
```

---

## 2026-05-13 — 0.3.1 (bird redraw + hover fix)

**Goal:** Fix two QA findings — the bird icon was unrecognisable, and filter chip hover was unreadable under the theme.
**Done:**
- Bird icon rewritten as a perched silhouette: rounded oval body + triangular beak pointing right + interior wing arc + eye dot + two legs.
- Filter chip `:hover` was inheriting a dark background from the theme's generic `button:hover` while my CSS only changed text colour, so dark text appeared on a dark background. Fixed by scoping the hover rule under `.bw-mm-wrap` (raising specificity over theme rules), explicitly setting `background: #f8fafc`, and using `:not(.is-active)` so it doesn't compete with the active state. Added active+hover state (`filter: brightness(0.92)`) and `:focus-visible` for keyboard users.
**Notes:**
- The hover-bug was a classic theme-cascade interaction — my CSS assumed the inherited button background was unchanged. Lesson: when adding `:hover` styles to elements that themes often style globally (buttons, links), always set the background explicitly.

## 2026-05-13 — 0.3.0 (import/export + colors + icon redraws)

**Goal:** Add CSV import/export, per-category color, and redraw 7 icons that weren't readable enough.
**Done:**
- New `BW_Map_Magnet_Import_Export` class registered as `Map Magnet → Import / Export`. Export streams a CSV (UTF-8 BOM, fputcsv), uses raw `post_title`/`post_excerpt`/`post_content` so the round-trip is clean (no entitised apostrophes). Import accepts header-row column aliases, auto-creates missing categories, validates lat/lng ranges, reports row-numbered errors. Verified round-trip end-to-end via WP-CLI eval-file test (1 created, 1 updated, 1 rejected for out-of-range lat).
- Added `_bw_map_color` term meta with `sanitize_hex_color` validation. WP native color picker on taxonomy add/edit screens (enqueues `wp-color-picker`).
- Shortcode renderer now writes `--bw-mm-cat-color` CSS custom property on each `.bw-mm-category` section and each `.bw-mm-filter-btn`, plus passes per-item `color` in JSON. Frontend JS sets marker `background` inline.
- CSS rewritten to consume `var(--bw-mm-cat-color, #2563eb)` for chip active/hover, category title underline, item hover border, empty-thumb icon color, and item box-shadow base.
- Active marker styling switched from hard-coded orange to `filter: brightness(0.85) saturate(1.3)` plus scale — stays on-brand with the category color.
- Icon redraws: scuba → tank, fishing → clearer fish, kayak → paddle, spa → leaf with vein, turtle → top-down with flippers, bird → Lucide-style perched, fire → Lucide flame with inner curl.
- Seeder updated to set colors (`#15803d` outdoor, `#c2410c` restaurants) and backfill them on re-seed.
**Left off at:** Ready for browser-side QA — the new icons + colors are best evaluated with eyes on the page.
**Notes:**
- Active-marker styling uses CSS `filter` instead of a fixed accent color. Looks fine in testing but does mean monochromatic active state — could be revisited if a contrasting highlight is wanted.
- CSV column aliases supported: `title/name`, `lat/latitude`, `lng/lon/longitude`, `image/image_url/thumbnail`, `description/body/content`, `summary/excerpt`.
- Category resolution on import: slug match first, then name match, then auto-create. Auto-created categories don't get an icon/color by default — admin must set them after import.

## 2026-05-13 — 0.2.0 (icons + filter + block)

**Goal:** Add T&C-themed category icons, frontend category filter, demo images, and a Gutenberg block.
**Done:**
- New `BW_Map_Magnet_Icons` class with ~25 monoline SVG icons. Library is the single source for both PHP rendering and the JS marker renderer (via wp_localize_script `BwMapMagnetIcons`).
- Per-term icon picker UI on taxonomy add/edit screens. Stores `_bw_map_icon` term meta. Shows in term list column.
- Filter chip bar — single-select with "All" + per-category buttons. Toggles list visibility, adds/removes markers, re-fits bounds.
- New `_bw_map_image_url` post meta + admin field. Frontend prefers it over featured image. Lets the seeder use external URLs without sideloading.
- Gutenberg block `bw-map-magnet/map` — dynamic, render_callback delegates to the existing shortcode renderer. Inspector controls for category, height, focusZoom, filter toggle. ServerSideRender preview in the editor.
- Marker styling rewritten: 32×32 circular badge with category icon in white on brand blue; active marker turns orange and scales 1.35×.
- Seeder upgraded: sets category icons on re-seed and backfills image URLs on existing items. New items get Picsum-seeded photo URLs (unique-consistent per title).
- Bumped to 0.2.0 via bump-version.sh. cleanup/security/test scans all clean.
**Left off at:** Ready for browser-side QA of the filter + block editor.
**Notes:**
- Picsum returns random photos per seed — they won't match the content topically. For real-world T&C deployments, authors will set their own image URLs or featured images.
- The category icons currently render in a fixed brand blue. Future enhancement: per-category color picker.
- Filter is single-select; multi-select can be added later if needed.
- Block editor preview relies on `wp-server-side-render` package — should be available on WP 6.0+.

## 2026-05-13 — initial build

**Goal:** Ship a 0.1.0 with CPT, admin lat/lng picker, hover-to-zoom frontend, and Vancouver Island demo data.
**Done:**
- Scaffolded via tools/new-plugin.sh.
- Added CPT `bw_map_item` + taxonomy `bw_map_category` with REST support.
- Built admin meta box backed by Leaflet picker (click + drag + Nominatim search).
- Built `[bw_map_magnet]` shortcode with hover-to-fly, idle fit-bounds, click-to-pin, keyboard support, mobile-stacked layout.
- Seeded 12 Vancouver Island demo items across two categories.
- Created demo page at /map-magnet-demo/ on bw-plugins.demoing.info — confirmed renders, no PHP errors, Leaflet enqueued, JSON config payload valid.
- cleanup-scan / security-scan / test-plugin all clean (security warnings are accepted false positives — same pattern as bw-lead-ai).
**Left off at:** Ready for browser interaction testing and any polish before 0.1.0 release.
**Notes:**
- Leaflet 1.9.4 loaded from unpkg CDN. Future task: vendor for offline/SRI safety.
- Tile layer is OpenStreetMap. For high-traffic sites consider switching to a paid provider (Mapbox, Stadia) — OSM tile usage policy requests attribution and reasonable load.
- Seeder uses `WP_Query` lookup-by-title (not deprecated `get_page_by_title`) so it's safe on WP 6.2+.
