Skip to content

Companion planting tab: show common (German) plant names, not only scientific names #623

Description

@nolte

Summary

The Mischkultur (companion planting) tab on the species detail page (/stammdaten/species/{key}#companion-planting) lists compatible and incompatible species by their scientific name only (e.g. Daucus carota, Apium graveolens var. rapaceum, Pisum sativum). A normal user without botanical knowledge cannot tell that these are carrot, celeriac, and pea. The tab should also show the common (German) name so the information is actionable for everyday gardeners.

Observed on Allium porrum (Lauch) at /stammdaten/species/10337#companion-planting.

Good news: the data is already served

This is a frontend-only rendering gap — the common names already travel all the way to the client and are simply not displayed:

  • Backend populates common_names: src/backend/app/domain/services/species_service.py:83-84 (compatible) and :96-97 (incompatible) pass common_names straight through from the graph vertex.
  • API schema exposes it: src/backend/app/api/v1/companion_planting/schemas.py:22,29common_names: list[str].
  • Frontend type already has it: src/frontend/src/api/types.tsCompatibleSpecies.common_names / IncompatibleSpecies.common_names (the field comment even says "UI leads with [0]" — DE first by convention).
  • But the UI ignores it: src/frontend/src/pages/stammdaten/species-detail/SpeciesCompanionTab.tsx:182 (compatible) and the incompatible list both render only c.scientific_name ?? c.species_key; common_names is never referenced.

Proposed change (frontend)

In SpeciesCompanionTab.tsx, for both the compatible and incompatible lists:

  • Lead with the common name common_names[0] (DE-first by convention) as the primary label, and show the scientific name as secondary text (smaller/italic) — consistent with how other species views present the name pair.
  • Fall back gracefully: if common_names is empty, show scientific_name; if that is also missing, show species_key (current behaviour).
  • Keep the link target (/stammdaten/species/{species_key}), the score chip, and the incompatible reason line intact.
  • Mind mobile-first layout (the tab is used on the species detail page) and i18n (no hard-coded German in code; the names themselves come from the data).

Acceptance criteria

  • Each compatible/incompatible entry shows the common (German) name as the primary label with the scientific name as secondary text (verified on Allium porrum / species 10337: Daucus carota also reads as its common name).
  • Entries without a common name fall back to scientific name, then to species_key — no empty rows.
  • The score chip, the incompatible reason line, and the link to the species detail page remain intact.
  • Layout stays mobile-friendly.
  • eslint / tsc / vitest pass; the tab's tests cover the common-name-first rendering and the fallback.

Notes

  • No backend change required — common_names is already returned by GET /api/v1/species/{key}/compatible and /incompatible.
  • Aligns with the project's usability direction (descriptive texts / plain-language for non-expert users).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew functionality.featConventional Commits type `feat` — new feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions