Sépare données et affichage pour basculer vers Payload CMS sans réécrire les composants. Nouveaux fichiers : - lib/site-config.ts : source unique de vérité pour toutes les données du site (as const) - lib/content.ts : couche async entre données et composants (static aujourd'hui, Payload demain) - types/content.ts : types TypeScript partagés (Service, Realisation, Partner, BlogPost, etc.) - payload/ : schémas CollectionConfig et GlobalConfig commentés prêts à activer Données enrichies dans siteConfig : - partners : ajout du champ desc pour chaque partenaire - realisations : 6 entrées complètes avec categorie et color - blogPosts : 6 articles avec slug, titre, extrait, cat, date, readTime Refactorisations (composants → content layer) : - Navbar, Footer : importent siteConfig directement (client component) - app/page.tsx : async, Promise.all sur getServices/getTestimonials/getFAQ/getValues/getPartners/getRealisations - app/services/page.tsx : getServices() + getSiteConfig() - app/contact/page.tsx : getSiteConfig() pour phone, email, address, zones - app/realisations/page.tsx : getRealisations() + getSiteConfig() - app/partenaires/page.tsx : getPartners() - app/blog/page.tsx : getBlogPosts() - app/blog/[slug]/page.tsx : getBlogPost() + getBlogPosts() pour generateStaticParams - LocalSEOPage.tsx : siteConfig pour services list, phone, address - 5 pages service (construction-maison, renovation, assainissement, creation-acces, demolition) : getSiteConfig() pour phone - Pages légales et SEO locales : siteConfig importé pour données dynamiques Corrections URL : - Toutes les URLs canoniques obc-maconnerie.fr → obc-terrassement.fr (30+ fichiers) - layout.tsx : BASE_URL depuis siteConfig.url - robots.ts, sitemap.ts : BASE_URL depuis siteConfig.url - api/contact/route.ts : email fallback → obc-terrassement.fr https://claude.ai/code/session_01Uec4iHjcPwB1pU41idWEdF
63 lines
1.0 KiB
TypeScript
63 lines
1.0 KiB
TypeScript
// types/content.ts
|
|
// Types partagés entre lib/content.ts et les composants.
|
|
// Ces types correspondent exactement aux schémas Payload CMS futurs
|
|
// définis dans /payload/collections/*.ts
|
|
|
|
export type NavItem = {
|
|
label: string;
|
|
href: string;
|
|
};
|
|
|
|
export type Service = {
|
|
slug: string;
|
|
title: string;
|
|
shortDescription: string;
|
|
longDescription: string;
|
|
icon: string;
|
|
keywords: string[];
|
|
};
|
|
|
|
export type Realisation = {
|
|
title: string;
|
|
ville: string;
|
|
service: string;
|
|
categorie: string;
|
|
description: string;
|
|
color: string;
|
|
image: string;
|
|
};
|
|
|
|
export type Testimonial = {
|
|
name: string;
|
|
ville: string;
|
|
service: string;
|
|
text: string;
|
|
rating: number;
|
|
};
|
|
|
|
export type FAQItem = {
|
|
question: string;
|
|
answer: string;
|
|
};
|
|
|
|
export type Partner = {
|
|
label: string;
|
|
icon: string;
|
|
desc: string;
|
|
};
|
|
|
|
export type BlogPost = {
|
|
slug: string;
|
|
titre: string;
|
|
extrait: string;
|
|
cat: string;
|
|
date: string;
|
|
readTime: string;
|
|
};
|
|
|
|
export type Value = {
|
|
title: string;
|
|
description: string;
|
|
icon: string;
|
|
};
|