diff --git a/src/app/(app)/problems/[id]/layout.tsx b/src/app/(app)/problems/[id]/layout.tsx index 96cf12a..98c1de3 100644 --- a/src/app/(app)/problems/[id]/layout.tsx +++ b/src/app/(app)/problems/[id]/layout.tsx @@ -1,39 +1,70 @@ +import prisma from "@/lib/prisma"; +import { notFound } from "next/navigation"; import { PlaygroundHeader } from "@/components/features/playground/header"; +import { ProblemEditorProvider } from "@/providers/problem-editor-provider"; import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable"; interface PlaygroundLayoutProps { + params: Promise<{ id: string }>; problem: React.ReactNode; workspace: React.ReactNode; terminal: React.ReactNode; } -export default function PlaygroundLayout({ +export default async function PlaygroundLayout({ + params, problem, workspace, terminal, }: PlaygroundLayoutProps) { + const { id } = await params; + + const [ + problemData, + editorLanguageConfigs, + languageServerConfigs, + ] = await Promise.all([ + prisma.problem.findUnique({ + where: { id }, + select: { templates: true }, + }), + prisma.editorLanguageConfig.findMany(), + prisma.languageServerConfig.findMany(), + ]); + + if (!problemData) { + return notFound(); + } + return (
- -
- - - {problem} - - - - - - {workspace} - - - - {terminal} - - - - -
+ + +
+ + + {problem} + + + + + + {workspace} + + + + {terminal} + + + + +
+
); }