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>

View File

@@ -1,8 +1,8 @@
---
import {
countGlossaryEntriesByFamily,
countGlossaryEntriesByKind,
getFondamentaux,
getGlossaryHomeStats,
getGlossaryPortalLinks,
hrefOfGlossaryEntry,
} from "../lib/glossary";
@@ -11,23 +11,14 @@ const {
} = Astro.props;
const fondamentaux = getFondamentaux(allEntries);
const portalLinks = getGlossaryPortalLinks();
const totalEntries = allEntries.length;
const paradigmesCount = countGlossaryEntriesByKind(allEntries, "paradigme");
const doctrinesCount = countGlossaryEntriesByKind(allEntries, "doctrine");
const metaRegimesCount = countGlossaryEntriesByFamily(allEntries, "meta-regime");
const portalLinks = [
{ href: "/glossaire/concepts-fondamentaux/", label: "Concepts fondamentaux" },
{ href: "/glossaire/index-complet/", label: "Index complet" },
{ href: "/glossaire/paradigme-archicratique/", label: "Paradigme archicratique" },
{ href: "/glossaire/scenes-archicratiques/", label: "Scènes archicratiques" },
{ href: "/glossaire/dynamiques-archicratiques/", label: "Dynamiques archicratiques" },
{ href: "/glossaire/tensions-irreductibles/", label: "Tensions irréductibles" },
{ href: "/glossaire/archicrations/", label: "Méta-régimes archicratiques" },
{ href: "/glossaire/paradigmes/", label: "Paradigmes et doctrines" },
{ href: "/glossaire/verbes-de-la-scene/", label: "Verbes de la scène" },
];
const {
totalEntries,
paradigmesCount,
doctrinesCount,
metaRegimesCount,
} = getGlossaryHomeStats(allEntries);
---
<nav class="glossary-home-aside" aria-label="Navigation du portail du glossaire">