2026-11-03 12:24:43 +05:30
|
|
|
import { getPageConfig, getAllTools, getAllApps, getAllCategories, getToolById, getAppById } from '@/lib/config/loader';
|
|
|
|
|
import { getEndpointById } from '@/lib/catalog/loader';
|
|
|
|
|
import { SectionRenderer } from '@/components/sections/SectionRenderer';
|
|
|
|
|
import { notFound } from 'next/navigation';
|
|
|
|
|
|
|
|
|
|
export const revalidate = 600; // ISR 10 minutes fallback per PRD §4.2
|
|
|
|
|
|
|
|
|
|
export default function HomePage() {
|
|
|
|
|
const page = getPageConfig('home');
|
|
|
|
|
if (!page) notFound();
|
|
|
|
|
|
|
|
|
|
const tools = getAllTools();
|
|
|
|
|
const apps = getAllApps();
|
|
|
|
|
const categories = getAllCategories();
|
|
|
|
|
|
|
|
|
|
// Find hero tool and variants
|
|
|
|
|
const heroTool = getToolById('face.blemish.remove') || tools[0];
|
|
|
|
|
const heroApp = heroTool ? getAppById(heroTool.homeApp) : null;
|
|
|
|
|
const endpoint = heroTool?.tryIt?.endpointRef?.id ? getEndpointById(heroTool.tryIt.endpointRef.id) : undefined;
|
|
|
|
|
const variants = endpoint?.variants || [];
|
|
|
|
|
|
|
|
|
|
const context = {
|
|
|
|
|
page,
|
|
|
|
|
tools,
|
|
|
|
|
apps,
|
|
|
|
|
categories,
|
|
|
|
|
tool: heroTool,
|
|
|
|
|
homeApp: heroApp,
|
|
|
|
|
variants,
|
|
|
|
|
locale: 'en',
|
|
|
|
|
};
|
|
|
|
|
|
2026-11-03 12:43:34 +05:30
|
|
|
// Structured Data (JSON-LD) for WebSite and FAQPage (PRD §10 SEO-07)
|
|
|
|
|
const faqSection = page.sections.find((s) => s.type === 'faq');
|
|
|
|
|
const faqItems = faqSection?.props?.items || [];
|
|
|
|
|
|
|
|
|
|
const jsonLdData = [
|
|
|
|
|
{
|
|
|
|
|
'@context': 'https://schema.org',
|
|
|
|
|
'@type': 'WebSite',
|
|
|
|
|
name: 'CRE Innovations',
|
|
|
|
|
url: 'http://localhost:3000',
|
|
|
|
|
potentialAction: {
|
|
|
|
|
'@type': 'SearchAction',
|
|
|
|
|
target: 'http://localhost:3000/tools?q={search_term_string}',
|
|
|
|
|
'query-input': 'required name=search_term_string',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'@context': 'https://schema.org',
|
|
|
|
|
'@type': 'FAQPage',
|
|
|
|
|
mainEntity: faqItems.map((item: any) => ({
|
|
|
|
|
'@type': 'Question',
|
|
|
|
|
name: item.q,
|
|
|
|
|
acceptedAnswer: {
|
|
|
|
|
'@type': 'Answer',
|
|
|
|
|
text: item.a,
|
|
|
|
|
},
|
|
|
|
|
})),
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2026-11-03 12:24:43 +05:30
|
|
|
return (
|
|
|
|
|
<div>
|
2026-11-03 12:43:34 +05:30
|
|
|
<script
|
|
|
|
|
type="application/ld+json"
|
|
|
|
|
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLdData) }}
|
|
|
|
|
/>
|
2026-11-03 12:24:43 +05:30
|
|
|
{page.sections.map((section) => (
|
|
|
|
|
<SectionRenderer key={section.id} section={section} context={context} />
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|