You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add community picker with address search and welcome dialog to map view
Redesign the map sidebar into a dual-mode panel: a simplified community
picker (normal mode) with address search via LocationSelector, and the
full layer controls (editing mode) for admins. Citizens can search their
address to find nearby collection points within 500m, shown as colored
pins on the map. A welcome dialog presents the regulation summary on
first load with navigation options.
Also: extract shared types (CurrentUser, GeoSetData, SEARCH_COLORS) to
types.ts, deduplicate geometry list item rendering in DetailPanel, add
GeometryCollection support to bounds calculation, improve map labels
(point addresses at zoom, polygon names that fade), and update docs.
Copy file name to clipboardExpand all lines: CLAUDE.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,18 @@
2
2
3
3
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
4
5
+
## Development Environment
6
+
7
+
This project uses [Nix](https://nixos.org/) to manage development dependencies. All shell commands (`npm`, `npx`, `node`, etc.) must be run inside the Nix development shell.
8
+
9
+
**Prefix all commands with `nix develop --command`**, for example:
10
+
```bash
11
+
nix develop --command npm run build
12
+
nix develop --command npx tsc --noEmit
13
+
```
14
+
15
+
If you open an interactive shell session first (`nix develop`), subsequent commands in that session don't need the prefix.
Copy file name to clipboardExpand all lines: docs/guides/consultations.md
+16-12Lines changed: 16 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ The consultation feature operates as a JSON-driven, dual-view interface:
10
10
11
11
1.**Regulation JSON**: Each consultation points to a remote JSON file (`jsonUrl`) that defines the entire regulation structure — chapters, articles, geographic areas, cross-references, and definitions. The schema is defined in [`json-schemas/regulation.schema.json`](../../json-schemas/regulation.schema.json).
12
12
2.**Database Layer**: Prisma stores consultation metadata (name, end date, active status), comments, and upvotes. Comments are entity-scoped — tied to a specific chapter, article, geoset, or geometry by `entityType` + `entityId`.
13
-
3.**Frontend Layer**: A `ConsultationViewer` client component orchestrates two views — a Document View (chapters/articles with markdown content) and a Map View (Mapbox-powered geographic visualization). A floating action button toggles between them.
13
+
3.**Frontend Layer**: A `ConsultationViewer` client component orchestrates two views — a Document View (chapters/articles with markdown content) and a Map View (Mapbox-powered geographic visualization). A floating action button toggles between them. The map view features a community picker with address search, allowing citizens to find nearby collection points by searching their address. A welcome dialog shows the regulation summary on first load.
14
14
4.**Comment System**: Authenticated users can leave HTML-rich comments on any entity. Comments support upvoting and trigger email notifications to the municipality's contact address.
15
15
5.**Admin Geo-Editor**: Administrators can draw missing geometries directly on the map when regulation text defines areas textually but lacks GeoJSON coordinates. Edits are stored in localStorage and exported as a complete updated regulation JSON.
*`LayerControlsPanel` / `LayerControlsButton`: Sidebar for toggling geoset/geometry visibility with checkbox tree UI
131
-
*`DetailPanel`: Side sheet showing selected geoset/geometry infowith description, textual definition, and comments
132
-
*`GeoSetItem` / `GeometryItem`: Tree items in layer controls with checkboxes, color swatches, and comment counts
129
+
*`ConsultationMap`: Mapbox map with geoset rendering, layer controls, detail panel, derived geometry computation (buffer/difference), address search with search location pins, initial fit-to-bounds, and `GeometryCollection` zoom support
130
+
*`LayerControlsPanel` / `LayerControlsButton`: Dual-mode sidebar — in normal mode shows a simplified community picker with address search (via `LocationSelector`); in editing mode shows the full layer controls with checkbox tree UI for toggling geoset/geometry visibility
131
+
*`DetailPanel`: Side sheet showing selected geoset/geometry/search-location info. For search locations, shows nearby points within 500m sorted by distance (Haversine). For geosets, lists point geometries with comment counts. For geometries, shows description, textual definition, and comments
132
+
*`GeoSetItem` / `GeometryItem`: Tree items in layer controls (editing mode) with checkboxes, color swatches, clickable names, and inline comment counts
133
133
*`CommentSection`: Rich text editor (ReactQuill), authentication check, comment display with upvotes and delete
134
134
*`CommentsOverviewSheet`: Modal listing all comments with sort options (recent/likes), entity type badges, navigation
135
135
*`AISummaryCard`: Collapsible card for AI-generated summaries on chapters/articles
@@ -144,7 +144,7 @@ sequenceDiagram
144
144
*`CityConsultations`: [`src/components/cities/CityConsultations.tsx`](../../src/components/cities/CityConsultations.tsx) (card grid listing for city consultations tab)
*`RegulationData`, `Geometry`, `CurrentUser`, `GeoSetData`, `SEARCH_COLORS`, etc.: [`src/components/consultations/types.ts`](../../src/components/consultations/types.ts) (shared types used across all consultation components)
148
148
149
149
***Email**:
150
150
* Template: [`src/lib/email/templates/consultation-comment.tsx`](../../src/lib/email/templates/consultation-comment.tsx) (React Email HTML template with entity permalink)
@@ -261,12 +261,16 @@ For local development, you can place regulation JSON files in the `public/` dire
261
261
4. Geometries may have a `textualDefinition` but null `geojson` — the admin geo-editor addresses this gap
262
262
263
263
### Map & Geo-Editor
264
-
1. The map uses Mapbox GL with custom styling for different geosets (each has a `color`)
264
+
1. The map uses Mapbox GL with custom styling for different geosets (each has a `color`) and always-on street labels
265
265
2.`defaultVisibleGeosets` in the regulation JSON controls initial map layer visibility
266
-
3. Derived geometries are computed client-side using Turf.js operations
267
-
4. The admin geo-editor stores drawn geometries in browser `localStorage` until exported
268
-
5. Export produces a complete updated `regulation.json` merging local edits with original data
269
-
6. Only super-administrators can access editing mode
266
+
3. The map auto-fits to all visible features on initial load (unless a hash navigation targets a specific entity)
267
+
4. Citizens can search addresses via the community picker; searched locations appear as colored pins and open a detail panel showing nearby points within 500m
268
+
5. Clicking a community boundary polygon opens the parent geoset detail; clicking a point opens the geometry detail
269
+
6. Point labels (addresses) appear at higher zoom levels; polygon labels (community names) fade out at street level to avoid noise
270
+
7. Derived geometries are computed client-side using buffer/difference operations
271
+
8. The admin geo-editor stores drawn geometries in browser `localStorage` until exported
272
+
9. Export produces a complete updated `regulation.json` merging local edits with original data
273
+
10. Only super-administrators can access editing mode (via a small edit icon in the community picker header)
270
274
271
275
### Navigation
272
276
1. URL hash anchors (`#chapter-1`, `#article-3`, `#geoset-prohibited_areas`) enable deep linking to specific entities
0 commit comments