Skip to content

Modernize farm selection and sidebar navigation UI#457

Merged
SvenVw merged 6 commits into
developmentfrom
feature/improve-start-page
Feb 13, 2026
Merged

Modernize farm selection and sidebar navigation UI#457
SvenVw merged 6 commits into
developmentfrom
feature/improve-start-page

Conversation

@SvenVw
Copy link
Copy Markdown
Collaborator

@SvenVw SvenVw commented Feb 10, 2026

Summary by CodeRabbit

  • New Features

    • Dedicated Atlas section with collapsible sub-items and clearer navigation
    • New help/support contact note for user assistance
  • UI/UX Improvements

    • Modernized farm selection with hero/empty-state and compact farm cards showing details
    • Sidebar navigation: tooltip-enabled disabled states, clearer unavailable-feature visuals, and conditional items (calendar, Percelen, Meststoffen)
    • Improved distinction between farm list and farm overview

…r feature breakdowns for new users, and a dedicated Atlas section for existing farms. Improved sidebar navigation by adding "muted" states for unavailable features and clarifying the distinction between the farm list and farm overview
@SvenVw SvenVw self-assigned this Feb 10, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 10, 2026

🦋 Changeset detected

Latest commit: d3b8248

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 Patch

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.04%. Comparing base (27d72d6) to head (6412a2b).

Additional details and impacted files
@@             Coverage Diff              @@
##           development     #457   +/-   ##
============================================
  Coverage        88.04%   88.04%           
============================================
  Files               91       91           
  Lines             4625     4625           
  Branches          1494     1494           
============================================
  Hits              4072     4072           
  Misses             553      553           
Flag Coverage Δ
fdm-calculator 88.76% <ø> (ø)
fdm-core 86.69% <ø> (ø)
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.

@SvenVw
Copy link
Copy Markdown
Collaborator Author

SvenVw commented Feb 11, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 11, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 11, 2026

Walkthrough

Modernizes the farm selection screen and sidebar: introduces tooltip-wrapped disabled states, collapsible Atlas/Balans sections with nested sub-links, state-driven rendering based on farm selection and wizard state, and redesigned farm cards with role badges and Atlas cards.

Changes

Cohort / File(s) Summary
Changeset Metadata
\.changeset/calm-rivers-flow.md
Patch changelog entry documenting the UI update.
Sidebar — Apps
fdm-app/app/components/blocks/sidebar/apps.tsx
Reworks Apps sidebar: adds TooltipProvider, makes Atlas/Balans collapsible with nested sub-items, renders disabled tooltip states when links are absent, and consolidates repeated blocks into a unified SidebarMenu structure.
Sidebar — Farm
fdm-app/app/components/blocks/sidebar/farm.tsx
Transforms farm sidebar into state-driven rendering: adds Tooltip system, dynamic isFarmSelected/isFarmOverview checks, conditional NavLink rendering for Percelen/Meststoffen/Calendar/Bouwplan, and dynamic Mijn bedrijven / farm overview items with role badges.
Farm Index Route
fdm-app/app/routes/farm._index.tsx
Overhauls farm selection route: new hero and empty-state cards, redesigned farm cards with address/postcode/KvK and role badges, added Atlas card grid (Percelen/Hoogtekaart/Bodemkaart), expanded icon set, and SupportNote component.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • gerardhros
  • BoraIneviNMI

Poem

🐰
I hopped through menus, soft and spry,
Tooltips glowing, links that sigh.
Farm cards snug in tidy rows,
Atlas paths where curiosity goes.
A twitch, a nibble — UI aglow!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Modernize farm selection and sidebar navigation UI' directly and accurately summarizes the main changes across the changeset, covering the UI enhancements to farm selection screen and sidebar navigation improvements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feature/improve-start-page

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
fdm-app/app/components/blocks/sidebar/apps.tsx (2)

106-342: Duplicated disabled-button class string — consider extracting a constant.

The className "hover:bg-transparent hover:text-muted-foreground active:bg-transparent active:text-muted-foreground opacity-50 cursor-not-allowed" is repeated verbatim on lines 134, 221, 291, and 324. Extracting it to a local constant (e.g., const disabledMenuButtonClass = "...") would reduce duplication and make future styling tweaks a single-point change.

♻️ Suggested extraction

Add near the top of SidebarApps, before the return:

const disabledMenuButtonClass =
    "hover:bg-transparent hover:text-muted-foreground active:bg-transparent active:text-muted-foreground opacity-50 cursor-not-allowed"

Then replace each occurrence:

-className="hover:bg-transparent hover:text-muted-foreground active:bg-transparent active:text-muted-foreground opacity-50 cursor-not-allowed"
+className={disabledMenuButtonClass}

148-199: CollapsibleContent renders empty sub-items when Atlas is disabled.

When atlasLink is undefined (disabled state), the CollapsibleContent block (lines 148–199) still renders three SidebarMenuSubItem elements that are all empty (since each sub-link is also undefined). There's no way for the user to open the collapsible in this state (no trigger), so this is harmless, but you could short-circuit the entire CollapsibleContent with {atlasLink && <CollapsibleContent>...</CollapsibleContent>} to avoid rendering empty DOM. Same applies to the Balans section (lines 235–270).

fdm-app/app/routes/farm._index.tsx (1)

148-207: The two hero cards share a nearly identical structure — consider a small card component.

The "Bedrijf aanmaken" card (lines 148–207) and "Atlas verkennen" card (lines 209–267) follow the same template: icon → title → description → feature list → CTA button. A lightweight FeatureCard component accepting props for icon, title, description, features, and action would reduce ~120 lines to ~20 and make future additions easier. Same observation applies to the three Atlas cards in the non-empty state (lines 397–482).

Also applies to: 209-267


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.

@coderabbitai coderabbitai Bot changed the title @coderabbitai Modernize farm selection and sidebar navigation UI Feb 11, 2026
@coderabbitai coderabbitai Bot added branch:development Issue only affecting development, not the main branch (yet) enhancement New feature or request fdm-app labels Feb 11, 2026
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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
fdm-app/app/components/blocks/sidebar/farm.tsx (1)

96-101: ⚠️ Potential issue | 🟠 Major

fertilizersLink is not gated by isCreateFarmWizard, unlike fieldsLink and rotationLink.

During the create-farm wizard, farmId can be set (the wizard creates a farm ID early). fieldsLink (line 79) and rotationLink (line 88) correctly return undefined when isCreateFarmWizard is true, disabling those sidebar items. fertilizersLink skips this check, so the Meststoffen item remains clickable during the wizard — likely unintended.

🐛 Suggested fix
     let fertilizersLink: string | undefined
-    if (farmId && farmId !== "undefined") {
+    if (isCreateFarmWizard) {
+        fertilizersLink = undefined
+    } else if (farmId && farmId !== "undefined") {
         fertilizersLink = `/farm/${farmId}/fertilizers`
     } else {
         fertilizersLink = undefined
     }
🤖 Fix all issues with AI agents
In `@fdm-app/app/routes/farm._index.tsx`:
- Around line 153-155: Update the hardcoded title text inside the CardTitle
element (the JSX using the CardTitle component) where it currently reads
"Bedrijf aamaken" to correct the typo to "Bedrijf aanmaken"; locate the
CardTitle JSX in the farm._index route component and change the string content
accordingly.
- Around line 186-191: Fix the typo in the JSX label: change the bold text
"Gebruikruimte:" to "Gebruiksruimte:" inside the span in the farm index route
component (the JSX block that renders <span><b>Gebruikruimte:</b> ...</span>) so
it matches the sidebar label and other usages.
- Around line 304-323: The role label mapping in the JSX that iterates
farm.roles (the map rendering producing Badge elements) is missing an explicit
case for "researcher" and thus shows "Lid" instead of "Onderzoeker", causing
inconsistency with the mapping used in the Farm sidebar (the mapping around
getRoleLabel in farm.tsx); fix by extracting a shared helper (e.g.,
getRoleLabel(role: string) or a ROLE_LABELS constant) and replace the inline
ternary inside the Badge rendering with a call to that helper so "owner" →
"Eigenaar", "advisor" → "Adviseur", "researcher" → "Onderzoeker" and a default
fallback remain consistent across components.
- Line 8: The import named Map from lucide-react shadows the global Map
constructor; rename the imported symbol (e.g., to MapIcon or LucideMap) in the
import statement and update all usages of Map in this module (notably the icon
usage around the previously referenced usage at line ~402) to the new name so
the global Map is no longer shadowed.
- Around line 92-111: The SupportNote component builds an unreliable support
address using window.location.hostname (SupportNote), which yields invalid
emails in dev/staging; update the logic to read a configured supportEmail from
clientConfig (exposed via an environment variable) with a fallback to the
existing dynamic `support@${window.location.hostname}` behavior, and use that
value when constructing the mailto link (replace the inline supportEmail
construction in SupportNote with clientConfig.supportEmail ||
`support@${window.location.hostname}`), ensuring clientConfig is loaded where
SupportNote is rendered.
🧹 Nitpick comments (5)
fdm-app/app/components/blocks/sidebar/apps.tsx (2)

129-138: Disabled Atlas lacks a tooltip, unlike the other disabled items.

Balans (line 209), Bemestingsadvies (line 279), and Gebruiksruimte (line 312) all wrap their disabled states in a <Tooltip> explaining why the item is unavailable. The disabled Atlas button is the only one without this tooltip, creating an inconsistent UX — a user in the create-farm wizard gets no hint about why Atlas is greyed out.

♻️ Suggested fix: wrap in Tooltip like the other disabled items
                                ) : (
+                                   <Tooltip>
+                                       <TooltipTrigger asChild>
                                    <SidebarMenuButton
                                        isActive={false}
                                        className="hover:bg-transparent hover:text-muted-foreground active:bg-transparent active:text-muted-foreground opacity-50 cursor-not-allowed"
                                    >
                                        <MapIcon className="text-muted-foreground" />
                                        <span className="text-muted-foreground">
                                            Atlas
                                        </span>
                                    </SidebarMenuButton>
+                                       </TooltipTrigger>
+                                       <TooltipContent side="right">
+                                           Atlas is niet beschikbaar tijdens het aanmaken van een bedrijf
+                                       </TooltipContent>
+                                   </Tooltip>
                                )}

106-334: The disabled-state className string is duplicated four times.

The class string "hover:bg-transparent hover:text-muted-foreground active:bg-transparent active:text-muted-foreground opacity-50 cursor-not-allowed" is repeated at lines 132, 213, 283, and 316. Consider extracting it into a constant (e.g., const disabledMenuButtonClassName = "...") at the top of the component to reduce duplication and make future styling tweaks easier. The same pattern also appears in farm.tsx (lines 249, 282, 315, 348).

fdm-app/app/routes/farm._index.tsx (2)

389-392: Minor text issue: "gegevens" should likely be singular or rephrased.

Line 391: "Raadpleeg openbare kaarten en ruimtelijke gegevens." — In Dutch, "gegevens" is already the standard plural form. However, it looks like there might be a trailing 's' issue making it read oddly. Consider "ruimtelijke gegevens" or simply "ruimtelijke data" for clarity. This is a very minor nit.


284-387: Farm cards and Atlas cards share a nearly identical card pattern — consider extracting a reusable card component.

The card structure (icon + title header, content area, footer with arrow) is repeated across farm cards (lines 286–367), the "new farm" card (lines 370–386), and the three Atlas cards (lines 394–479). A small abstraction (e.g., NavigationCard) could reduce duplication and make future styling changes easier.

fdm-app/app/components/blocks/sidebar/farm.tsx (1)

197-201: Calendar URL rewrite regex could match unintended path segments.

The regex /\/(\d{4}|all)/ replaces the first path segment that looks like a 4-digit number or "all". While farm IDs are UUIDs (safe today), this could silently break if any other 4-digit segment appears in the URL in the future (e.g., a port-like path component). A more targeted regex anchored to the expected position would be more robust, e.g.:

const newUrl = location.pathname.replace(
    /\/farm\/[^/]+\/(\d{4}|all)/,
    `/farm/${farmId}/${item}`,
)

This is a minor robustness concern for now.

Comment thread fdm-app/app/routes/farm._index.tsx Outdated
Comment thread fdm-app/app/routes/farm._index.tsx
Comment thread fdm-app/app/routes/farm._index.tsx
Comment thread fdm-app/app/routes/farm._index.tsx
Comment thread fdm-app/app/routes/farm._index.tsx
@SvenVw SvenVw requested a review from gerardhros February 11, 2026 15:09
Comment thread fdm-app/app/components/blocks/sidebar/farm.tsx
Copy link
Copy Markdown
Collaborator

@gerardhros gerardhros left a comment

Choose a reason for hiding this comment

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

nice improvement from user perspective. LGTM.

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.

2 participants