feat(plugins): content-pages + legal-pages (Phase 4.1 + 4.3)
Plugin content-pages : - Modèle Prisma ContentPage (slug PK, title, body markdown, category, published) - lib/content-pages.ts : helpers upsert/get/list/unpublish - lib/markdown.ts : mini-renderer markdown server-side sans deps externe (h1-h3, paragraphes, gras/italique, liens, listes ul/ol, hr, blockquote, échappement HTML) - ContentPageRenderer server component, applique le theme Guyane (font-serif) - 5 pages seedées : /a-propos, /faq, /comment-ca-marche, /pour-comites-entreprise, /devenir-loueur - Routes publiques + force-dynamic + guard requirePluginOr404 Plugin legal-pages : - Réutilise le même modèle ContentPage, catégorie 'legal' - 3 pages seedées : /cgv, /mentions-legales, /politique-de-confidentialite (contenu de base, à valider par avocat avant prod réelle) Admin : - /admin/content-pages : table par catégorie, statut publié/dépublié - /admin/content-pages/[slug] : éditeur markdown + toggle publié - PATCH /api/admin/content-pages/[slug] Hooks plugin : - onEnable seed + republish toutes les pages - onDisable dépublie toute la catégorie sans la supprimer (preserve les edits)
This commit is contained in:
parent
ae8f79b436
commit
68f37f554f
20 changed files with 1116 additions and 0 deletions
18
src/app/a-propos/page.tsx
Normal file
18
src/app/a-propos/page.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { notFound } from "next/navigation";
|
||||
import { getContentPage } from "@/lib/content-pages";
|
||||
import { isPluginEnabled } from "@/lib/plugins/server";
|
||||
import { ContentPageRenderer } from "@/components/ContentPageRenderer";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata() {
|
||||
const page = await getContentPage("a-propos");
|
||||
return { title: page?.title ?? "À propos" };
|
||||
}
|
||||
|
||||
export default async function AboutPage() {
|
||||
if (!(await isPluginEnabled("content-pages"))) notFound();
|
||||
const page = await getContentPage("a-propos");
|
||||
if (!page) notFound();
|
||||
return <ContentPageRenderer page={page} />;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue