Refactor for i18n, CMS integration, and project slugs; enhance admin & analytics

Co-authored-by: dennis <dennis@konkol.net>
This commit is contained in:
Cursor Agent
2026-01-12 14:36:10 +00:00
parent 0349c686fa
commit 12245eec8e
55 changed files with 4573 additions and 753 deletions

21
app/[locale]/layout.tsx Normal file
View File

@@ -0,0 +1,21 @@
import { NextIntlClientProvider } from "next-intl";
import { getMessages } from "next-intl/server";
import React from "react";
export default async function LocaleLayout({
children,
params,
}: {
children: React.ReactNode;
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
const messages = await getMessages({ locale });
return (
<NextIntlClientProvider locale={locale} messages={messages}>
{children}
</NextIntlClientProvider>
);
}

View File

@@ -0,0 +1,2 @@
export { default } from "../../legal-notice/page";

2
app/[locale]/page.tsx Normal file
View File

@@ -0,0 +1,2 @@
export { default } from "../_ui/HomePage";

View File

@@ -0,0 +1,2 @@
export { default } from "../../privacy-policy/page";

View File

@@ -0,0 +1,36 @@
import { prisma } from "@/lib/prisma";
import ProjectDetailClient from "@/app/_ui/ProjectDetailClient";
import { notFound } from "next/navigation";
export const revalidate = 300;
export default async function ProjectPage({
params,
}: {
params: Promise<{ locale: string; slug: string }>;
}) {
const { locale, slug } = await params;
const project = await prisma.project.findFirst({
where: { slug, published: true },
include: {
translations: {
where: { locale },
select: { title: true, description: true },
},
},
});
if (!project) return notFound();
const tr = project.translations?.[0];
const { translations: _translations, ...rest } = project;
const localized = {
...rest,
title: tr?.title ?? project.title,
description: tr?.description ?? project.description,
};
return <ProjectDetailClient project={localized} locale={locale} />;
}

View File

@@ -0,0 +1,36 @@
import { prisma } from "@/lib/prisma";
import ProjectsPageClient from "@/app/_ui/ProjectsPageClient";
export const revalidate = 300;
export default async function ProjectsPage({
params,
}: {
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
const projects = await prisma.project.findMany({
where: { published: true },
orderBy: { createdAt: "desc" },
include: {
translations: {
where: { locale },
select: { title: true, description: true },
},
},
});
const localized = projects.map((p) => {
const tr = p.translations?.[0];
const { translations: _translations, ...rest } = p;
return {
...rest,
title: tr?.title ?? p.title,
description: tr?.description ?? p.description,
};
});
return <ProjectsPageClient projects={localized} locale={locale} />;
}