app/: the Labeling page draws with ECharts instead of Plotly, range selection fixed (D-139)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-05 14:43:01 +01:00
1 parent bd93e708d2
commit 95c723e6ac
7 files changed
+148 -98

No files matched your search

+28 -6
View File
@@ -10,7 +10,7 @@
"@mantine/hooks": "^9.7.5",
"@mantine/notifications": "^9.7.5",
"@tabler/icons-react": "^3.50.0",
"plotly.js-dist-min": "^4.2.0",
"echarts": "^6.1.0",
"react": "^19.3.1",
"react-dom": "^19.3.1"
},
@@ -467,6 +467,20 @@
"csstype": "^3.0.2"
}
},
"node_modules/echarts": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/echarts/-/echarts-6.1.0.tgz",
"integrity": "sha512-q0yaFPggC9FUdsWH4blavRWFmxdrIodbkoKNAjJudAI6CA9gNPxHtV2RcZNEepZVlk4yvBYkOkbk6HIVpIyHZA==",
"dependencies": {
"tslib": "2.3.0",
"zrender": "6.1.0"
}
},
"node_modules/echarts/node_modules/tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
},
"node_modules/fdir": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
@@ -815,11 +829,6 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/plotly.js-dist-min": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/plotly.js-dist-min/-/plotly.js-dist-min-4.2.0.tgz",
"integrity": "sha512-nxwhTxrRtQAWcZLBplb7xi73o0P2z/zjNuh1RKO4ssmPK7Kh30bQcObnAJhekBogI2rqUMbM0JJZC0TrG5Tq5Q=="
},
"node_modules/postcss": {
"version": "8.5.32",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz",
@@ -1187,6 +1196,19 @@
"optional": true
}
}
},
"node_modules/zrender": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/zrender/-/zrender-6.1.0.tgz",
"integrity": "sha512-oEGMDB6pOP2S6OwRR4PdVv610zrjnA3Bh+JnSG12fYJlBKjtNAoEb5fSUoCOOINlH96I2fU38/A2UpRKs67xYQ==",
"dependencies": {
"tslib": "2.3.0"
}
},
"node_modules/zrender/node_modules/tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
}
}
}
+1 -1
View File
@@ -11,7 +11,7 @@
"@mantine/hooks": "^9.7.5",
"@mantine/notifications": "^9.7.5",
"@tabler/icons-react": "^3.50.0",
"plotly.js-dist-min": "^4.2.0",
"echarts": "^6.1.0",
"react": "^19.3.1",
"react-dom": "^19.3.1"
},
+1 -1
View File
@@ -7,7 +7,7 @@ import { IconChartLine, IconMessages, IconMoon, IconPhoto, IconSun } from "@tabl
import Support, { AGENTS, Etat, NOMS } from "./pages/Support.jsx";
import Images from "./pages/Images.jsx";
const Etiquetage = lazy(() => import("./pages/Etiquetage.jsx")); // Plotly, chargé seulement ici
const Etiquetage = lazy(() => import("./pages/Etiquetage.jsx")); // ECharts, chargé seulement ici
const PAGES = [["support", "Support", IconMessages], ["images", "Images", IconPhoto], ["etiquetage", "Étiquetage", IconChartLine]];
// L'adresse : #/<page>?station=…&du=…&au=… ; recharger garde la page et la sélection, Retour marche
+108 -88
View File
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from "react";
import { Button, Card, Group, Loader, NativeSelect, Stack, Text, Textarea, TextInput, Title } from "@mantine/core";
import { useEffect, useMemo, useRef, useState } from "react";
import { Button, Card, Group, Loader, NativeSelect, Stack, Text, Textarea, TextInput, Title, useComputedColorScheme } from "@mantine/core";
import * as echarts from "echarts";
import { appel, Selecteur } from "../commun.jsx";
// L'étiquetage (labeling/labeling.py) : deux plots alignés, la barre des étiquettes ; y glisser sélectionne une plage,
@@ -8,10 +9,14 @@ const FAMILLES = { "Visibility": "#8ec5e8", "Obstruction": "#f0b072", "Thermal d
"Target issue": "#e6d46a", "No data": "#c4c4be", "None": "#a8d5a2" };
const NOM_FAMILLE = f => (f === "None" ? "None (courbes intactes)" : f);
const CHOIX_FAMILLE = [{ value: "", label: "(sans famille)" }, ...Object.keys(FAMILLES).map(f => ({ value: f, label: NOM_FAMILLE(f) }))];
const GRIS = "#6b6b66", BLEU = "#2a78d6", VOIE = 22; // VOIE : px par rangée d'étiquettes
const GRIS = "#b0b0aa", BLEU = "#2a78d6", VOIE = 22; // VOIE : px par rangée d'étiquettes
const couleur = l => FAMILLES[l.categorie] || GRIS;
const lisible = s => s.slice(0, 16).replace("T", " ");
const marge = () => ({ l: 60, r: 20, t: 10, b: 30 });
const ms = s => Date.parse(s[10] === " " ? s.replace(" ", "T") + "Z" : s); // "AAAA-MM-JJ HH:MM" des courbes : UTC
const iso = v => new Date(v).toISOString().slice(0, 16) + "Z";
// Le graphique, de haut en bas : plot 1, plot 2, barre des étiquettes (VOIE px par rangée), réglette du zoom
const G = { l: 70, r: 120, h: 300, haut1: 10, haut2: 350, barre: 690 };
const reglette = n => G.barre + VOIE * n + 34;
export default function Etiquetage({ selection, choisir }) {
const [donnees, setDonnees] = useState(null), [charge, setCharge] = useState(false);
@@ -26,7 +31,8 @@ export default function Etiquetage({ selection, choisir }) {
<Stack gap="lg">
<div>
<Title order={2}>Étiquetage</Title>
<Text c="dimmed">Glisser sur la barre des étiquettes sélectionne une plage ; un clic sur une étiquette l'ouvre.</Text>
<Text c="dimmed">Molette : zoom ; glisser sur un plot : déplacer ; double-clic : tout voir. Glisser sur la barre des étiquettes
sélectionne une plage ; un clic sur une étiquette l'ouvre.</Text>
</div>
<Selecteur selection={selection} choisir={choisir} />
{charge && <Loader />}
@@ -38,93 +44,111 @@ export default function Etiquetage({ selection, choisir }) {
function Etiqueteur({ station, d }) {
const { A, B, T, plots: PLOTS } = d;
const indice = (titre, sinon) => { const i = PLOTS.findIndex(p => p.titre === titre); return i < 0 ? sinon : i; };
const [Plotly, setPlotly] = useState(null), [pret, setPret] = useState(false);
const [source, setSource] = useState("auto"), [labels, setLabels] = useState([]), [choix, setChoix] = useState(null);
const [m1, setM1] = useState(indice("Relative Corrected Horizontal Shift", 0));
const [m2, setM2] = useState(indice("Relative Corrected Vertical Shift", PLOTS.length > 1 ? 1 : 0));
const [ajout, setAjout] = useState({ categorie: "", texte: "" });
const [ouverte, setOuverte] = useState(null), [edit, setEdit] = useState(null), [note, setNote] = useState("");
const fig = useRef(), fig2 = useRef(), barre = useRef(), tries = useRef([]), courant = useRef({});
courant.current = { labels, choix, ouvrir }; // ce que lisent les événements Plotly, installés une fois
const sombre = useComputedColorScheme("light") === "dark";
const boite = useRef(), graphe = useRef(), courant = useRef({});
useEffect(() => { import("plotly.js-dist-min").then(m => setPlotly(() => m.default)); }, []);
const temps = useMemo(() => Object.fromEntries(Object.entries(T).map(([k, v]) => [k, v.map(ms)])), [T]);
// Les étiquettes par début, chacune dans la première rangée libre, sinon une nouvelle
const { tries, voie, n } = useMemo(() => {
const tries = [...labels].sort((a, b) => (a.debut < b.debut ? -1 : 1)), voies = [];
const voie = tries.map(l => { const r = voies.findIndex(f => f <= l.debut), i = r < 0 ? voies.length : r; voies[i] = l.fin; return i; });
return { tries, voie, n: Math.max(1, voies.length) };
}, [labels]);
courant.current = { tries, ouvrir, n }; // ce que lisent les événements du graphique, installés une fois
function zones() {
const { labels, choix } = courant.current;
const z = (a, b, c, o) => ({ type: "rect", xref: "x", yref: "paper", x0: lisible(a), x1: lisible(b), y0: 0, y1: 1,
fillcolor: c, opacity: o, line: { width: 0 }, layer: "below" });
return labels.map(l => z(l.debut, l.fin, couleur(l), 0.12)).concat(choix ? [z(choix[0], choix[1], BLEU, 0.25)] : []);
// Les zones des étiquettes (et la plage choisie) sur les plots, puis les barres des étiquettes
function decor() {
const zone = (a, b, c, o) => [{ xAxis: ms(a), itemStyle: { color: c, opacity: o } }, { xAxis: ms(b) }];
const zones = labels.map(l => zone(l.debut, l.fin, couleur(l), 0.12)).concat(choix ? [zone(choix[0], choix[1], BLEU, 0.25)] : []);
return [0, 1].map(g => ({ id: `zones${g}`, type: "line", xAxisIndex: g, yAxisIndex: g, data: [], markArea: { silent: true, data: zones } }))
.concat({ id: "barre", type: "custom", xAxisIndex: 2, yAxisIndex: 2, encode: { x: [0, 1], y: 2 }, cursor: "pointer",
data: tries.map((l, i) => [ms(l.debut), ms(l.fin), voie[i], i]),
renderItem: (p, api) => {
const a = api.coord([api.value(0), api.value(2)]), b = api.coord([api.value(1), api.value(2)]), h = api.size([0, 1])[1] * 0.85;
const r = echarts.graphic.clipRectByRect({ x: a[0], y: a[1] - h / 2, width: Math.max(b[0] - a[0] - 1, 2), height: h }, p.coordSys);
const l = courant.current.tries[api.value(3)];
return r && { type: "rect", shape: r, style: { fill: couleur(l) },
textContent: { style: { text: r.width > 30 ? l.description : "", // la couleur dit la famille
fill: "#1a1b1e", fontSize: 11, width: r.width - 8, overflow: "truncate" } },
textConfig: { position: "insideLeft" } };
},
markArea: { silent: true, data: choix ? [[{ xAxis: ms(choix[0]), itemStyle: { color: BLEU, opacity: 0.25 } }, { xAxis: ms(choix[1]) }]] : [] } });
}
// Les deux plots et la barre partagent plage et marges : celui qui change impose les siens aux deux autres (rien si déjà
// alignés, sinon le relayout appelle aligne en boucle).
function aligne(src = fig.current) {
const g1 = fig.current, g2 = fig2.current, b = barre.current;
if (!b?._fullLayout || !g2?._fullLayout || !g1?._fullLayout) return;
const rg = src._fullLayout.xaxis.range.slice();
const l = Math.max(g1._fullLayout._size.l, g2._fullLayout._size.l), r = Math.max(g1._fullLayout._size.r, g2._fullLayout._size.r);
return Promise.all([g1, g2, b].map(g => {
const m = g._fullLayout.margin, x = g._fullLayout.xaxis.range;
if (m.l === l && m.r === r && Date.parse(x[0]) === Date.parse(rg[0]) && Date.parse(x[1]) === Date.parse(rg[1])) return;
return Plotly.relayout(g, { "xaxis.range": rg, "margin.l": l, "margin.r": r });
}));
}
function dessineFig(g, m) {
const p = PLOTS[m];
// uirevision : le zoom et les capteurs cachés restent d'un plot à l'autre ; l'ordonnée, propre à chaque plot, se recale
return Plotly.react(g, p.traces.map(t => ({ type: "scatter", mode: t.mode || "lines", marker: { size: 4 }, x: T[t.t], y: t.y, name: t.name,
uid: t.name.replace(/\W/g, "_"), line: t.line,
hovertemplate: `${t.name} : %{y}<br>%{x|%Y-%m-%d %H:%M} UTC<extra></extra>` })),
{ height: 420, hovermode: "closest", plot_bgcolor: "white", margin: marge(), legend: { x: 1.01, y: 1 }, uirevision: 1, shapes: zones(),
xaxis: { type: "date", range: [lisible(A), lisible(B)], gridcolor: "#e6e6e2" },
yaxis: { title: { text: p.titre }, uirevision: p.titre, gridcolor: "#eeeeea", zeroline: false } },
{ responsive: true, doubleClick: "reset" }).then(() => aligne(g));
}
function dessineBarre() {
const t = [...courant.current.labels].sort((a, b) => (a.debut < b.debut ? -1 : 1));
tries.current = t;
const voies = [], voie = t.map(l => { // la première rangée libre, sinon une nouvelle
const r = voies.findIndex(f => f <= l.debut), i = r < 0 ? voies.length : r;
voies[i] = l.fin;
return i;
});
const n = Math.max(1, voies.length), f = fig.current._fullLayout, g = fig2.current._fullLayout;
return Plotly.react(barre.current, [{ type: "bar", orientation: "h", y: voie, base: t.map(l => lisible(l.debut)),
x: t.map(l => Date.parse(l.fin) - Date.parse(l.debut)), width: 0.85, marker: { color: t.map(couleur), line: { color: "white", width: 2 } },
text: t.map(l => (l.categorie ? `[${NOM_FAMILLE(l.categorie)}] ` : "") + l.description),
textposition: "inside", insidetextanchor: "start", textangle: 0, unselected: { marker: { opacity: 1 } }, // sinon une sélection les pâlit
hoverinfo: "none" }], // pas de bulle (le clic lit l'étiquette) ; 'none' garde les événements
{ height: 40 + VOIE * n, dragmode: "select", selectdirection: "h", hovermode: "closest", plot_bgcolor: "#f2f2ef", showlegend: false,
margin: { ...marge(), l: Math.max(f._size.l, g._size.l), r: Math.max(f._size.r, g._size.r) }, uniformtext: { minsize: 9, mode: "hide" },
xaxis: { type: "date", range: f.xaxis.range.slice(), showgrid: false },
yaxis: { range: [n - 0.5, -0.5], fixedrange: true, showticklabels: false, showgrid: false, zeroline: false },
newselection: { line: { color: BLEU, width: 1 } }, activeselection: { fillcolor: BLEU, opacity: 0.25 } },
{ responsive: true, displayModeBar: false, doubleClick: false });
}
// Le premier dessin, puis les événements, une fois
// Le cadre, refait à chaque thème (setTheme d'ECharts efface les séries) : trois grilles sur le même temps ; la molette et le glisser zooment les plots, la réglette les trois
useEffect(() => {
if (!Plotly) return;
Promise.all([dessineFig(fig.current, m1), dessineFig(fig2.current, m2)]).then(dessineBarre).then(() => aligne()).then(() => {
fig.current.on("plotly_relayout", () => aligne(fig.current));
fig2.current.on("plotly_relayout", () => aligne(fig2.current));
barre.current.on("plotly_selected", ev => {
const r = ev?.range?.x;
if (r) setChoix(r.map(v => String(v).slice(0, 16).replace(" ", "T") + "Z"));
});
barre.current.on("plotly_deselect", () => setChoix(null));
barre.current.on("plotly_click", ev => courant.current.ouvrir(tries.current[ev.points[0].pointIndex]));
setPret(true);
const c = echarts.init(boite.current, sombre ? "dark" : null);
graphe.current = c;
const axe = i => ({ gridIndex: i, type: "time", min: ms(A), max: ms(B), axisLabel: { hideOverlap: true } });
c.setOption({
backgroundColor: "transparent", animation: false, useUTC: true, textStyle: { fontFamily: "Roboto, sans-serif" },
grid: [{ left: G.l, right: G.r, top: G.haut1, height: G.h }, { left: G.l, right: G.r, top: G.haut2, height: G.h },
{ left: G.l, right: G.r, top: G.barre, height: VOIE, show: true, borderWidth: 0, backgroundColor: "rgba(128,128,128,0.1)" }],
xAxis: [axe(0), axe(1), { ...axe(2), axisLine: { show: false }, splitLine: { show: false } }],
yAxis: [0, 1].map(g => ({ gridIndex: g, scale: true, nameLocation: "middle", nameGap: 50, nameTextStyle: { fontSize: 11 } }))
.concat({ gridIndex: 2, min: -0.5, max: 0.5, inverse: true, show: false }),
dataZoom: [{ type: "inside", xAxisIndex: [0, 1] },
{ type: "slider", xAxisIndex: [0, 1, 2], filterMode: "weakFilter", left: G.l, right: G.r, height: 20, top: reglette(1),
labelFormatter: v => lisible(iso(v)) }],
legend: { type: "scroll", orient: "vertical", icon: "roundRect", itemWidth: 14, itemHeight: 4, right: 0, top: G.haut1, height: G.haut2 + G.h - G.haut1, textStyle: { fontSize: 11 } },
tooltip: { trigger: "axis", confine: true, textStyle: { fontSize: 11 }, formatter: ps => {
const v = ps.filter(p => p.seriesType === "line" && p.value?.[1] != null);
if (!v.length) return "";
return `<b>${lisible(iso(v[0].value[0]))} UTC</b><div style="display:grid;grid-template-columns:repeat(${v.length > 12 ? 3 : 1},auto);gap:0 14px">`
+ v.map(p => `<span>${p.marker}${p.seriesName} ${+p.value[1].toPrecision(5)}</span>`).join("") + "</div>";
} },
});
return () => [fig, fig2, barre].forEach(g => g.current && Plotly.purge(g.current));
}, [Plotly]);
c.on("click", { seriesId: "barre" }, p => courant.current.ouvrir(courant.current.tries[p.value[3]]));
useEffect(() => { if (pret) dessineFig(fig.current, m1); }, [m1]);
useEffect(() => { if (pret) dessineFig(fig2.current, m2); }, [m2]);
useEffect(() => { if (pret) dessineBarre(); }, [pret, labels]);
useEffect(() => { if (pret) [fig, fig2].forEach(g => Plotly.relayout(g.current, { shapes: zones() })); }, [pret, labels, choix]);
// Glisser sur la barre : la plage choisie, dessinée à même le canvas pendant le geste (les courbes ne sont pas redessinées)
const zr = c.getZr(), dans = e => c.containPixel({ gridIndex: 2 }, [e.offsetX, e.offsetY]);
const valeur = x => c.convertFromPixel({ gridIndex: 2 }, [x, G.barre])[0];
let depart = null, rect = null;
zr.on("mousedown", e => { if (dans(e)) depart = e.offsetX; });
zr.on("mousemove", e => {
if (dans(e)) zr.setCursorStyle(e.target ? "pointer" : "crosshair");
if (depart === null || Math.abs(e.offsetX - depart) < 3) return;
if (!rect) zr.add(rect = new echarts.graphic.Rect({ silent: true, z: 100, style: { fill: BLEU, opacity: 0.25 } }));
rect.setShape({ x: Math.min(depart, e.offsetX), y: G.barre, width: Math.abs(e.offsetX - depart), height: VOIE * courant.current.n });
});
zr.on("mouseup", e => {
if (depart === null) return;
const [a, b] = [valeur(depart), valeur(e.offsetX)].sort((x, y) => x - y), glisse = Math.abs(e.offsetX - depart) >= 3;
if (rect) { zr.remove(rect); rect = null; }
depart = null;
if (glisse) setChoix([iso(a), iso(b)]);
else if (!e.target) setChoix(null); // un clic hors des étiquettes efface la plage
});
zr.on("dblclick", () => c.dispatchAction({ type: "dataZoom", start: 0, end: 100 }));
const suivre = new ResizeObserver(() => c.resize());
suivre.observe(boite.current);
return () => { suivre.disconnect(); c.dispose(); };
}, [sombre]);
// Les courbes, sans échantillonnage (LTTB relie les points par-dessus les trous) : changer de plot remplace les séries ; le zoom et les capteurs cachés dans la légende restent
useEffect(() => {
const lignes = (g, m) => PLOTS[m].traces.map(t => ({
type: "line", name: t.name, xAxisIndex: g, yAxisIndex: g, symbolSize: 4, showSymbol: t.mode === "lines+markers",
lineStyle: { width: t.line?.width, color: t.line?.color, type: t.line?.dash === "dot" ? "dotted" : "solid" }, itemStyle: { color: t.line?.color },
data: temps[t.t].map((x, i) => [x, t.y[i]]) }));
graphe.current.setOption({
legend: { data: [...new Set([...PLOTS[m1].traces, ...PLOTS[m2].traces].map(t => t.name))] },
yAxis: [{ name: PLOTS[m1].titre }, { name: PLOTS[m2].titre }],
series: [...lignes(0, m1), ...lignes(1, m2), ...decor()],
}, { replaceMerge: ["series"] });
}, [m1, m2, sombre]);
// Les étiquettes et la plage choisie ; la barre prend une rangée par chevauchement
useEffect(() => {
const c = graphe.current;
c.setOption({ grid: [{}, {}, { height: VOIE * n }], yAxis: [{}, {}, { max: n - 0.5 }], dataZoom: [{}, { top: reglette(n) }], series: decor() });
c.resize();
}, [labels, choix, sombre]);
// Lues à chaque chargement et à chaque changement de dossier : la page montre toujours le fichier
useEffect(() => {
@@ -149,7 +173,6 @@ function Etiqueteur({ station, d }) {
if (!l) return; // rien n'est perdu : le texte et la plage restent dans la page
setLabels(ls => [...ls, l]);
setAjout({ categorie: "", texte: "" });
await Plotly.relayout(barre.current, { selections: [] });
setChoix(null);
}
@@ -176,13 +199,10 @@ function Etiqueteur({ station, d }) {
<Group gap="md" align="flex-end">
<NativeSelect label="Étiquettes" data={[{ value: "auto", label: "auto (l'étiqueteur)" }, { value: "manual", label: "manual (les tiennes)" }]}
value={source} onChange={e => { const v = e.currentTarget.value; if (ouvrir(null)) setSource(v); }} />
{!pret && <Loader size="sm" />}
<NativeSelect label="Plot du haut" data={options} value={String(m1)} onChange={e => setM1(+e.currentTarget.value)} w={320} maw="100%" />
<NativeSelect label="Plot du bas" data={options} value={String(m2)} onChange={e => setM2(+e.currentTarget.value)} w={320} maw="100%" />
</Group>
<NativeSelect label="Plot" data={options} value={String(m1)} onChange={e => setM1(+e.currentTarget.value)} maw={420} />
<div ref={fig} />
<NativeSelect label="Plot" data={options} value={String(m2)} onChange={e => setM2(+e.currentTarget.value)} maw={420} />
<div ref={fig2} />
<div ref={barre} />
<div ref={boite} style={{ height: reglette(n) + 40 }} />
{ouverte && edit && (
<Card withBorder bg="var(--mantine-color-default-hover)">
<Stack gap="xs">
@@ -201,7 +221,7 @@ function Etiqueteur({ station, d }) {
</Stack>
</Card>
)}
<Text size="sm">{choix ? `${lisible(choix[0])} → ${lisible(choix[1])} UTC` : "Glisser sur la barre ci-dessus pour sélectionner une plage."}</Text>
<Text size="sm">{choix ? `${lisible(choix[0])} → ${lisible(choix[1])} UTC` : "Glisser sur la barre des étiquettes pour sélectionner une plage."}</Text>
<NativeSelect label="Famille" data={CHOIX_FAMILLE} value={ajout.categorie} onChange={e => setAjout({ ...ajout, categorie: e.currentTarget.value })} maw={300} />
<Textarea autosize minRows={3} placeholder="Que voit-on sur cette plage ?" value={ajout.texte}
onChange={e => setAjout({ ...ajout, texte: e.currentTarget.value })} />