54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
import { notFound } from "next/navigation";
|
|
import { locales, type Locale } from "@/lib/dictionaries";
|
|
import { getPlanPage, getPlanPages, getPlansDict } from "./pricing";
|
|
import PlansContent from "./PlansContent";
|
|
import type { Metadata } from "next";
|
|
|
|
export function generateStaticParams() {
|
|
return locales.flatMap((locale) =>
|
|
getPlanPages().map((page) => ({ locale, code: page.code })),
|
|
);
|
|
}
|
|
|
|
export const dynamicParams = false;
|
|
|
|
export async function generateMetadata({
|
|
params,
|
|
}: {
|
|
params: Promise<{ locale: string }>;
|
|
}): Promise<Metadata> {
|
|
const { locale } = await params;
|
|
const isSR = locale === "sr";
|
|
return {
|
|
title: isSR ? "Paketi i cijene" : "Plans & pricing",
|
|
robots: {
|
|
index: false,
|
|
follow: false,
|
|
noarchive: true,
|
|
nosnippet: true,
|
|
googleBot: { index: false, follow: false },
|
|
},
|
|
alternates: { canonical: null },
|
|
};
|
|
}
|
|
|
|
export default async function PlansPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ locale: string; code: string }>;
|
|
}) {
|
|
const { locale, code } = await params;
|
|
|
|
const page = getPlanPage(code);
|
|
if (!page) {
|
|
notFound();
|
|
}
|
|
|
|
return (
|
|
<PlansContent
|
|
locale={locale as Locale}
|
|
plans={getPlansDict(locale, page)}
|
|
/>
|
|
);
|
|
}
|