Skip to content

Add field layers toggle control and fix geocoder mobile collapse#345

Merged
SvenVw merged 7 commits into
developmentfrom
FDM327
Nov 25, 2025
Merged

Add field layers toggle control and fix geocoder mobile collapse#345
SvenVw merged 7 commits into
developmentfrom
FDM327

Conversation

@SvenVw
Copy link
Copy Markdown
Collaborator

@SvenVw SvenVw commented Nov 25, 2025

Summary by CodeRabbit

  • New Features

    • Added a map control toggle to show or hide field layers for easier visibility management.
  • Bug Fixes

    • Geocoder bar now correctly collapses on mobile, improving map control layout and space use.
  • UX Improvements

    • Map controls now include a compact field-toggle in the top-right and respect current viewport state when used.

✏️ Tip: You can customize this high-level summary in your review settings.

Closes #327

@SvenVw SvenVw self-assigned this Nov 25, 2025
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Nov 25, 2025

🦋 Changeset detected

Latest commit: b50f942

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@svenvw/fdm-app Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 25, 2025

Walkthrough

Adds a Fields layer visibility toggle control and wiring across atlas routes, makes GeocoderControl collapsible on mobile via a new prop, and replaces conditional layer rendering with Mapbox layer layout visibility controlled by local showFields state.

Changes

Cohort / File(s) Summary
Changesets
\.changeset/clever-boats-notice.md, \.changeset/fuzzy-ducks-pick.md
Adds changeset entries: patch note for mobile geocoder collapse fix and a minor bump noting the Fields toggle feature.
Map Controls
fdm-app/app/components/blocks/atlas/atlas-controls.tsx
Adds FieldsButton UI and CustomFieldsControl (Mapbox IControl) to toggle field-layer visibility; adds showFields?: boolean and onToggleFields?: () => void to ControlsProps; conditionally mounts FieldsControl; uses isMobile to set Geocoder collapse.
Geocoder
fdm-app/app/components/blocks/atlas/atlas-geocoder.tsx
Adds collapsed?: boolean to GeocoderControlProps and passes it into MapboxGeocoder initialization.
Atlas Routes — visibility wiring
fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx, fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx, fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
Introduces local showFields state and layerLayout visibility helper; passes showFields and onToggleFields into Controls; applies layout to field-related layers (available/selected/etc.) instead of conditional rendering.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Controls as Controls Component
    participant CustomCtrl as CustomFieldsControl (IControl)
    participant Route as Atlas Route (page state)
    participant Map as Map / Mapbox Layers

    User->>CustomCtrl: click Fields toggle
    CustomCtrl->>Controls: call onToggleFields()
    Controls->>Route: invoke handler to set showFields
    Route->>Route: update showFields & compute layerLayout
    Route->>Map: apply layerLayout (visibility) to field layers
    Map->>User: field layers shown/hidden

    Note right of Controls: Geocoder collapsed = isMobile || prop.collapsed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Review CustomFieldsControl lifecycle (onAdd/onRemove) and React mounting/unmounting into Mapbox container.
  • Verify all field-related layer names receive the layout visibility update across affected routes.
  • Confirm showFields/onToggleFields prop wiring and Geocoder collapsed behavior for mobile.

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • gerardhros
  • BoraIneviNMI

Poem

🐰 I hopped to the map and gave the layers a twitch,
A tiny toggle button — hide fields in a flick.
The geocoder tucks in when the screen is small,
Basemaps breathe easier — I celebrate the call! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: adding a field layers toggle control and fixing geocoder mobile collapse, both reflected in the changeset and code modifications.
Linked Issues check ✅ Passed The PR implements all acceptance criteria from issue #327: a map control for field layer visibility, hide/show functionality, page-level persistence, and intuitive UI placement with a toggle button.
Out of Scope Changes check ✅ Passed All changes are directly related to the two stated objectives: field layer toggle functionality and geocoder mobile collapse fix. No unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch FDM327

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21d8b8a and b50f942.

📒 Files selected for processing (3)
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx (4 hunks)
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx (7 hunks)
  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.34%. Comparing base (6ce001d) to head (b50f942).
⚠️ Report is 8 commits behind head on development.

Additional details and impacted files
@@             Coverage Diff              @@
##           development     #345   +/-   ##
============================================
  Coverage        87.34%   87.34%           
============================================
  Files               79       79           
  Lines             3872     3872           
  Branches          1099     1099           
============================================
  Hits              3382     3382           
  Misses             490      490           
Flag Coverage Δ
fdm-calculator 87.25% <ø> (ø)
fdm-core 87.03% <ø> (ø)
fdm-data 92.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot changed the title @coderabbitai Add field layers toggle control and fix geocoder mobile collapse Nov 25, 2025
@coderabbitai coderabbitai Bot added branch:development Issue only affecting development, not the main branch (yet) fdm-app labels Nov 25, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
.changeset/clever-boats-notice.md (1)

1-5: Polish the changeset description for readability

Consider rephrasing to something like:
Fix geocoder bar being collapsed on mobile
or
Fixes the geocoder bar being collapsed on mobile
for slightly clearer English.

fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx (1)

221-223: Field visibility toggle implementation is sound; small ergonomics tweaks possible

The showFields state plus layout.visibility toggle correctly hides/shows all field layers without tearing down sources, and the Controls API integration is consistent with other atlas routes.

Two minor improvements you might consider:

  • Use a functional updater to avoid any stale-closure edge cases on rapid toggling:
- onToggleFields={() =>
-     setShowFields(!showFields)
- }
+ onToggleFields={() =>
+     setShowFields((prev) => !prev)
+ }
  • Align Layer usage with the pattern in the fields index route to avoid as any and keep styles/props clearer:
- <Layer
-     {...({
-         ...fieldsAvailableStyle,
-         layout: layerLayout,
-     } as any)}
- />
+ <Layer {...fieldsAvailableStyle} layout={layerLayout} />

(and similarly for the other Layers using layout: layerLayout).

Please sanity‑check that toggling the button hides all three visual representations (available, selected, saved/outline) and that selection/hover behavior is disabled when fields are hidden.

Also applies to: 285-304, 312-350

fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx (1)

144-145: Overview map field toggle aligns with Controls; consider minor improvements

The overview atlas now cleanly hooks into Controls and uses layout.visibility to hide/show both available and saved field layers, which matches the intended UX.

You might optionally:

  • Switch to a functional updater for the toggle:
- onToggleFields={() => setShowFields(!showFields)}
+ onToggleFields={() => setShowFields((prev) => !prev)}
  • If you want the visibility choice to survive a reload (like the viewState), persist showFields in sessionStorage next to mapViewState; not required for the current issue but consistent with your existing persistence pattern. Based on learnings, this keeps map behavior consistent across MapGL instances.

Please verify that when fields are hidden, both hover panels correctly stop highlighting field geometries and only the basemap remains visible.

Also applies to: 161-162, 173-186, 188-201

fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx (1)

201-208: Controlled map + field toggle are consistent with other atlas routes; only small tweaks suggested

The move to a controlled viewState with onMove and Controls.onViewportChange keeps the map behavior predictable, and the showFields/layerLayout pattern correctly hides/shows both available and existing fields while creating a new one.

Two minor suggestions:

  • Use a functional updater for the toggle to avoid any stale-closure edge cases:
- onToggleFields={() =>
-     setShowFields(!showFields)
- }
+ onToggleFields={() =>
+     setShowFields((prev) => !prev)
+ }
  • (Optional) Extract the shared layerLayout + Controls wiring pattern into a small helper or shared component if you find yourself repeating it across more atlas routes in future. Based on learnings, this would align with your goal of centralizing MapGL configuration/controls.

Please confirm that geocoder navigation, manual panning/zooming, and the field visibility toggle all keep viewState in sync and that selecting a new field is impossible when layers are hidden.

Also applies to: 213-216, 235-238, 294-308, 331-344, 346-376

fdm-app/app/components/blocks/atlas/atlas-controls.tsx (1)

48-132: CustomFieldsControl implementation is solid; fix likely typo in button classes

The custom Mapbox control using useControl + createRoot is a clean way to host the FieldsButton, and updateProps keeps it in sync with React state.

One small nit:

  • The class string p-0! on the button is probably meant to be !p-0 (or just p-0) for Tailwind/utility CSS to recognize it; as written it likely has no effect.

No behavior change, but worth correcting for consistent styling.

Please double‑check the button’s padding in the browser; if it’s not being overridden as intended, updating p-0! to !p-0 (or similar) should fix it.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 69a412d and 00089dc.

📒 Files selected for processing (7)
  • .changeset/clever-boats-notice.md (1 hunks)
  • .changeset/fuzzy-ducks-pick.md (1 hunks)
  • fdm-app/app/components/blocks/atlas/atlas-controls.tsx (2 hunks)
  • fdm-app/app/components/blocks/atlas/atlas-geocoder.tsx (2 hunks)
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx (4 hunks)
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx (7 hunks)
  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx (4 hunks)
🧰 Additional context used
🧠 Learnings (18)
📓 Common learnings
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 67
File: fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx:164-212
Timestamp: 2025-01-31T16:06:33.810Z
Learning: Map configuration in the application should be modularized using the `useMapConfig` hook and `MapControls` component to maintain consistency across all MapGL instances.
📚 Learning: 2024-11-25T14:42:26.660Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 6
File: fdm-app/app/components/blocks/field-map.tsx:0-0
Timestamp: 2024-11-25T14:42:26.660Z
Learning: In `fdm-app/app/components/blocks/field-map.tsx`, explicit cleanup of Mapbox GL resources is not necessary, as `react-map-gl` handles it automatically upon component unmount, and `MapRef` does not have a `remove` method.

Applied to files:

  • fdm-app/app/components/blocks/atlas/atlas-geocoder.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
  • fdm-app/app/components/blocks/atlas/atlas-controls.tsx
📚 Learning: 2025-01-09T16:03:37.764Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 42
File: fdm-app/app/routes/farm/_b_id_farm/layout.tsx:46-95
Timestamp: 2025-01-09T16:03:37.764Z
Learning: A shared layout component `FarmLayoutBase` has been created in `components/custom/farm-layout-base.tsx` to maintain consistency across farm-related pages. The component handles farm selection dropdown, breadcrumb navigation, and provides a common layout structure.

Applied to files:

  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
📚 Learning: 2025-01-09T16:03:37.764Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 42
File: fdm-app/app/routes/farm/_b_id_farm/layout.tsx:46-95
Timestamp: 2025-01-09T16:03:37.764Z
Learning: The `FarmLayout` component in `components/custom/farm-layout.tsx` provides a reusable layout structure for farm-related pages, with support for farm selection dropdown, customizable breadcrumb titles, and flexible content rendering through either children or Outlet components.

Applied to files:

  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
📚 Learning: 2025-01-09T16:03:37.764Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 42
File: fdm-app/app/routes/farm/_b_id_farm/layout.tsx:46-95
Timestamp: 2025-01-09T16:03:37.764Z
Learning: A comprehensive farm layout system has been created in `components/custom/farm-layouts/` with `BaseFarmLayout` and `FarmSidebarLayout` components. The system supports both simple and sidebar-based layouts while maintaining consistent header and farm selection functionality across all farm routes.

Applied to files:

  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
📚 Learning: 2025-09-23T12:27:07.391Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 274
File: fdm-app/app/routes/farm.$b_id_farm._index.tsx:151-204
Timestamp: 2025-09-23T12:27:07.391Z
Learning: In the FDM application, field overview functionality is implemented as a dedicated page accessible via `farm/{farmId}/{calendar}/field` rather than as a direct listing on the dashboard. The dashboard includes a "Perceelsoverzicht" quick action card that provides navigation to this comprehensive field management interface.

Applied to files:

  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
📚 Learning: 2025-01-09T16:03:37.764Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 42
File: fdm-app/app/routes/farm/_b_id_farm/layout.tsx:46-95
Timestamp: 2025-01-09T16:03:37.764Z
Learning: The farm layout system has been reorganized into separate components (`FarmHeader`, `ContentLayout`, `PaginationLayout`) to support different navigation patterns (sidebar, pagination) while maintaining consistent styling. Each layout component is designed to be used independently or combined as needed.

Applied to files:

  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
📚 Learning: 2025-08-11T12:24:32.200Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 233
File: fdm-app/app/components/blocks/atlas-fields/cultivation-history.tsx:53-53
Timestamp: 2025-08-11T12:24:32.200Z
Learning: In `fdm-app/app/components/blocks/atlas-fields/cultivation-history.tsx`, the NMI API for cultivations guarantees that each year will be unique in the cultivation history data, so using `cultivation.year` as a React list key is safe and won't cause duplicate key warnings.

Applied to files:

  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
📚 Learning: 2025-09-23T12:29:34.184Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 274
File: fdm-app/app/routes/farm.$b_id_farm._index.tsx:160-163
Timestamp: 2025-09-23T12:29:34.184Z
Learning: In the FDM application, the fertilizer application route intentionally uses `${calendar}/field/fertilizer` instead of the originally planned `/farm/{farmId}/add/fertilizer` structure. This design decision prioritizes starting from the field list view to provide better field selection workflow before applying fertilizer, rather than direct dashboard-to-action navigation.

Applied to files:

  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
📚 Learning: 2025-01-31T15:05:14.310Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 67
File: fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx:601-610
Timestamp: 2025-01-31T15:05:14.310Z
Learning: The `updateField` function in fdm-core has optional parameters after `fdm` and `b_id`. The TypeScript definitions might show 8 required parameters due to a potential version mismatch.

Applied to files:

  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
📚 Learning: 2025-09-26T08:34:50.413Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 279
File: fdm-app/app/routes/farm.$b_id_farm.$calendar.norms.tsx:277-283
Timestamp: 2025-09-26T08:34:50.413Z
Learning: In the fdm project, fdm-core and fdm-app are updated together as part of a monorepo structure, which eliminates legacy data concerns when new fields like b_isproductive are introduced. Both packages are synchronized, so there's no need for defensive coding against undefined values for newly introduced database fields.

Applied to files:

  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
📚 Learning: 2025-01-31T14:29:37.599Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 67
File: fdm-app/app/components/custom/atlas/atlas.d.tsx:8-8
Timestamp: 2025-01-31T14:29:37.599Z
Learning: In the Atlas component's MapFieldsProps interface, mapStyle is intentionally restricted to "mapbox://styles/mapbox/satellite-streets-v12" as it's currently the only supported style option.

Applied to files:

  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
  • fdm-app/app/components/blocks/atlas/atlas-controls.tsx
📚 Learning: 2025-01-31T16:06:33.810Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 67
File: fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx:164-212
Timestamp: 2025-01-31T16:06:33.810Z
Learning: MapGL implementations should use the shared `useMapConfig` hook for configuration and `getLayerStyle` utility for consistent styling. The hook supports both interactive and non-interactive maps, handling bounds calculation and view state management.

Applied to files:

  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
📚 Learning: 2025-01-31T15:41:43.741Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 67
File: fdm-app/app/components/custom/atlas/atlas-panels.tsx:28-28
Timestamp: 2025-01-31T15:41:43.741Z
Learning: When handling different map event types in react-map-gl v7.1.8, use MapLayerMouseEvent for mouse events (which have the point property) and ViewStateChangeEvent for view state changes. Use a type guard like 'point' in evt to safely access event-specific properties.

Applied to files:

  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
  • fdm-app/app/components/blocks/atlas/atlas-controls.tsx
📚 Learning: 2025-01-31T16:06:33.810Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 67
File: fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx:164-212
Timestamp: 2025-01-31T16:06:33.810Z
Learning: Map configuration in the application should be modularized using the `useMapConfig` hook and `MapControls` component to maintain consistency across all MapGL instances.

Applied to files:

  • fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields._index.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
  • fdm-app/app/components/blocks/atlas/atlas-controls.tsx
📚 Learning: 2025-01-31T15:06:35.764Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 67
File: fdm-app/app/components/custom/atlas/atlas-sources.tsx:21-66
Timestamp: 2025-01-31T15:06:35.764Z
Learning: In react-map-gl components, when querying rendered features via map.queryRenderedFeatures(), the effect's dependency array must include any props that affect the map's rendered state (like source data) to ensure features are queried against the current map state.

Applied to files:

  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
📚 Learning: 2025-06-10T13:10:03.154Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 161
File: fdm-app/app/components/blocks/field-map.tsx:0-0
Timestamp: 2025-06-10T13:10:03.154Z
Learning: When facing prop name inconsistencies with react-map-gl (like mapboxAccessToken vs mapboxApiAccessToken), using different import statements can resolve the issue more elegantly than changing prop names across multiple files.

Applied to files:

  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
  • fdm-app/app/components/blocks/atlas/atlas-controls.tsx
📚 Learning: 2025-06-10T12:20:38.360Z
Learnt from: SvenVw
Repo: SvenVw/fdm PR: 161
File: fdm-app/app/components/blocks/field-map.tsx:68-68
Timestamp: 2025-06-10T12:20:38.360Z
Learning: When using MapGL component from react-map-gl, the correct prop name for the Mapbox access token is `mapboxApiAccessToken` as verified by checking the MapboxProps interface. This should be consistent across all usages of the MapGL component.

Applied to files:

  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx
🧬 Code graph analysis (3)
fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx (1)
fdm-app/app/components/blocks/atlas/atlas-sources.tsx (2)
  • FieldsSourceSelected (39-97)
  • FieldsSourceNotClickable (23-37)
fdm-app/app/routes/farm.$b_id_farm.$calendar.field.new.tsx (3)
fdm-app/app/components/blocks/atlas/atlas-viewstate.tsx (1)
  • getViewState (19-42)
fdm-app/app/components/blocks/atlas/atlas-controls.tsx (1)
  • Controls (24-46)
fdm-app/app/components/blocks/atlas/atlas-sources.tsx (2)
  • FieldsSourceAvailable (135-268)
  • FieldsSourceNotClickable (23-37)
fdm-app/app/components/blocks/atlas/atlas-controls.tsx (1)
fdm-app/app/components/blocks/atlas/atlas-geocoder.tsx (1)
  • GeocoderControl (91-94)
🔇 Additional comments (3)
fdm-app/app/components/blocks/atlas/atlas-geocoder.tsx (1)

18-19: Geocoder collapsed prop wiring looks consistent with Controls usage

Adding collapsed?: boolean and threading it through to the geocoder options cleanly enables the mobile-specific behavior without affecting existing callers.

Please verify on devices/emulation that the geocoder starts collapsed on mobile and expanded on desktop as intended.

Also applies to: 32-37

.changeset/fuzzy-ducks-pick.md (1)

1-5: Changeset accurately captures the new field-layer toggle feature

The minor release entry and description match the scope of the new map controls toggle.

fdm-app/app/components/blocks/atlas/atlas-controls.tsx (1)

1-46: Controls composition and mobile geocoder behavior look good

Wiring collapsed={isMobile} into GeocoderControl and conditionally rendering FieldsControl based on showFields/onToggleFields cleanly extends the existing controls without breaking maps that don’t have fields.

Please test on both mobile and desktop that: (1) the geocoder collapses only on mobile, and (2) maps without showFields/onToggleFields continue to render controls as before.

@SvenVw SvenVw requested a review from BoraIneviNMI November 25, 2025 09:47
@coderabbitai coderabbitai Bot added the bug Something isn't working label Nov 25, 2025
Copy link
Copy Markdown
Collaborator

@BoraIneviNMI BoraIneviNMI left a comment

Choose a reason for hiding this comment

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

Maybe the control state should reset if the user switches to a different farm from the header.

Otherwise, the changes look good to me.

@SvenVw SvenVw added enhancement New feature or request and removed bug Something isn't working labels Nov 25, 2025
@SvenVw
Copy link
Copy Markdown
Collaborator Author

SvenVw commented Nov 25, 2025

Maybe the control state should reset if the user switches to a different farm from the header.

Otherwise, the changes look good to me.

Resolved in b50f942

@coderabbitai coderabbitai Bot added the bug Something isn't working label Nov 25, 2025
@SvenVw SvenVw removed the bug Something isn't working label Nov 25, 2025
@SvenVw SvenVw merged commit d79ac2b into development Nov 25, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch:development Issue only affecting development, not the main branch (yet) enhancement New feature or request fdm-app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Layer Controls to Field Selection Map

2 participants