fix(website): update all route/layout params to Promise for Next.js 16

Next.js 15+ requires params to be typed as Promise<{...}> and awaited.
Fixed 17 files: all [locale] pages, layouts, and blog [slug] page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-05-28 22:45:29 +03:30
parent 5f4ec511cb
commit 98a7efc719
17 changed files with 71 additions and 70 deletions
+4 -4
View File
@@ -7,8 +7,8 @@ import { Target, Heart, Lightbulb } from "lucide-react";
const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir"; const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
export async function generateMetadata({ params }: { params: { locale: string } }): Promise<Metadata> { export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { return {
title: t("aboutTitle"), title: t("aboutTitle"),
@@ -52,8 +52,8 @@ const STATS = [
{ valueFa: "تهران", valueEn: "Tehran", labelFa: "مقر اصلی", labelEn: "Headquartered" }, { valueFa: "تهران", valueEn: "Tehran", labelFa: "مقر اصلی", labelEn: "Headquartered" },
]; ];
export default async function AboutPage({ params }: { params: { locale: string } }) { export default async function AboutPage({ params }: { params: Promise<{ locale: string }> }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const isEn = locale === "en"; const isEn = locale === "en";
return ( return (
@@ -13,9 +13,10 @@ import { ArrowLeft, ArrowRight, Clock, Calendar } from "lucide-react";
export async function generateStaticParams({ export async function generateStaticParams({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}) { }) {
const posts = getAllPosts(params.locale as "fa" | "en"); const { locale } = await params;
const posts = getAllPosts(locale as "fa" | "en");
return posts.map((p) => ({ slug: p.slug })); return posts.map((p) => ({ slug: p.slug }));
} }
@@ -24,9 +25,9 @@ const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string; slug: string }; params: Promise<{ locale: string; slug: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale, slug } = await Promise.resolve(params); const { locale, slug } = await params;
const post = getPostBySlug(slug, locale as "fa" | "en"); const post = getPostBySlug(slug, locale as "fa" | "en");
if (!post) return {}; if (!post) return {};
const otherLocale = locale === "fa" ? "en" : "fa"; const otherLocale = locale === "fa" ? "en" : "fa";
@@ -73,9 +74,9 @@ async function getComments(slug: string) {
export default async function BlogPostPage({ export default async function BlogPostPage({
params, params,
}: { }: {
params: { locale: string; slug: string }; params: Promise<{ locale: string; slug: string }>;
}) { }) {
const { locale, slug } = await Promise.resolve(params); const { locale, slug } = await params;
const t = await getTranslations({ locale, namespace: "blog" }); const t = await getTranslations({ locale, namespace: "blog" });
const post = getPostBySlug(slug, locale as "fa" | "en"); const post = getPostBySlug(slug, locale as "fa" | "en");
if (!post) notFound(); if (!post) notFound();
+4 -4
View File
@@ -10,9 +10,9 @@ const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { return {
title: t("blogTitle"), title: t("blogTitle"),
@@ -28,9 +28,9 @@ export async function generateMetadata({
export default async function BlogPage({ export default async function BlogPage({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}) { }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "blog" }); const t = await getTranslations({ locale, namespace: "blog" });
const posts = getAllPosts(locale as "fa" | "en"); const posts = getAllPosts(locale as "fa" | "en");
@@ -21,9 +21,9 @@ import {
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { title: t("careersTitle") }; return { title: t("careersTitle") };
} }
@@ -123,9 +123,9 @@ const en = {
export default async function CareersPage({ export default async function CareersPage({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}) { }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const c = locale === "fa" ? fa : en; const c = locale === "fa" ? fa : en;
const Arrow = locale === "fa" ? ArrowLeft : ArrowRight; const Arrow = locale === "fa" ? ArrowLeft : ArrowRight;
@@ -7,9 +7,9 @@ import { Phone, Mail, MapPin, Clock, MessageSquare, ArrowLeft, ArrowRight } from
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { title: t("contactTitle") }; return { title: t("contactTitle") };
} }
@@ -93,9 +93,9 @@ const en = {
export default async function ContactPage({ export default async function ContactPage({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}) { }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const c = locale === "fa" ? fa : en; const c = locale === "fa" ? fa : en;
const Arrow = locale === "fa" ? ArrowLeft : ArrowRight; const Arrow = locale === "fa" ? ArrowLeft : ArrowRight;
const base = `/${locale}`; const base = `/${locale}`;
+4 -4
View File
@@ -10,9 +10,9 @@ const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { return {
title: t("demoTitle"), title: t("demoTitle"),
@@ -28,9 +28,9 @@ export async function generateMetadata({
export default async function DemoPage({ export default async function DemoPage({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}) { }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "demo" }); const t = await getTranslations({ locale, namespace: "demo" });
const perks = const perks =
+4 -4
View File
@@ -22,9 +22,9 @@ import {
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { title: t("docsTitle") }; return { title: t("docsTitle") };
} }
@@ -92,9 +92,9 @@ const en = {
export default async function DocsPage({ export default async function DocsPage({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}) { }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const c = locale === "fa" ? fa : en; const c = locale === "fa" ? fa : en;
const Arrow = locale === "fa" ? ArrowLeft : ArrowRight; const Arrow = locale === "fa" ? ArrowLeft : ArrowRight;
const base = `/${locale}`; const base = `/${locale}`;
@@ -11,8 +11,8 @@ import {
const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir"; const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
export async function generateMetadata({ params }: { params: { locale: string } }): Promise<Metadata> { export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { return {
title: t("featuresTitle"), title: t("featuresTitle"),
@@ -71,8 +71,8 @@ function FeatureGrid({ locale }: { locale: string }) {
); );
} }
export default async function FeaturesPage({ params }: { params: { locale: string } }) { export default async function FeaturesPage({ params }: { params: Promise<{ locale: string }> }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const isEn = locale === "en"; const isEn = locale === "en";
return ( return (
+4 -4
View File
@@ -10,9 +10,9 @@ const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
const ogLocale = locale === "fa" ? "fa_IR" : "en_US"; const ogLocale = locale === "fa" ? "fa_IR" : "en_US";
@@ -93,9 +93,9 @@ export default async function LocaleLayout({
params, params,
}: { }: {
children: React.ReactNode; children: React.ReactNode;
params: { locale: string }; params: Promise<{ locale: string }>;
}) { }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
if (!routing.locales.includes(locale as "fa" | "en")) notFound(); if (!routing.locales.includes(locale as "fa" | "en")) notFound();
const messages = await getMessages(); const messages = await getMessages();
const dir = locale === "fa" ? "rtl" : "ltr"; const dir = locale === "fa" ? "rtl" : "ltr";
+4 -4
View File
@@ -18,9 +18,9 @@ import { JsonLd } from "@/components/seo/json-ld";
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { return {
title: t("homeTitle"), title: t("homeTitle"),
@@ -28,8 +28,8 @@ export async function generateMetadata({
}; };
} }
export default async function HomePage({ params }: { params: { locale: string } }) { export default async function HomePage({ params }: { params: Promise<{ locale: string }> }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
return ( return (
<> <>
<JsonLd type="SoftwareApplication" locale={locale} /> <JsonLd type="SoftwareApplication" locale={locale} />
@@ -12,9 +12,9 @@ const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { return {
title: t("pricingTitle"), title: t("pricingTitle"),
@@ -27,8 +27,8 @@ export async function generateMetadata({
}; };
} }
export default async function PricingPage({ params }: { params: { locale: string } }) { export default async function PricingPage({ params }: { params: Promise<{ locale: string }> }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
return ( return (
<> <>
<JsonLd type="FAQPage" locale={locale} /> <JsonLd type="FAQPage" locale={locale} />
@@ -11,8 +11,8 @@ import {
const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir"; const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
export async function generateMetadata({ params }: { params: { locale: string } }): Promise<Metadata> { export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { return {
title: t("printerGuideTitle"), title: t("printerGuideTitle"),
@@ -247,8 +247,8 @@ const CONNECTION_STEPS_EN = [
}, },
]; ];
export default async function PrinterGuidePage({ params }: { params: { locale: string } }) { export default async function PrinterGuidePage({ params }: { params: Promise<{ locale: string }> }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const isEn = locale === "en"; const isEn = locale === "en";
const base = `/${locale}`; const base = `/${locale}`;
const steps = isEn ? CONNECTION_STEPS_EN : CONNECTION_STEPS_FA; const steps = isEn ? CONNECTION_STEPS_EN : CONNECTION_STEPS_FA;
@@ -7,9 +7,9 @@ import { Shield } from "lucide-react";
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { title: t("privacyTitle") }; return { title: t("privacyTitle") };
} }
@@ -177,9 +177,9 @@ Address: Tehran, Iran`,
export default async function PrivacyPage({ export default async function PrivacyPage({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}) { }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const c = locale === "fa" ? fa : en; const c = locale === "fa" ? fa : en;
return ( return (
@@ -7,8 +7,8 @@ import { Coffee, UtensilsCrossed, Building2, Truck, ChevronRight } from "lucide-
const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir"; const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
export async function generateMetadata({ params }: { params: { locale: string } }): Promise<Metadata> { export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { return {
title: t("solutionsTitle"), title: t("solutionsTitle"),
@@ -68,8 +68,8 @@ const SOLUTIONS = [
}, },
]; ];
export default async function SolutionsPage({ params }: { params: { locale: string } }) { export default async function SolutionsPage({ params }: { params: Promise<{ locale: string }> }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const isEn = locale === "en"; const isEn = locale === "en";
const base = `/${locale}`; const base = `/${locale}`;
+4 -4
View File
@@ -8,9 +8,9 @@ import { SubscribeForm } from "./subscribe-form";
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}) : Promise<Metadata> { }) : Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { title: t("statusTitle") }; return { title: t("statusTitle") };
} }
@@ -76,9 +76,9 @@ const en = {
export default async function StatusPage({ export default async function StatusPage({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}) { }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const c = locale === "fa" ? fa : en; const c = locale === "fa" ? fa : en;
return ( return (
+4 -4
View File
@@ -7,9 +7,9 @@ import { FileText } from "lucide-react";
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}): Promise<Metadata> { }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { title: t("termsTitle") }; return { title: t("termsTitle") };
} }
@@ -175,9 +175,9 @@ Meezi's maximum liability is equivalent to one month's subscription fee.`,
export default async function TermsPage({ export default async function TermsPage({
params, params,
}: { }: {
params: { locale: string }; params: Promise<{ locale: string }>;
}) { }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const c = locale === "fa" ? fa : en; const c = locale === "fa" ? fa : en;
return ( return (
+4 -4
View File
@@ -10,8 +10,8 @@ import {
const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir"; const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
export async function generateMetadata({ params }: { params: { locale: string } }): Promise<Metadata> { export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const t = await getTranslations({ locale, namespace: "meta" }); const t = await getTranslations({ locale, namespace: "meta" });
return { return {
title: t("tourTitle"), title: t("tourTitle"),
@@ -201,8 +201,8 @@ function StepMockup({ mockup, icon, titleFa }: { mockup: string; icon: React.Ele
return <GenericMockup icon={icon} color={mockup === "kitchen" ? "orange" : mockup === "staff" ? "purple" : "brand"} label={titleFa} />; return <GenericMockup icon={icon} color={mockup === "kitchen" ? "orange" : mockup === "staff" ? "purple" : "brand"} label={titleFa} />;
} }
export default async function TourPage({ params }: { params: { locale: string } }) { export default async function TourPage({ params }: { params: Promise<{ locale: string }> }) {
const { locale } = await Promise.resolve(params); const { locale } = await params;
const isEn = locale === "en"; const isEn = locale === "en";
const base = `/${locale}`; const base = `/${locale}`;