feat: complete dynamic JSON-driven photo tools frontend connected to FastAPI backend

This commit is contained in:
2026-11-03 12:24:43 +05:30
commit fa2eca3643
91 changed files with 11372 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
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',
};
return (
<div>
{page.sections.map((section) => (
<SectionRenderer key={section.id} section={section} context={context} />
))}
</div>
);
}