This commit is contained in:
@@ -4,7 +4,7 @@ import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/layout/container";
|
||||
import { PageHero } from "@/components/layout/page-hero";
|
||||
import { AppCard } from "@/components/ui/app-card";
|
||||
import { resolveLocale } from "@/lib/locale";
|
||||
import { FALLBACK_LOCALE, resolveLocale } from "@/lib/locale";
|
||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
|
||||
type AboutPageProps = {
|
||||
@@ -17,7 +17,7 @@ export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata({ params }: AboutPageProps): Promise<Metadata> {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "aboutPage" });
|
||||
|
||||
return await buildLocalizedMetadata({
|
||||
@@ -30,7 +30,7 @@ export async function generateMetadata({ params }: AboutPageProps): Promise<Meta
|
||||
|
||||
export default async function AboutPage({ params }: AboutPageProps) {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "aboutPage" });
|
||||
|
||||
return (
|
||||
|
||||
@@ -59,8 +59,8 @@ function getStringValue(formData: FormData, key: string) {
|
||||
}
|
||||
|
||||
export async function submitContactFormAction(formData: FormData) {
|
||||
const locale = resolveLocale(String(formData.get("locale") ?? ""));
|
||||
const siteSettings = await getSiteSettings();
|
||||
const locale = resolveLocale(String(formData.get("locale") ?? ""), siteSettings.defaultLocale);
|
||||
const contactPath = getLocalizedPath(locale, "/contact", siteSettings.defaultLocale);
|
||||
|
||||
try {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { MotionFade } from "@/components/motion-fade";
|
||||
import { ContactForm } from "@/components/site/contact-form";
|
||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
import { getPublicContactProtectionSettings, getSiteSettings } from "@/lib/app-config";
|
||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { FALLBACK_LOCALE, getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { AppCard } from "@/components/ui/app-card";
|
||||
import { CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
|
||||
@@ -22,7 +22,7 @@ type ContactPageProps = {
|
||||
|
||||
export async function generateMetadata({ params }: ContactPageProps): Promise<Metadata> {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "contactPage" });
|
||||
|
||||
return await buildLocalizedMetadata({
|
||||
@@ -35,7 +35,7 @@ export async function generateMetadata({ params }: ContactPageProps): Promise<Me
|
||||
|
||||
export default async function ContactPage({ params }: ContactPageProps) {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const [t, protection, siteSettings] = await Promise.all([
|
||||
getTranslations({ locale: localeKey, namespace: "contactPage" }),
|
||||
getPublicContactProtectionSettings(),
|
||||
|
||||
@@ -7,7 +7,7 @@ import { SiteFooter } from "@/components/layout/site-footer";
|
||||
import { SiteHeader } from "@/components/layout/site-header";
|
||||
import { isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { getMaintenanceMode, getSiteSettings, getSiteSettingsMediaBindings } from "@/lib/app-config";
|
||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { FALLBACK_LOCALE, getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
|
||||
type SiteLayoutProps = {
|
||||
children: ReactNode;
|
||||
@@ -23,7 +23,7 @@ export default async function SiteLayout({ children, params }: SiteLayoutProps)
|
||||
noStore();
|
||||
const { locale } = await params;
|
||||
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const [maintenanceEnabled, mediaBindings, siteSettings] = await Promise.all([
|
||||
getMaintenanceMode(),
|
||||
getSiteSettingsMediaBindings(),
|
||||
|
||||
@@ -21,7 +21,7 @@ import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
import { AppCard } from "@/components/ui/app-card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { CardContent } from "@/components/ui/card";
|
||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { FALLBACK_LOCALE, getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
|
||||
type HomePageProps = {
|
||||
params: Promise<{
|
||||
@@ -43,7 +43,7 @@ export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata({ params }: HomePageProps): Promise<Metadata> {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const [t, siteSettings] = await Promise.all([
|
||||
getTranslations({ locale: localeKey, namespace: "homepage" }),
|
||||
getSiteSettings(),
|
||||
@@ -60,7 +60,7 @@ export async function generateMetadata({ params }: HomePageProps): Promise<Metad
|
||||
|
||||
export default async function HomePage({ params }: HomePageProps) {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const [t, marqueeSettings, siteSettings] = await Promise.all([
|
||||
getTranslations({ locale: localeKey, namespace: "homepage" }),
|
||||
getMarqueeSettings(),
|
||||
|
||||
@@ -5,8 +5,9 @@ import { notFound } from "next/navigation";
|
||||
import { Container } from "@/components/layout/container";
|
||||
import { PageHero } from "@/components/layout/page-hero";
|
||||
import { PortfolioProjectDetail } from "@/components/site/portfolio-project-detail";
|
||||
import { getSiteSettings } from "@/lib/app-config";
|
||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
import { resolveLocale } from "@/lib/locale";
|
||||
import { FALLBACK_LOCALE, resolveLocale } from "@/lib/locale";
|
||||
import {
|
||||
getLocalizedValue,
|
||||
getPublishedPortfolioProjectBySlug,
|
||||
@@ -23,7 +24,7 @@ export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata({ params }: PortfolioItemPageProps): Promise<Metadata> {
|
||||
const { locale, slug } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const item = await getPublishedPortfolioProjectBySlug(slug);
|
||||
|
||||
if (!item) {
|
||||
@@ -47,14 +48,17 @@ export default async function PortfolioItemPage({
|
||||
params,
|
||||
}: PortfolioItemPageProps) {
|
||||
const { locale, slug } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const item = await getPublishedPortfolioProjectBySlug(slug);
|
||||
|
||||
if (!item) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioDetail" });
|
||||
const [t, siteSettings] = await Promise.all([
|
||||
getTranslations({ locale: localeKey, namespace: "portfolioDetail" }),
|
||||
getSiteSettings(),
|
||||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -64,7 +68,12 @@ export default async function PortfolioItemPage({
|
||||
/>
|
||||
|
||||
<Container size="wide" className="pb-12 lg:pb-16">
|
||||
<PortfolioProjectDetail item={item} locale={localeKey} t={t} />
|
||||
<PortfolioProjectDetail
|
||||
item={item}
|
||||
locale={localeKey}
|
||||
defaultLocale={siteSettings.defaultLocale}
|
||||
t={t}
|
||||
/>
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -6,8 +6,9 @@ import { Container } from "@/components/layout/container";
|
||||
import { PageHero } from "@/components/layout/page-hero";
|
||||
import { PortfolioCategoryFilter } from "@/components/site/portfolio-category-filter";
|
||||
import { PortfolioProjectGrid } from "@/components/site/portfolio-project-grid";
|
||||
import { getSiteSettings } from "@/lib/app-config";
|
||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
import { resolveLocale } from "@/lib/locale";
|
||||
import { FALLBACK_LOCALE, resolveLocale } from "@/lib/locale";
|
||||
import {
|
||||
getActivePortfolioCategories,
|
||||
getActivePortfolioCategoryBySlug,
|
||||
@@ -26,7 +27,7 @@ export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata({ params }: PortfolioCategoryPageProps): Promise<Metadata> {
|
||||
const { locale, slug } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioPage" });
|
||||
const category = await getActivePortfolioCategoryBySlug(slug);
|
||||
|
||||
@@ -51,9 +52,10 @@ export default async function PortfolioCategoryPage({
|
||||
params,
|
||||
}: PortfolioCategoryPageProps) {
|
||||
const { locale, slug } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioPage" });
|
||||
const [categories, category, projects] = await Promise.all([
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const [t, siteSettings, categories, category, projects] = await Promise.all([
|
||||
getTranslations({ locale: localeKey, namespace: "portfolioPage" }),
|
||||
getSiteSettings(),
|
||||
getActivePortfolioCategories(),
|
||||
getActivePortfolioCategoryBySlug(slug),
|
||||
getPublishedPortfolioProjects({ categorySlug: slug }),
|
||||
@@ -75,12 +77,14 @@ export default async function PortfolioCategoryPage({
|
||||
<Container className="flex flex-col gap-section pb-12 lg:pb-16">
|
||||
<PortfolioCategoryFilter
|
||||
locale={localeKey}
|
||||
defaultLocale={siteSettings.defaultLocale}
|
||||
categories={categories}
|
||||
allLabel={t("all")}
|
||||
activeCategorySlug={category.slug}
|
||||
/>
|
||||
<PortfolioProjectGrid
|
||||
locale={localeKey}
|
||||
defaultLocale={siteSettings.defaultLocale}
|
||||
projects={projects}
|
||||
emptyLabel={t("empty")}
|
||||
openLabel={t("open")}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { permanentRedirect } from "next/navigation";
|
||||
|
||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { getSiteSettings } from "@/lib/app-config";
|
||||
import { FALLBACK_LOCALE, getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
|
||||
type PortfolioCategoryIndexPageProps = {
|
||||
params: Promise<{
|
||||
@@ -12,7 +13,8 @@ export default async function PortfolioCategoryIndexPage({
|
||||
params,
|
||||
}: PortfolioCategoryIndexPageProps) {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const siteSettings = await getSiteSettings();
|
||||
|
||||
permanentRedirect(getLocalizedPath(localeKey, "/portfolio"));
|
||||
permanentRedirect(getLocalizedPath(localeKey, "/portfolio", siteSettings.defaultLocale));
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ import { Container } from "@/components/layout/container";
|
||||
import { PageHero } from "@/components/layout/page-hero";
|
||||
import { PortfolioCategoryFilter } from "@/components/site/portfolio-category-filter";
|
||||
import { PortfolioProjectGrid } from "@/components/site/portfolio-project-grid";
|
||||
import { getSiteSettings } from "@/lib/app-config";
|
||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { FALLBACK_LOCALE, getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { getActivePortfolioCategories, getPublishedPortfolioProjects } from "@/lib/portfolio";
|
||||
|
||||
type PortfolioPageProps = {
|
||||
@@ -23,7 +24,7 @@ export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata({ params }: PortfolioPageProps): Promise<Metadata> {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioPage" });
|
||||
|
||||
return await buildLocalizedMetadata({
|
||||
@@ -42,12 +43,15 @@ export default async function PortfolioPage({
|
||||
params,
|
||||
searchParams,
|
||||
]);
|
||||
const localeKey = resolveLocale(locale);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioPage" });
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const [t, siteSettings] = await Promise.all([
|
||||
getTranslations({ locale: localeKey, namespace: "portfolioPage" }),
|
||||
getSiteSettings(),
|
||||
]);
|
||||
const selectedCategory = resolvedSearchParams?.category ?? "";
|
||||
|
||||
if (selectedCategory) {
|
||||
redirect(getLocalizedPath(localeKey, `/portfolio/category/${selectedCategory}`));
|
||||
redirect(getLocalizedPath(localeKey, `/portfolio/category/${selectedCategory}`, siteSettings.defaultLocale));
|
||||
}
|
||||
|
||||
const [categories, projects] = await Promise.all([
|
||||
@@ -65,9 +69,15 @@ export default async function PortfolioPage({
|
||||
/>
|
||||
|
||||
<Container className="flex flex-col gap-section pb-12 lg:pb-16">
|
||||
<PortfolioCategoryFilter locale={localeKey} categories={categories} allLabel={t("all")} />
|
||||
<PortfolioCategoryFilter
|
||||
locale={localeKey}
|
||||
defaultLocale={siteSettings.defaultLocale}
|
||||
categories={categories}
|
||||
allLabel={t("all")}
|
||||
/>
|
||||
<PortfolioProjectGrid
|
||||
locale={localeKey}
|
||||
defaultLocale={siteSettings.defaultLocale}
|
||||
projects={projects}
|
||||
emptyLabel={t("empty")}
|
||||
openLabel={t("open")}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { MotionFade } from "@/components/motion-fade";
|
||||
import { HeroShell, HeroTitle } from "@/components/layout/site-hero";
|
||||
import { getSiteSettings } from "@/lib/app-config";
|
||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { FALLBACK_LOCALE, getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { AppCard } from "@/components/ui/app-card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { CardContent } from "@/components/ui/card";
|
||||
@@ -21,7 +21,7 @@ type SuccessPageProps = {
|
||||
|
||||
export async function generateMetadata({ params }: SuccessPageProps): Promise<Metadata> {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "successPage" });
|
||||
|
||||
return await buildLocalizedMetadata({
|
||||
@@ -34,7 +34,7 @@ export async function generateMetadata({ params }: SuccessPageProps): Promise<Me
|
||||
|
||||
export default async function SuccessPage({ params }: SuccessPageProps) {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const [t, siteSettings] = await Promise.all([
|
||||
getTranslations({ locale: localeKey, namespace: "successPage" }),
|
||||
getSiteSettings(),
|
||||
|
||||
Reference in New Issue
Block a user