Fix runttime

This commit is contained in:
diyaa
2026-03-13 03:56:40 +01:00
parent d1ed5c641b
commit c9e9ae6b90
8 changed files with 75 additions and 35 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
import type { Metadata } from "next";
import { getDictionary, type Locale } from "@/lib/i18n";
import { getLocalizedPath, getLocalizedUrl, isComingSoonMode } from "@/lib/site";
import { getLocalizedPath, getLocalizedUrl, getModeValue } from "@/lib/site";
type PageKey = "home" | "about" | "contact";
@@ -13,11 +13,11 @@ const pagePathMap: Record<PageKey, string> = {
export function buildPageMetadata(locale: Locale, page: PageKey): Metadata {
const dictionary = getDictionary(locale);
const pathname = pagePathMap[page];
const isComingSoon = isComingSoonMode();
const homeMetadata = getModeValue(dictionary.metadata.home);
const metadataByPage = {
home: {
title: isComingSoon ? dictionary.metadata.homeTitle : dictionary.metadata.fullHomeTitle,
description: isComingSoon ? dictionary.metadata.homeDescription : dictionary.metadata.fullHomeDescription,
title: homeMetadata.title,
description: homeMetadata.description,
},
about: {
title: dictionary.metadata.aboutTitle,
+5 -1
View File
@@ -1,4 +1,4 @@
import type { ContactContent } from "@/content/types";
import type { ContactContent, ModeVariants } from "@/content/types";
const FALLBACK_SITE_URL = "https://example.com";
const SITE_MODES = ["coming-soon", "full"] as const;
@@ -60,6 +60,10 @@ export function isComingSoonMode(): boolean {
return getSiteMode() === "coming-soon";
}
export function getModeValue<T>(variants: ModeVariants<T>): T {
return variants[getSiteMode()];
}
export function getLocalizedPath(pathname: string, locale: "ar" | "en"): string {
const normalizedPath = pathname === "/" ? "" : pathname;
return `/${locale}${normalizedPath}`;