From e6aa6d7fda8a1b8a2d172351fa882f0cebe45535 Mon Sep 17 00:00:00 2001 From: IliesAllali Date: Tue, 20 Oct 2026 12:58:27 +0200 Subject: [PATCH] =?UTF-8?q?onglets=20:=20deux=20familles=20au=20m=C3=AAme?= =?UTF-8?q?=20nom=20se=20distinguent=20par=20les=20pr=C3=A9noms=20de=20leu?= =?UTF-8?q?r=20charni=C3=A8re?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sauf le plus grand, chaque onglet homonyme prend les prénoms du couple charnière (« Bonnet · Hugo et Françoise »), et la pastille qui y mène porte le même nom. Co-Authored-By: Claude Opus 5.5 --- frontend/src/components/Galaxy.jsx | 5 +++++ frontend/src/components/galaxy/blockLayout.js | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/frontend/src/components/Galaxy.jsx b/frontend/src/components/Galaxy.jsx index 36f1bd3..7478c6f 100644 --- a/frontend/src/components/Galaxy.jsx +++ b/frontend/src/components/Galaxy.jsx @@ -474,6 +474,11 @@ const Galaxy = ({ onPersonSelect, onMediaSelect, selectedPersonId, searchHighlig focusPersonIdRef.current = tab ? tab.referenceId : startRefRef.current const graph = tab?.personIds ? subgraphOf(tab.personIds) : null const result = USE_BLOCK_LAYOUT ? computeBlockLayout(graph, focusPersonIdRef.current, { familyTabs }) : computeLayout(null, focusPersonIdRef.current) + // Les pastilles portent le nom de l'onglet où elles mènent (prénoms ajoutés aux homonymes) + for (const n of result.children) { + const target = n._familyTab && tabsCacheRef.current.tabs.find((tb) => tb.key === n._familyTab.tabKey) + if (target) n._familyTab = { ...n._familyTab, label: target.label, count: target.count } + } // Dans l'onglet d'une belle-famille, chaque charnière (conjoint marié dans la famille d'où l'on vient) // porte le badge de retour if (tab?.parentKey) { diff --git a/frontend/src/components/galaxy/blockLayout.js b/frontend/src/components/galaxy/blockLayout.js index 05875d2..370ab01 100644 --- a/frontend/src/components/galaxy/blockLayout.js +++ b/frontend/src/components/galaxy/blockLayout.js @@ -863,5 +863,20 @@ export function familyTabsOf(graphData = null, referenceId = null) { tabs.push({ key, referenceId: key, parentKey: tab.key, personIds: new Set([...f.members, ...f.hinges]), hinges: f.hinges, label: f.label, count: f.count }) } } + // Deux onglets au même nom (homonymes, ou une branche sortie de sa propre lignée) : sauf le plus grand, chacun + // prend les prénoms de sa charnière, ceux que porte la pastille qui y mène (Patch, 20/10 : « plusieurs fois + // les mêmes familles ») + const firstName = new Map((graphData?.persons || globalPersons).map(p => [String(p.id), p.firstName])) + const byLabel = new Map() + for (const tb of tabs) { if (!byLabel.has(tb.label)) byLabel.set(tb.label, []); byLabel.get(tb.label).push(tb) } + for (const group of byLabel.values()) { + if (group.length < 2) continue + const biggest = group.reduce((a, b) => (b.count > a.count ? b : a)) + for (const tb of group) { + if (tb === biggest) continue + const names = [...new Set((tb.hinges || [tb.referenceId]).map(id => firstName.get(String(id))).filter(Boolean))].slice(0, 2) + if (names.length) tb.label = `${tb.label} · ${names.join(' et ')}` + } + } return tabs }