Skip to content

Commit 7ba24a4

Browse files
Florian Flahautclaude
andcommitted
Plan: show planting distances per plant (panel + cell tooltip)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent fd361e1 commit 7ba24a4

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

src/components/PotagerPlanner.tsx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,9 @@ function PlotEditor({
403403
? "Voisinage déconseillé"
404404
: inRotation
405405
? "Rotation : même famille ici récemment"
406-
: plant?.nom ?? "Case vide";
406+
: plant
407+
? `${plant.nom} — espacement ${plant.espacement}`
408+
: "Case vide";
407409
return (
408410
<button
409411
key={index}
@@ -435,6 +437,38 @@ function PlotEditor({
435437
</div>
436438
</div>
437439

440+
{(() => {
441+
const ids = Array.from(
442+
new Set(plot.cells.filter((c): c is string => Boolean(c)))
443+
);
444+
if (ids.length === 0) return null;
445+
return (
446+
<div className="mt-4 border-t border-emerald-50 dark:border-zinc-800 pt-3">
447+
<p className="mb-2 text-xs font-semibold uppercase tracking-wide text-emerald-600 dark:text-emerald-400">
448+
📏 Distances de plantation
449+
</p>
450+
<div className="flex flex-wrap gap-2">
451+
{ids.map((id) => {
452+
const plant = getPlantById(id);
453+
if (!plant) return null;
454+
return (
455+
<span
456+
key={id}
457+
className="flex items-center gap-1.5 rounded-full bg-emerald-50 px-2.5 py-1 text-xs text-emerald-800 dark:bg-zinc-800 dark:text-emerald-100"
458+
>
459+
<span>{plant.emoji}</span>
460+
<span className="font-medium">{plant.nom}</span>
461+
<span className="text-emerald-700/70 dark:text-emerald-300/70">
462+
{plant.espacement}
463+
</span>
464+
</span>
465+
);
466+
})}
467+
</div>
468+
</div>
469+
);
470+
})()}
471+
438472
<div className="mt-3 flex flex-wrap items-center gap-4 text-xs text-emerald-700/80 dark:text-emerald-300/80">
439473
<span>
440474
Pinceau actuel :{" "}

0 commit comments

Comments
 (0)