Fix Coming soon

This commit is contained in:
diyaa
2026-03-13 09:26:40 +01:00
parent 2b5e91377c
commit 0bb964f07e
16 changed files with 294 additions and 93 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
import type { Metadata } from "next";
import { getDictionary, isLocale, type Locale } from "@/lib/i18n";
import { getActiveLocale, getDictionary, isLocale, type Locale } from "@/lib/i18n";
import { buildPageMetadata } from "@/lib/metadata";
import { isComingSoonMode } from "@/lib/site";
import { notFound, redirect } from "next/navigation";
@@ -9,7 +9,7 @@ export function generateMetadata({ params }: { params: { locale: string } }): Me
return {};
}
return buildPageMetadata(params.locale, "about");
return buildPageMetadata(getActiveLocale(params.locale), "about");
}
export default function AboutPage({ params }: { params: { locale: string } }) {
@@ -18,10 +18,10 @@ export default function AboutPage({ params }: { params: { locale: string } }) {
}
if (isComingSoonMode()) {
redirect(`/${params.locale}`);
redirect("/");
}
const locale = params.locale as Locale;
const locale = getActiveLocale(params.locale as Locale);
const dictionary = getDictionary(locale);
return (
+4 -4
View File
@@ -1,5 +1,5 @@
import type { Metadata } from "next";
import { getDictionary, isLocale, type Locale } from "@/lib/i18n";
import { getActiveLocale, getDictionary, isLocale, type Locale } from "@/lib/i18n";
import { buildPageMetadata } from "@/lib/metadata";
import { getContactChannels, isComingSoonMode } from "@/lib/site";
import { notFound, redirect } from "next/navigation";
@@ -9,7 +9,7 @@ export function generateMetadata({ params }: { params: { locale: string } }): Me
return {};
}
return buildPageMetadata(params.locale, "contact");
return buildPageMetadata(getActiveLocale(params.locale), "contact");
}
export default function ContactPage({ params }: { params: { locale: string } }) {
@@ -18,10 +18,10 @@ export default function ContactPage({ params }: { params: { locale: string } })
}
if (isComingSoonMode()) {
redirect(`/${params.locale}`);
redirect("/");
}
const locale = params.locale as Locale;
const locale = getActiveLocale(params.locale as Locale);
const dictionary = getDictionary(locale);
const channels = getContactChannels(dictionary.contact);
+9 -4
View File
@@ -1,14 +1,15 @@
import type { ReactNode } from "react";
import { notFound } from "next/navigation";
import { notFound, redirect } from "next/navigation";
import BottomNav from "@/components/BottomNav";
import SiteFooter from "@/components/SiteFooter";
import SiteHeader from "@/components/SiteHeader";
import { getDictionary, getDirection, isLocale, locales, type Locale } from "@/lib/i18n";
import { getActiveLocale, getDictionary, getDirection, getEnabledLocales, isLocale, type Locale } from "@/lib/i18n";
import { isComingSoonMode } from "@/lib/site";
export const dynamicParams = false;
export function generateStaticParams() {
return locales.map((locale) => ({ locale }));
return getEnabledLocales().map((locale) => ({ locale }));
}
export default function LocaleLayout({
@@ -22,7 +23,11 @@ export default function LocaleLayout({
notFound();
}
const locale = params.locale as Locale;
if (isComingSoonMode()) {
redirect("/");
}
const locale = getActiveLocale(params.locale as Locale);
const dictionary = getDictionary(locale);
return (
+3 -3
View File
@@ -1,6 +1,6 @@
import type { Metadata } from "next";
import HeroSection from "@/components/HeroSection";
import { getDictionary, isLocale, type Locale } from "@/lib/i18n";
import { getActiveLocale, getDictionary, isLocale, type Locale } from "@/lib/i18n";
import { buildPageMetadata } from "@/lib/metadata";
import { notFound } from "next/navigation";
@@ -9,7 +9,7 @@ export function generateMetadata({ params }: { params: { locale: string } }): Me
return {};
}
return buildPageMetadata(params.locale, "home");
return buildPageMetadata(getActiveLocale(params.locale), "home");
}
export default function HomePage({ params }: { params: { locale: string } }) {
@@ -17,7 +17,7 @@ export default function HomePage({ params }: { params: { locale: string } }) {
notFound();
}
const locale = params.locale as Locale;
const locale = getActiveLocale(params.locale as Locale);
const dictionary = getDictionary(locale);
return <HeroSection locale={locale} home={dictionary.home} />;