refactor(glossaire): centralize aside and home data
All checks were successful
SMOKE / smoke (push) Successful in 5s
CI / build-and-anchors (push) Successful in 48s
CI / build-and-anchors (pull_request) Successful in 43s

This commit is contained in:
2026-03-25 16:48:43 +01:00
parent f7756be59e
commit ee42e391e3
4 changed files with 606 additions and 444 deletions

View File

@@ -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();
---
<nav class="glossary-aside" aria-label="Navigation du glossaire">
@@ -52,20 +38,23 @@ const relationSections = getRelationSections(currentEntry, allEntries);
<span class="glossary-aside__pill glossary-aside__pill--family">
{displayFamily}
</span>
<span class="glossary-aside__pill">{displayDomain}</span>
<span class="glossary-aside__pill">{displayLevel}</span>
{displayDomain && (
<span class="glossary-aside__pill">{displayDomain}</span>
)}
{displayLevel && (
<span class="glossary-aside__pill">{displayLevel}</span>
)}
</div>
</div>
<section class="glossary-aside__block">
<h2 class="glossary-aside__heading">Portails</h2>
<ul class="glossary-aside__list">
<li><a href="/glossaire/">Accueil du glossaire</a></li>
<li><a href="/glossaire/index-complet/">Index complet</a></li>
<li><a href="/glossaire/paradigme-archicratique/">Paradigme archicratique</a></li>
<li><a href="/glossaire/archicrations/">Archicrations</a></li>
<li><a href="/glossaire/paradigmes/">Paradigmes et doctrines</a></li>
<li><a href="/glossaire/tensions-irreductibles/">Tensions irréductibles</a></li>
{portalLinks.map((item) => (
<li><a href={item.href}>{item.label}</a></li>
))}
</ul>
</section>