From e6c18d6b1626f606b6f0cb91375ec03e0ac50a05 Mon Sep 17 00:00:00 2001 From: Archicratia Date: Wed, 25 Mar 2026 19:18:58 +0100 Subject: [PATCH] refactor(glossaire): componentize glossary entry page --- src/components/GlossaryEntryBody.astro | 16 + src/components/GlossaryEntryHero.astro | 203 +++++++++ src/components/GlossaryEntryLegacyNote.astro | 31 ++ src/components/GlossaryEntryStickySync.astro | 172 +++++++ src/components/GlossaryRelationCards.astro | 57 +++ src/pages/glossaire/[...slug].astro | 449 +------------------ 6 files changed, 500 insertions(+), 428 deletions(-) create mode 100644 src/components/GlossaryEntryBody.astro create mode 100644 src/components/GlossaryEntryHero.astro create mode 100644 src/components/GlossaryEntryLegacyNote.astro create mode 100644 src/components/GlossaryEntryStickySync.astro diff --git a/src/components/GlossaryEntryBody.astro b/src/components/GlossaryEntryBody.astro new file mode 100644 index 0000000..46e2cc2 --- /dev/null +++ b/src/components/GlossaryEntryBody.astro @@ -0,0 +1,16 @@ +
+ +
+ + \ No newline at end of file diff --git a/src/components/GlossaryEntryHero.astro b/src/components/GlossaryEntryHero.astro new file mode 100644 index 0000000..2b0ba9a --- /dev/null +++ b/src/components/GlossaryEntryHero.astro @@ -0,0 +1,203 @@ +--- +interface Props { + term: string; + definitionShort: string; + displayFamily: string; + displayDomain?: string; + displayLevel?: string; + mobilizedAuthors?: string[]; + comparisonTraditions?: string[]; +} + +const { + term, + definitionShort, + displayFamily, + displayDomain = "", + displayLevel = "", + mobilizedAuthors = [], + comparisonTraditions = [], +} = Astro.props; + +const hasScholarlyMeta = + mobilizedAuthors.length > 0 || + comparisonTraditions.length > 0; +--- + +
+
+

{term}

+
+ +
+

+ {definitionShort} +

+ +
+ + Famille : {displayFamily} + + + {displayDomain && ( + + Domaine : {displayDomain} + + )} + + {displayLevel && ( + + Niveau : {displayLevel} + + )} +
+ + {hasScholarlyMeta && ( + + )} +
+
+ + \ No newline at end of file diff --git a/src/components/GlossaryEntryLegacyNote.astro b/src/components/GlossaryEntryLegacyNote.astro new file mode 100644 index 0000000..aaf3b70 --- /dev/null +++ b/src/components/GlossaryEntryLegacyNote.astro @@ -0,0 +1,31 @@ +--- +interface Props { + canonicalHref: string; + term: string; +} + +const { canonicalHref, term } = Astro.props; +--- + +

+ Cette entrée a été renommée. L’intitulé canonique est : + {term}. +

+ + \ No newline at end of file diff --git a/src/components/GlossaryEntryStickySync.astro b/src/components/GlossaryEntryStickySync.astro new file mode 100644 index 0000000..b433496 --- /dev/null +++ b/src/components/GlossaryEntryStickySync.astro @@ -0,0 +1,172 @@ + + + \ No newline at end of file diff --git a/src/components/GlossaryRelationCards.astro b/src/components/GlossaryRelationCards.astro index 0f800ea..2754b49 100644 --- a/src/components/GlossaryRelationCards.astro +++ b/src/components/GlossaryRelationCards.astro @@ -30,3 +30,60 @@ const { relationBlocks = [] } = Astro.props; )} + + \ No newline at end of file diff --git a/src/pages/glossaire/[...slug].astro b/src/pages/glossaire/[...slug].astro index 4f86787..da1e32b 100644 --- a/src/pages/glossaire/[...slug].astro +++ b/src/pages/glossaire/[...slug].astro @@ -2,6 +2,10 @@ import GlossaryLayout from "../../layouts/GlossaryLayout.astro"; import GlossaryAside from "../../components/GlossaryAside.astro"; import GlossaryRelationCards from "../../components/GlossaryRelationCards.astro"; +import GlossaryEntryLegacyNote from "../../components/GlossaryEntryLegacyNote.astro"; +import GlossaryEntryHero from "../../components/GlossaryEntryHero.astro"; +import GlossaryEntryBody from "../../components/GlossaryEntryBody.astro"; +import GlossaryEntryStickySync from "../../components/GlossaryEntryStickySync.astro"; import { getCollection, render } from "astro:content"; import { getDisplayDomain, @@ -61,10 +65,6 @@ const relationBlocks = getRelationBlocks(entry, allEntries); const displayFamily = getDisplayFamily(entry); const displayDomain = getDisplayDomain(entry); const displayLevel = getDisplayLevel(entry); - -const hasScholarlyMeta = - (entry.data.mobilizedAuthors?.length ?? 0) > 0 || - (entry.data.comparisonTraditions?.length ?? 0) > 0; --- {isAliasRoute && ( -

- Cette entrée a été renommée. L’intitulé canonique est : - {entry.data.term}. -

+ )} -
-
-

{entry.data.term}

-
+ -
-

- {entry.data.definitionShort} -

- -
- - Famille : {displayFamily} - - - {displayDomain && ( - - Domaine : {displayDomain} - - )} - - {displayLevel && ( - - Niveau : {displayLevel} - - )} -
- - {hasScholarlyMeta && ( - - )} -
-
- -
+ -
+ -
- - - \ No newline at end of file + + \ No newline at end of file