diff --git a/src/app/(app)/problems/[problemId]/layout.tsx b/src/app/(app)/problems/[problemId]/layout.tsx index fe22fac..72db5c0 100644 --- a/src/app/(app)/problems/[problemId]/layout.tsx +++ b/src/app/(app)/problems/[problemId]/layout.tsx @@ -1,3 +1,4 @@ +import prisma from "@/lib/prisma"; import { notFound } from "next/navigation"; import { ProblemHeader } from "@/features/problems/components/header"; @@ -13,6 +14,19 @@ const Layout = async ({ children, params }: LayoutProps) => { return notFound(); } + const problem = await prisma.problem.findUnique({ + select: { + isPublished: true, + }, + where: { + id: problemId, + }, + }); + + if (!problem?.isPublished) { + return notFound(); + } + return (