Files
ayristech_new/app/[lang]/[slug]/page.tsx
T
2026-05-30 18:23:21 +03:00

43 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { getDemoBySlug, demos } from "@/data/demos";
import KlinikTemplate from "@/components/templates/KlinikTemplate";
import RestoranTemplate from "@/components/templates/RestoranTemplate";
import KurumsalTemplate from "@/components/templates/KurumsalTemplate";
import DentalTemplate from "@/components/templates/DentalTemplate";
import RestoranTemplate2 from "@/components/templates/RestoranTemplate2";
import { notFound } from "next/navigation";
import { i18n, Locale } from "@/i18n-config";
export async function generateStaticParams() {
const paths: Array<{ lang: Locale; slug: string }> = [];
const demoList = Object.keys(demos);
for (const lang of i18n.locales) {
for (const slug of demoList) {
paths.push({ lang, slug });
}
}
return paths;
}
export async function generateMetadata({ params }: { params: Promise<{ lang: Locale; slug: string }> }) {
const { slug } = await params;
const data = getDemoBySlug(slug);
if (!data) return { title: "Demo Bulunamadı | Ayris Tech" };
return {
title: `${data.firma.adi} — Premium Arayüz Demosu`,
description: data.firma.slogan,
};
}
export default async function DemoPage({ params }: { params: Promise<{ lang: Locale; slug: string }> }) {
const { slug } = await params;
const data = getDemoBySlug(slug);
if (!data) notFound();
if (data.template === "klinik") return <KlinikTemplate data={data} />;
if (data.template === "restoran") return <RestoranTemplate data={data} />;
if (data.template === "kurumsal") return <KurumsalTemplate data={data} />;
if (data.template === "dental") return <DentalTemplate data={data} />;
if (data.template === "restoran2") return <RestoranTemplate2 data={data} />;
notFound();
}