import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { FileText } from "lucide-react"; import { GitPanel } from "@/components/GitPanel"; import { Markdown } from "@/components/Markdown"; import { NotesPanel } from "@/components/NotesPanel"; import { ProjectHeader } from "@/components/ProjectHeader"; import { requireUserPage } from "@/lib/auth/guard"; import { getSessionUser } from "@/lib/auth/session"; import { prisma } from "@/lib/db"; import { connectionSafeSelect, projectDetailInclude } from "@/lib/projects"; import type { ConnectionSafe, ProjectDetail } from "@/types"; export const dynamic = "force-dynamic"; type PageProps = { params: Promise<{ id: string }> }; export async function generateMetadata({ params }: PageProps): Promise { const user = await getSessionUser(); if (!user) return { title: "Projekt" }; const { id } = await params; const project = await prisma.project.findFirst({ where: { id, ownerId: user.id }, select: { name: true, summary: true }, }); return { title: project?.name ?? "Projekt", description: project?.summary ?? undefined, }; } export default async function ProjectPage({ params }: PageProps) { const user = await requireUserPage(); const { id } = await params; const [project, connections] = await Promise.all([ // findFirst mit Besitzerbedingung: ein fremdes Projekt fuehrt zu 404, // nicht zu einer Fehlermeldung, die seine Existenz bestaetigt. prisma.project.findFirst({ where: { id, ownerId: user.id }, include: projectDetailInclude, }), prisma.gitConnection.findMany({ where: { ownerId: user.id }, select: connectionSafeSelect, orderBy: { name: "asc" }, }), ]); if (!project) notFound(); const detail = project as unknown as ProjectDetail; return (

Beschreibung

{detail.description ? ( {detail.description} ) : (

Keine Beschreibung hinterlegt. Ueber „Bearbeiten“ kannst du die Idee ausformulieren.

)}
); }