diff --git a/src/assets/background.svg b/src/assets/background.svg deleted file mode 100644 index 4b2be0a..0000000 --- a/src/assets/background.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/components/ContentSearch.astro b/src/components/ContentSearch.astro index a25171a..6e64406 100644 --- a/src/components/ContentSearch.astro +++ b/src/components/ContentSearch.astro @@ -1,15 +1,24 @@ --- import type { CollectionEntry } from "astro:content"; -import GoldButton from "./ui/GoldButton.astro"; -import CodexCard from "./ui/CodexCard.astro"; - interface Props { - posts: CollectionEntry<"journal" | "logs" | "codex">[]; + posts: CollectionEntry<"journal">[]; tags: string[]; - basePath: "journal" | "logs" | "codex"; + basePath: "journal"; } - const { posts, tags, basePath } = Astro.props; + +// Groupement simple +const groupedTags: Record = { Général: [] }; +tags.forEach((tag) => { + if (tag.includes(":")) { + const cat = tag.split(":")[0]; + const catName = cat.charAt(0).toUpperCase() + cat.slice(1); + if (!groupedTags[catName]) groupedTags[catName] = []; + groupedTags[catName].push(tag); + } else { + groupedTags["Général"].push(tag); + } +}); ---
@@ -17,174 +26,190 @@ const { posts, tags, basePath } = Astro.props;
-
- - { - tags.map((tag) => ( - - )) - } +
+
+ Filtres : + + { + Object.keys(groupedTags).map( + (cat) => + cat !== "Général" && ( + + ), + ) + } +
+
+ { + Object.entries(groupedTags).map(([category, categoryTags]) => ( +
+ {categoryTags.map((tag) => ( + + ))} +
+ )) + } +
{ - basePath === "codex" - ? posts.map((post) => ( - } /> - )) - : posts.map((post) => ( - - )) + posts.map((post) => ( + +
{post.data.title}
+

+ Publié le{" "} + {new Date(post.data.publishDate).toLocaleDateString( + "fr-FR", + )} +

+
+ )) }
- -
diff --git a/src/content/journal/eveil.md b/src/content/journal/eveil.md index 43a85db..247f702 100644 --- a/src/content/journal/eveil.md +++ b/src/content/journal/eveil.md @@ -2,7 +2,22 @@ title: "L'Éveil du Cul Brillant" author: "G'Mas" publishDate: 2026-01-10 -tags: ["Yeuze-sur-Chenarde", "Exploration", "Gurdil", "Bulle", "Social", "Mystère"] +tags: [ + "lieu:Yeuze-sur-Chenarde", + "lieu:Grand-Chêne", + "lieu:Mine", + "aventurier:Gmas", + "aventurier:Nyrae", + "aventurier:Bulle", + "aventurier:Gurdil", + "aventurier:Jinn", + "perso:Kwel", + "perso:Mara", + "plot:Enfants-Disparus", + "plot:Cul-Brillant", + "plot:Mystère", + "lore:Légendes" +] --- ### Chroniques de Yeuze-sur-Chenarde diff --git a/src/content/journal/obscur.md b/src/content/journal/obscur.md index e4ddf76..0315c1f 100644 --- a/src/content/journal/obscur.md +++ b/src/content/journal/obscur.md @@ -2,7 +2,21 @@ title: "Le Murmure des Rouages" author: "G'Mas" publishDate: 2026-01-18 -tags: ["Mine", "Combat", "Kruthik", "Nyrae", "Jinn", "Vase Grise"] +tags: [ + "lieu:Yeuze-sur-Chenarde", + "lieu:Mine", + "aventurier:Gmas", + "aventurier:Nyrae", + "aventurier:Bulle", + "aventurier:Gurdil", + "aventurier:Jinn", + "perso:Maielan", + "mobs:Kruthik", + "mobs:Vase-Grise", + "plot:Enfants-Disparus", + "plot:Cul-Brillant", + "event:Combat" +] --- ### Les Griffes de l'Obscurité diff --git a/src/content/journal/sang.md b/src/content/journal/sang.md index fbbb663..cfaff3e 100644 --- a/src/content/journal/sang.md +++ b/src/content/journal/sang.md @@ -2,7 +2,25 @@ title: "Le printemps sanglant" author: "G'Mas" publishDate: 2026-02-08 -tags: ["Vampire","Enfant perdu", "Maçonnerie"] +tags: [ + "lieu:Yeuze-sur-Chenarde", + "lieu:Mine", + "lieu:Grand-Chêne", + "aventurier:Gmas", + "aventurier:Nyrae", + "aventurier:Bulle", + "aventurier:Gurdil", + "aventurier:Jinn", + "perso:Kwel", + "perso:Maielan", + "antagoniste:Constancia-Denney", + "plot:Enfants-Disparus", + "plot:Cul-Brillant", + "plot:Couronne-d-Argent", + "lore:Eladrin", + "event:Combat", + "event:Level-Up" +] --- ## L'Ombre de Constancia diff --git a/src/layouts/GameLayout.astro b/src/layouts/GameLayout.astro index 192ace3..62ed8ef 100644 --- a/src/layouts/GameLayout.astro +++ b/src/layouts/GameLayout.astro @@ -1,10 +1,8 @@ --- import { ClientRouter } from "astro:transitions"; - interface Props { title: string; } - const { title } = Astro.props; --- @@ -12,14 +10,8 @@ const { title } = Astro.props; - - - - - {title} + + {title} | Hebel @@ -30,283 +22,163 @@ const { title } = Astro.props; diff --git a/src/pages/index.astro b/src/pages/index.astro new file mode 100644 index 0000000..cd90971 --- /dev/null +++ b/src/pages/index.astro @@ -0,0 +1,25 @@ +--- +import { getCollection } from "astro:content"; +import GameLayout from "../layouts/GameLayout.astro"; +import ContentSearch from "../components/ContentSearch.astro"; + +// 1. Récupère TOUS les articles et les trie. +const allPosts = await getCollection("journal"); +const sortedPosts = allPosts.sort( + (a, b) => b.data.publishDate.valueOf() - a.data.publishDate.valueOf(), +); + +// 2. Extrait toutes les balises uniques +const allTags = [...new Set(allPosts.flatMap((post) => post.data.tags || []))]; +--- + + +

📖 Journal d'Aventure

+

+ Les chroniques de nos voyages. Utilisez la barre de recherche pour + trouver un récit. +

+ + + +
diff --git a/src/pages/journal/[...slug].astro b/src/pages/journal/[...slug].astro index 94b403b..ceb4ca8 100644 --- a/src/pages/journal/[...slug].astro +++ b/src/pages/journal/[...slug].astro @@ -1,5 +1,4 @@ --- -// 1. Ajoute "render" dans ton import import { getCollection, render } from "astro:content"; import GameLayout from "../../layouts/GameLayout.astro"; @@ -12,136 +11,114 @@ export async function getStaticPaths() { } const { entry } = Astro.props; +if (!entry) return Astro.redirect("/404"); -if (!entry) { - return Astro.redirect("/404"); -} - -// 2. Utilise la fonction render(entry) au lieu de entry.render() const { Content } = await render(entry); --- -
-
-
-

{entry.data.title}

-

- Savoir acquis le : { - entry.data.publishDate.toLocaleDateString("fr-FR", { - year: "numeric", - month: "long", - day: "numeric", - }) - } -

-
+ -
+
+ +
+
diff --git a/src/pages/journal/index.astro b/src/pages/journal/index.astro deleted file mode 100644 index f82934c..0000000 --- a/src/pages/journal/index.astro +++ /dev/null @@ -1,26 +0,0 @@ ---- -import { getCollection } from 'astro:content'; -import GameLayout from '../../layouts/GameLayout.astro'; -import ContentSearch from '../../components/ContentSearch.astro'; - -// 1. Récupère TOUS les articles et les trie. -const allPosts = await getCollection('journal'); -const sortedPosts = allPosts.sort( - (a, b) => b.data.publishDate.valueOf() - a.data.publishDate.valueOf() -); - -// 2. Extrait toutes les balises uniques -const allTags = [...new Set(allPosts.flatMap(post => post.data.tags || []))]; - ---- - - -

📖 Journal d'Aventure

-

- Les chroniques de nos voyages. Utilisez la barre de recherche pour trouver un récit. -

- - - - -
\ No newline at end of file diff --git a/src/pages/journal/tags/[tag].astro b/src/pages/journal/tags/[tag].astro index 4fe20c8..3fa3a0c 100644 --- a/src/pages/journal/tags/[tag].astro +++ b/src/pages/journal/tags/[tag].astro @@ -1,47 +1,75 @@ --- +// [tag].astro import { getCollection } from "astro:content"; import GameLayout from "../../../layouts/GameLayout.astro"; import GoldButton from "../../../components/ui/GoldButton.astro"; export async function getStaticPaths() { const allPosts = await getCollection("journal"); - const allTags = [ - ...new Set(allPosts.flatMap((post) => post.data.tags || [])), - ]; - - return allTags.map((tag) => { - const filteredPosts = allPosts.filter((post) => - post.data.tags?.includes(tag), - ); - return { - params: { tag }, - props: { posts: filteredPosts }, - }; - }); + const tags = [...new Set(allPosts.flatMap((p) => p.data.tags || []))]; + return tags.map((tag) => ({ + params: { tag: tag.toLowerCase() }, + props: { + posts: allPosts.filter((p) => p.data.tags?.includes(tag)), + originalTag: tag, + }, + })); } - -const { tag } = Astro.params; -const { posts } = Astro.props; +const { posts, originalTag } = Astro.props; --- - -

Récits avec la balise : {tag}

+ +
+ ← Retour au Journal -
- { - posts.map((post) => ( - - )) - } +
+

+ Récits marqués : { + originalTag.includes(":") + ? originalTag.split(":")[1] + : originalTag + } +

+
+ +
+ { + posts.map((post) => ( + + )) + } +