From ee42e391e38a8449db5f281d678b88839a73af19 Mon Sep 17 00:00:00 2001 From: Archicratia Date: Wed, 25 Mar 2026 16:48:43 +0100 Subject: [PATCH] refactor(glossaire): centralize aside and home data --- src/components/GlossaryAside.astro | 63 +-- src/components/GlossaryHomeAside.astro | 27 +- src/lib/glossary.ts | 321 +++++++++---- src/pages/glossaire/index.astro | 639 +++++++++++++------------ 4 files changed, 606 insertions(+), 444 deletions(-) diff --git a/src/components/GlossaryAside.astro b/src/components/GlossaryAside.astro index 38f07c8..9e2421d 100644 --- a/src/components/GlossaryAside.astro +++ b/src/components/GlossaryAside.astro @@ -1,14 +1,7 @@ --- import { - familyOf, - getContextualTheory, - getDisplayDomain, - getDisplayFamily, - getDisplayLevel, - getEntriesOfSameFamily, - getFondamentaux, - getRelationSections, - getSameFamilyTitle, + getGlossaryEntryAsideData, + getGlossaryPortalLinks, hrefOfGlossaryEntry, slugOfGlossaryEntry, } from "../lib/glossary"; @@ -19,28 +12,21 @@ const { } = Astro.props; const currentSlug = slugOfGlossaryEntry(currentEntry); -const currentFamily = familyOf(currentEntry); -const fondamentaux = getFondamentaux(allEntries); +const { + displayFamily, + displayDomain, + displayLevel, + showNoyau, + showSameFamily, + fondamentaux, + sameFamilyTitle, + sameFamilyEntries, + relationSections, + contextualTheory, +} = getGlossaryEntryAsideData(currentEntry, allEntries); -const displayFamily = getDisplayFamily(currentEntry); -const displayDomain = getDisplayDomain(currentEntry); -const displayLevel = getDisplayLevel(currentEntry); - -const sameFamilyEntries = getEntriesOfSameFamily(currentEntry, allEntries); -const sameFamilyTitle = getSameFamilyTitle(currentEntry); - -const contextualTheory = getContextualTheory(currentEntry, allEntries); - -const showNoyau = - currentFamily !== "concept-fondamental" && - fondamentaux.length > 0; - -const showSameFamily = - sameFamilyEntries.length > 0 && - currentFamily !== "concept-fondamental"; - -const relationSections = getRelationSections(currentEntry, allEntries); +const portalLinks = getGlossaryPortalLinks(); ---