Premier commit de la v2 de l'app

This commit is contained in:
UltraLionFr
2025-07-29 05:15:33 +02:00
parent 2f14898357
commit b593c60ab2
67 changed files with 5003 additions and 388 deletions
+51
View File
@@ -0,0 +1,51 @@
import { auth } from "@/auth";
import Banner from "@/components/Banner";
import ProjectsTable, { Project } from "@/components/ProjectsTable";
import { prisma } from "@/lib/prisma";
import { notFound, redirect } from "next/navigation";
type Props = {
params: { username: string };
};
export default async function UserProfilePage({ params }: Props) {
const session = await auth();
if (!session) return redirect("/");
const username = params.username;
const user = await prisma.user.findUnique({
where: { mcName: username },
});
if (!user) return notFound();
const rawProjects = await prisma.project.findMany({
where: { joueur: username },
orderBy: { createdAt: "desc" },
});
const projects: Project[] = rawProjects.map((p) => ({
id: p.id,
joueur: p.joueur,
etat: p.etat as Project["etat"],
monde: p.monde as Project["monde"],
projet: p.projet,
description: p.description,
coords: p.coords ?? "",
tags: p.tags,
}));
return (
<section className="p-4">
<Banner />
<h1 className="text-2xl font-bold text-white text-center">
Projets de <span className="text-yellow-300">{username}</span>
</h1>
{projects.length === 0 ? (
<p className="mt-4 text-white/60">Aucun projet enregistré.</p>
) : (
<ProjectsTable data={projects} hidePlayerFilter />
)}
</section>
);
}