Commit graph

84 commits

Author SHA1 Message Date
7ec87f0945 feat(themes): add Clean theme — Google Maps-inspired style
Add a plain, utilitarian theme focused on readability and wayfinding:
- White/light gray land (#f5f5f5), soft pastel green parks (#c3ecb2)
- Gentle blue water (#aadaff) with classic road hierarchy
- White minor roads, yellow primary (#fbc02d), orange motorway (#f9a825)
- Pure white UI panels with Google-standard gray text
- All 73 protomaps flavor keys + pois + landcover objects
- Full UI CSS custom properties using Google color palette
- Overlay config for hillshade, contours, public lands, trails

Update theme switcher to cycle through all available themes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-01 16:27:08 +00:00
f0acea33a0 feat(themes): consolidate UI CSS properties into theme registry
- Add darkUI and lightUI objects with all 25 CSS custom properties
- Add applyThemeUI() function to apply CSS vars via JavaScript
- Update useTheme.js to call applyThemeUI() instead of setAttribute
- Remove [data-theme="dark"] and [data-theme="light"] from index.css
- Custom themes can now override individual UI properties with cascade
- Update README.md to document the ui key and cascade behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-01 16:17:26 +00:00
9530fbbf76 Wire overlay layers to read styling from theme registry
All overlay layer add functions now read colors, opacities, and widths
from the theme registry instead of hardcoded dark/light branches.

registry.js changes:
- Add complete darkOverlay and lightOverlay config objects
- Each overlay layer has its own config section:
  - hillshade: exaggeration, illuminationDirection, shadowColor, highlightColor
  - traffic: opacity
  - contours: colors, opacities, widths (with opacityMod), label styling
  - contoursTest: cascades from contours, overrides colors
  - contoursTest10ft: cascades from contours, overrides colors
  - publicLands: per-category fill/outline colors and opacities, labels
  - usfsTrails: roads/trails colors by use type, labels
  - blmTrails: route colors by use class, labels
- Add getOverlayConfig(themeId, layerKey) function
- Contour variants cascade missing keys from same theme's contours
- Width values use self-documenting object format: { z11: 0.5, z14: 1.0 }

MapView.jsx changes:
- All 8 overlay add functions now take themeId parameter
- Functions call getOverlayConfig() to get merged config
- No hardcoded color/opacity/width values remain in overlay functions
- Theme switching re-adds all active overlays with new theme config

This is a refactor - light and dark themes render identically to before.
Custom themes can now override individual overlay styling values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-01 15:48:12 +00:00
c701463283 Add theme registry for custom protomaps flavor support
Introduces src/themes/registry.js with:
- getTheme(id) - lookup theme config by ID
- getThemeColors(id) - get flavor object (namedTheme for built-ins, custom colors for others)
- getThemeSprite(id) - get sprite URL with fallback for custom themes
- themeList() - list available themes for UI

Updates MapView.jsx:
- Import registry functions instead of namedTheme directly
- buildStyle() uses getThemeColors() and getThemeSprite()
- Overlay add functions use isCurrentThemeDark() helper that checks
  registry dark flag instead of string comparison

Reference files:
- dark-flavor-reference.json - full namedTheme('dark') output (73 flat keys + pois + landcover)
- light-flavor-reference.json - full namedTheme('light') output
- README.md - schema documentation for creating custom themes

This is a refactor only - light/dark themes render identically to before.
Custom themes can now be added to registry.js with full flavor objects.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-01 15:27:01 +00:00
a39371a7a0 Use more distinct colors for trail types
- 4WD High Clearance: bright orange
- 4WD Low: yellow/gold (was tan)
- ATV: red (was rust)
- Single Track: purple (was dark red)
- 2WD/Easy: light yellow (was light tan)
- Non-motorized: brighter green
- Snow: blue (unchanged)

Colors now spread across spectrum for easier distinction.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 21:34:06 +00:00
9ae1594a4c Brighten and unify USFS/BLM trail styling
- Increase opacity to 0.9 for better visibility
- Thicker lines (2.0 -> 4.0px across zoom levels)
- Unified brighter color palette:
  - Orange: motorized/4WD high clearance
  - Amber/tan: 4WD low, bikes
  - Rust: ATV
  - Green: non-motorized (hiking/horse)
  - Blue: snow routes
- USFS trails now color-coded by allowed use
- Larger label text (11px) with better contrast

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 21:29:55 +00:00
c4750c94ba Filter BLM: exclude urban types, keep unknown/resource
- Exclude ARTERIAL, COLLECTOR, LOCAL, paved, highways
- Keep RESOURCE, UNKNOWN, and empty functional class
- Most BLM data has empty func class, so whitelist was too strict

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 21:09:16 +00:00
6aeaedbcc0 Filter BLM layer to RESOURCE class only
- Only show routes with RESOURCE functional class
- Removes all urban, local, and unknown roads
- Keeps backcountry access routes only

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 21:06:36 +00:00
f788aefae6 Filter out urban roads from BLM layer
- Exclude ARTERIAL and COLLECTOR functional classes
- Exclude any route with HWY_CLASS (highways)
- Keeps RESOURCE, LOCAL, and UNKNOWN in rural areas

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 20:58:58 +00:00
e2d5ca9718 Style BLM routes by surface type and vehicle class
- Filter out SOLID SURFACE (paved roads)
- Color by route use class:
  - Orange: 4WD High Clearance
  - Tan: 4WD Low
  - Red-brown: ATV
  - Dark red: Motorized Single Track
  - Light tan: 2WD Low
  - Green: Non-Mechanized
- Line pattern by surface type:
  - Solid: Natural (dirt)
  - Dashed: Natural Improved (graded)
  - Dotted: Aggregate (gravel)
  - Dash-dot: Snow
  - Dash-dot-dot: Other/Unknown
- Snow routes use distinct blue color

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 20:53:38 +00:00
efebf74522 Add BLM roads/trails layer
- Add BLM routes vector source from pmtiles
- Style: dashed olive/sage lines, distinct from USFS
- Labels at zoom 12+ using ROUTE_PRMRY_NM
- Hit-area layer (14px) for click targets
- Popup showing route name, asset class, transport, surface, length
- "BLM Roads" toggle in Layer Control panel
- Feature-flag gated: has_blm_trails (default false)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 20:40:44 +00:00
e1d56ff925 feat(map): add invisible hit-area layers for USFS trails/roads
- Add 14px wide transparent hit layers below visible styled layers
- Click events now target hit layers for easier selection
- Cursor changes to pointer on hover over hit layers
- Keeps visual styling thin while providing fat click targets

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 17:30:39 +00:00
2b90f8b17a feat(map): add USFS trails and roads layer
- Add USFS trails/roads as toggleable map layer via PMTiles
- Trails: dashed brown lines, roads: solid khaki lines
- Labels at zoom 12+ for trail and road names
- Click handler shows popup with trail/road info
- Feature-flag gated with has_usfs_trails (default false)
- Add Trails toggle to Layer Control panel

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 16:43:30 +00:00
e53ff561e8 feat(keyboard): add Escape key to close/deselect place card
Pressing Escape when a place is selected now:
- Closes the place card
- Clears the selected place state
- Removes the boundary outline from the map
- Clears the selected label highlight

Same behavior as clicking empty map area.
2026-04-30 03:41:22 +00:00
a1a499de07 style(labels): improve label readability with Google Maps-style halos
Apply solid opaque halos to interactive label layers for clean knockout
against any background (parks, water, terrain):

BASE (unhighlighted):
- Text: #2a2a2a (light) / #e0e0e0 (dark)
- Halo: solid white/black, 0.9 opacity, 1.8px width
- Acts as background knockout, not decoration

HOVER:
- Text: pure black/white for focus
- Halo: full opacity (1.0), 2px width
- Subtle emphasis without glowing effect

SELECTED:
- Text: accent color (theme green)
- Halo: solid white/black, full opacity, 2.2px width
- Clear visual distinction for clicked item

Key insight: halo is a readability tool, not visual effect.
Keep it tight, opaque, and matching background intent.
2026-04-30 03:37:04 +00:00
5010b45a7c fix(highlight): use data-driven expressions to target specific features
Instead of changing entire layer paint properties (which highlights all
labels in the layer), use MapLibre case expressions to target only the
specific feature by name. This prevents highlighting ALL labels when
hovering/selecting one.

Expression format:
  ["case", ["==", ["get", "name"], featureName], highlightColor, originalColor]

Fixes text duplication at z14+ on small places.
2026-04-30 03:07:43 +00:00
39996fdafe fix(map): boundary fill opacity and highlight text duplication
Two fixes for rendering at close zoom (z14+):

1. Boundary rendering:
   - Add subtle fill layer with 0.05 opacity (barely visible tint)
   - Insert fill and outline layers BELOW symbol layers using
     firstSymbolId so labels render on top
   - Dashed outline remains primary indicator

2. Highlight text duplication:
   - Remove separate hover-hl-* and selected-hl-* symbol layers
     that were creating duplicate/ghost text
   - Instead, modify ORIGINAL layer paint properties directly using
     setPaintProperty on text-color, text-halo-color, text-halo-width
   - Store original paint values for restoration on clear
   - Single symbol layer per label = no duplication

Test at z14+ on small places like Rock Creek Park - no text ghosting.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 03:03:18 +00:00
68f0a8dff7 fix(map): atomic boundary transition when switching places
Remove the clear-then-set pattern when clicking a new labeled feature.
Previously, clicking Kimberly after Twin Falls would:
1. Clear Twin Falls boundary
2. Set new place
3. Wait for API to return
4. Set Kimberly boundary

This caused the old boundary to disappear before the new one was ready,
requiring two clicks.

Now when clicking a new labeled feature:
1. Set new place immediately
2. When API returns, updateBoundary(newData) replaces old data in-place

The GeoJSON source only holds one dataset - setting new data naturally
replaces old data. Explicit clear only needed when deselecting or
clicking empty map.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-30 01:43:19 +00:00
ac7cec972f fix(map): call updateBoundary directly, remove useEffect
The useEffect-based boundary rendering was unreliable due to React's
state lifecycle - the effect would fire before boundary data arrived
from the API, then not re-trigger properly when data was populated.

New approach:
- Remove the boundary useEffect entirely
- Define updateBoundary function in map load handler
- Store function reference in Zustand store and local ref
- PlaceCard calls updateBoundary(geometry) directly when API returns
- Click handlers call updateBoundary(null) to clear

This bypasses React's render cycle - the map library handles its own
state and we tell it what to draw when we have the data.

Test sequence:
- Click Twin Falls → boundary shows on first click
- Click Kimberly → boundary shows on first click
- Switch between them → old clears, new shows
- Click empty map → boundary clears

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-29 23:23:11 +00:00
b657c0f000 fix(map): re-trigger boundary render when API data arrives
The boundary useEffect was only triggered when selectedPlace changed,
but boundary data arrives asynchronously from /api/place fetch. By the
time fetchPlaceDetails completed and enriched selectedPlace with
boundary, the useEffect had already fired and saw no boundary.

Fix: add selectedPlace?.boundary to the dependency array so the effect
re-runs when boundary data is populated by the API response.

Test sequence:
- Click Twin Falls → boundary shows on first click
- Click Kimberly → boundary shows on first click (was broken)
- Click empty map → boundary clears
- Click Twin Falls again → boundary shows on first click

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-29 23:12:37 +00:00
29f995d885 fix(map): boundary lifecycle cleanup on place deselection
Clear boundary source data when:
- Clicking outside the marker circle (deselecting)
- Clicking a new place (before setting new boundary)
- Clicking empty map area (generic map click)

This ensures:
1. Re-clicking the same city after dismissing re-renders boundary
   (selectedPlace is properly cleared, triggering fresh useEffect)
2. Clicking away doesn't leave stale boundary outline
   (boundary source explicitly cleared to empty FeatureCollection)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-29 23:07:41 +00:00
472ef4d0e8 fix(map): resolve initialization crashes and boundary rendering
Fixes three critical bugs:

1. CRASH: Guard addSource/addLayer calls with existence checks to
   prevent "Source already exists" errors in React strict mode
   double-mount scenarios

2. BOUNDARY: Wrap boundary update logic in a function and properly
   handle async style loading - check isStyleLoaded() and use
   map.once('load') as fallback

3. FONTS: Use 'Noto Sans Regular' for highlight layers instead of
   'Noto Sans Medium'/'Noto Sans Bold' which 404 on protomaps CDN

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-29 22:47:24 +00:00
4edc453835 fix(map): use filter-based highlights for PMTiles compatibility
Replace feature-state based highlighting with filter-based approach
using dedicated highlight layers. PMTiles don't have feature IDs,
causing setFeatureState to silently fail. The new approach:

- Creates hover-hl-* and selected-hl-* layers per source-layer
- Uses EMPTY_FILTER to hide layers by default
- Updates filter to match feature name when highlighting
- Preserves all existing functionality (zoom, boundary, place card)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-29 22:33:13 +00:00
b381d8d97f feat(map): add hover and click highlight for interactive features
- Add visual hover feedback on map labels (cities, POIs, regions)
  using MapLibre feature-state paint property expressions
- Hover: cursor pointer + brighter text + subtle halo glow
- Click highlight: accent color text + accent glow halo
- Highlight persists until place card closed or different feature clicked
- Remove DOM overlay marker for feature mode (use native paint instead)
- Consolidate interactive layers into INTERACTIVE_LAYERS constant
- Re-apply styles on theme change

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-29 21:46:35 +00:00
85a4e71def Redesign wiki links in place card
- Remove redundant "Read more (local)" links from WikiSummarySection
- Summary text now stands alone with population info
- LINKS section now shows Wikipedia/Wikivoyage/Wikidata with brand icons
- Use simple monochrome SVG icons for each wiki service
- Wikipedia and Wikivoyage show (local) indicator when served from Kiwix
- Falls back to wikipedia.org when wiki_url is not available

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-29 19:19:19 +00:00
bc8db10101 Use local wiki_url in LINKS section when available
When wiki_url is present from the API (has_kiwix_wiki enabled with local
coverage), use it instead of building a wikipedia.org link. Shows article
name with (local) indicator consistent with the Read More link.

Also adds wikivoyage_url link when available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-29 19:03:08 +00:00
Ubuntu
497a671504 fix(place): add reverse geocode fallback for place details
When a place is selected without osm_type/osm_id (e.g., clicking
on a basemap label), trigger a reverse geocode to obtain the OSM
identifiers. This enables fetching place details including boundary,
wiki_summary, and other enriched data.

The existing placeDetails useEffect will then fire once the
osm_type/osm_id are available in the selectedPlace.raw object.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-29 18:32:41 +00:00
Ubuntu
e42ed06a5c feat(place): add wiki summary display from Kiwix
When place API response includes wiki_summary, display:
- Summary text in PlaceCard and PlaceDetail
- Population with Users icon if wiki_population present
- "Read more" link to wiki_url (local Kiwix article)
- "Travel guide" link if wikivoyage_url present
- (local) indicator on wiki links to signal Kiwix-served content

Gate on has_kiwix_wiki feature flag - no changes when disabled
or when wiki_summary not present in response.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-29 17:11:09 +00:00
cb7c6d1497 fix: Save wedge highlights when authenticated 2026-04-29 00:08:08 +00:00
a1f929e10a fix: measure tool — multi-point with segment distances and running total 2026-04-28 23:41:09 +00:00
30bfd72642 feat: add three-dot actions menu to contact cards 2026-04-28 23:34:46 +00:00
99bd2218a4 feat: geocode search + map pick for contact location 2026-04-28 23:05:28 +00:00
a7519a3aab feat: add editable address field and location display to contacts 2026-04-28 22:57:30 +00:00
1f448b273f feat: wire radial menu — directions, add stop, save, measure distance 2026-04-28 22:39:42 +00:00
0ba8911100 Fix button wrapping and add scale bar control
- Add whiteSpace: nowrap to Get Directions button to prevent text wrap
- Add ScaleControl (imperial units) to bottom-right of map
- Add dark theme styling for scale bar

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-28 22:06:35 +00:00
1afd12f1b0 fix: restore Get Directions text, fix button sizing, filter raw category labels 2026-04-27 15:58:17 +00:00
31d1ef07dd fix: normalize action button sizing, hide generic Poi subtitle 2026-04-27 14:12:23 +00:00
0c5f9f47d0 fix: restore RadialMenu — incorrectly disabled 2026-04-27 06:15:26 +00:00
6bf8717803 fix: route polyline on first route — use idle event instead of load
The load event only fires once during map init. When route state
changes before style is fully loaded, the once(load) handler
never executes because load already fired. idle fires after every
render cycle, ensuring the route draws once the style is ready.
2026-04-27 05:01:39 +00:00
53d25dafd8 fix: final cleanup — disable radial menu, document auth pattern
B14: Comment out RadialMenu render — all 5 wedges show "coming soon"
     toasts with no functional actions. Code preserved for when
     actions are wired.

B5:  Add detailed JSDoc to fetchAuthState explaining the
     redirect:manual pattern and its dependencies on Caddy/Authentik
     configuration.

B9:  Investigated — user-select CSS errors come from MapLibre's own
     maplibre-gl.css, not our code. WONTFIX (library issue).

Caddy changes (CT 101):
B6:  Fixed recon.echo6.co header stripping bug — same pattern as navi
B8:  Added /api/traffic/* to @authed_user (TomTom API must be authed)
2026-04-27 04:11:34 +00:00
821b6e03b1 fix: use direct Authentik invalidation flow for logout
The /outpost.goauthentik.io/sign_out path returns 404 on the
Authentik server - it is not a real endpoint. Changed logout
to redirect directly to auth.echo6.co/if/flow/default-invalidation-flow
with a next= param to return to navi.echo6.co after logout.
2026-04-27 03:55:48 +00:00
fe77c6d459 fix: route polyline visibility + login URL
B1: Add ResizeObserver to MapView.jsx to handle layout settling.
The map canvas had 0 height at init because layout hadnt settled
when the useEffect fired. ResizeObserver calls map.resize() on
any container size change.

B11: Use native outpost start URL for login initiation:
/outpost.goauthentik.io/start?rd=%2F
This properly triggers auth flow and redirects to / after login.
Removed the Caddy /login handler that wasnt redirecting correctly.
2026-04-27 03:51:34 +00:00
77340a9fbc fix: use /login endpoint for auth initiation instead of /api/auth/whoami
The /api/auth/whoami endpoint returns JSON after auth, leaving
users on a raw JSON page. The new /login endpoint triggers
forward_auth and redirects to / after successful auth.
2026-04-27 03:01:23 +00:00
bc6296415c chore: add *.bak* to .gitignore 2026-04-27 02:50:54 +00:00
482a7557cf config: disable 10ft contour test layer in fallback 2026-04-27 02:50:53 +00:00
a40f68fa26 fix: resolve 5 confirmed bugs from code review
- MapView.jsx: extract addBoundaryLayer function, use getComputedStyle
  for accent color (MapLibre rejects CSS vars in paint properties)
- PlaceCard.jsx: gate fetchNearbyContacts on auth.authenticated
- PlaceDetail.jsx: gate fetchNearbyContacts on auth.authenticated
- api.js: replace invalid timeout option with AbortSignal.timeout()
- RadialMenu.jsx: remove user-select from SVG style (Firefox rejects)
- Panel.jsx: add Cancel button for pending directions state
2026-04-27 02:50:46 +00:00
0d4a807a05 feat: add auth-state awareness and graceful degradation
- Add /api/auth/whoami endpoint check on app load
- Store auth state in Zustand (authenticated, username, loaded)
- Hide Contacts tab when unauthenticated
- Gate fetchNearbyContacts calls on auth.authenticated
- Replace Save button with Log in affordance when unauthenticated
- Add Login/Logout buttons to panel header
- Prevent any /api/contacts/* requests from firing when unauthenticated

Public functionality (search, routing, place details) remains
fully functional for unauthenticated users.
2026-04-27 01:32:00 +00:00
616d01623d fix: show pendingDestination as visible card when Get Directions clicked
When GPS is denied and user clicks Get Directions, StopList now shows:
- Empty origin slot (A) with dashed border and "Search for a starting point" prompt
- Destination slot (B) showing the place name from pendingDestination

Previously only showed small grey text, making it feel like the UI
showed "nothing" after the place card disappeared.
2026-04-27 00:34:27 +00:00
ed81b4e186 fix: directions card visible when pendingDestination set with no stops
Symptom: clicking Get Directions with GPS denied closed the place card
and showed empty map. User had no UI to pick an origin.

Root cause: commit 9db8cec correctly stopped adding destination to
stops (fixing duplicate), but Panel.jsx only rendered StopList when
panelState was ROUTING/CALCULATED. With pendingDestination set but
stops empty, panelState was IDLE and StopList never mounted.

Fix: showRouteSection is now true when pendingDestination is truthy,
regardless of panelState. showEmptyState is false when pendingDestination
is set. StopList renders and displays its "Search for a starting point"
prompt.
2026-04-26 23:38:42 +00:00
60effce679 fix: search geocode now includes viewport bias in API requests
Symptom: HAR capture showed /api/geocode requests with NO lat/lon/zoom
params despite map being centered on Twin Falls. Results returned
out-of-state addresses (Illinois, Iowa, Arkansas).

Root cause: SearchBar subscribed to mapCenter via React hook, but the
value was stale at search time due to render timing.

Fix: api.js searchGeocode now reads mapCenter directly from the store
via useStore.getState() at call time. This is the correct pattern for
non-component code. SearchBar no longer passes mapCenter as a param.
2026-04-26 23:38:31 +00:00