mirror of
https://github.com/hanzo-apps/gallery.git
synced 2026-11-02 21:25:15 +00:00
Docs, Pricing, About, Terms, Privacy and License pointed at routes this export never had; they now name the pages that exist (docs.hanzo.ai, hanzo.ai, the repository's LICENSE). The per-variant Info links named slugs no page was generated for; every template slug is generated now. The sans face is exported as Zen, so the layout imports that name. Co-Authored-By: Claude Opus 5.5 <[email protected]>
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import { templates } from '../../templates-data';
|
|
import { notFound } from 'next/navigation';
|
|
import { getTemplateVariants, getUniqueTemplates } from '../../lib/template-utils';
|
|
import { TemplatePageClient } from './TemplatePageClient';
|
|
|
|
interface PageProps {
|
|
params: Promise<{ slug: string }>;
|
|
}
|
|
|
|
// Every slug a page links to: the consolidated one each group is listed under,
|
|
// and each variant's own, which the gallery's per-variant Info links name.
|
|
export async function generateStaticParams() {
|
|
const slugs = new Set([
|
|
...getUniqueTemplates(templates).map((template) => template.slug),
|
|
...templates.map((template) => template.slug),
|
|
]);
|
|
return [...slugs].map((slug) => ({ slug }));
|
|
}
|
|
|
|
export default async function TemplatePage({ params }: PageProps) {
|
|
const { slug } = await params;
|
|
const allVariants = getTemplateVariants(templates, slug);
|
|
|
|
if (allVariants.length === 0) {
|
|
notFound();
|
|
}
|
|
|
|
// Get unique templates for navigation
|
|
const uniqueTemplates = getUniqueTemplates(templates);
|
|
const currentIndex = uniqueTemplates.findIndex(t => t.slug === slug);
|
|
|
|
const prevTemplate = currentIndex > 0 ? uniqueTemplates[currentIndex - 1] : null;
|
|
const nextTemplate = currentIndex < uniqueTemplates.length - 1 ? uniqueTemplates[currentIndex + 1] : null;
|
|
|
|
return (
|
|
<TemplatePageClient
|
|
variants={allVariants}
|
|
prevTemplate={prevTemplate}
|
|
nextTemplate={nextTemplate}
|
|
currentIndex={currentIndex + 1}
|
|
totalTemplates={uniqueTemplates.length}
|
|
allTemplates={uniqueTemplates}
|
|
/>
|
|
);
|
|
}
|