2025-03-20 08:12:23 +00:00
|
|
|
import prisma from "@/lib/prisma";
|
|
|
|
import { notFound } from "next/navigation";
|
2025-04-04 09:03:55 +00:00
|
|
|
import DockView from "@/components/dockview";
|
2025-03-21 16:21:51 +00:00
|
|
|
import { ProblemStoreProvider } from "@/providers/problem-store-provider";
|
2025-03-16 04:05:59 +00:00
|
|
|
import { PlaygroundHeader } from "@/components/features/playground/header";
|
2025-03-08 10:00:13 +00:00
|
|
|
|
2025-04-04 09:03:55 +00:00
|
|
|
interface ProblemProps {
|
2025-03-20 08:12:23 +00:00
|
|
|
params: Promise<{ id: string }>;
|
2025-04-04 09:03:55 +00:00
|
|
|
Description: React.ReactNode;
|
|
|
|
Solutions: React.ReactNode;
|
|
|
|
Submissions: React.ReactNode;
|
|
|
|
Code: React.ReactNode;
|
|
|
|
Testcase: React.ReactNode;
|
|
|
|
TestResult: React.ReactNode;
|
2025-03-08 10:00:13 +00:00
|
|
|
}
|
|
|
|
|
2025-04-04 09:03:55 +00:00
|
|
|
export default async function ProblemLayout({
|
2025-03-20 08:12:23 +00:00
|
|
|
params,
|
2025-04-04 09:03:55 +00:00
|
|
|
Description,
|
|
|
|
Solutions,
|
|
|
|
Submissions,
|
|
|
|
Code,
|
|
|
|
Testcase,
|
|
|
|
TestResult,
|
|
|
|
}: ProblemProps) {
|
2025-03-20 08:12:23 +00:00
|
|
|
const { id } = await params;
|
|
|
|
|
|
|
|
const [
|
|
|
|
problemData,
|
|
|
|
editorLanguageConfigs,
|
|
|
|
languageServerConfigs,
|
|
|
|
] = await Promise.all([
|
|
|
|
prisma.problem.findUnique({
|
|
|
|
where: { id },
|
2025-03-24 02:32:20 +00:00
|
|
|
include: { templates: true },
|
2025-03-20 08:12:23 +00:00
|
|
|
}),
|
|
|
|
prisma.editorLanguageConfig.findMany(),
|
|
|
|
prisma.languageServerConfig.findMany(),
|
|
|
|
]);
|
|
|
|
|
|
|
|
if (!problemData) {
|
|
|
|
return notFound();
|
|
|
|
}
|
|
|
|
|
2025-03-24 02:39:56 +00:00
|
|
|
const { templates, ...problemWithoutTemplates } = problemData;
|
|
|
|
|
2025-03-08 10:00:13 +00:00
|
|
|
return (
|
2025-04-04 09:03:55 +00:00
|
|
|
<div className="flex flex-col h-screen">
|
2025-03-21 16:21:51 +00:00
|
|
|
<ProblemStoreProvider
|
2025-03-20 08:12:23 +00:00
|
|
|
problemId={id}
|
2025-03-24 02:39:56 +00:00
|
|
|
problem={problemWithoutTemplates}
|
|
|
|
templates={templates}
|
2025-03-20 08:12:23 +00:00
|
|
|
editorLanguageConfigs={editorLanguageConfigs}
|
|
|
|
languageServerConfigs={languageServerConfigs}
|
|
|
|
>
|
|
|
|
<PlaygroundHeader />
|
|
|
|
<main className="flex flex-grow overflow-y-hidden p-2.5 pt-0">
|
2025-04-04 09:03:55 +00:00
|
|
|
<DockView
|
|
|
|
Description={Description}
|
|
|
|
Solutions={Solutions}
|
|
|
|
Submissions={Submissions}
|
|
|
|
Code={Code}
|
|
|
|
Testcase={Testcase}
|
|
|
|
TestResult={TestResult}
|
|
|
|
/>
|
2025-03-20 08:12:23 +00:00
|
|
|
</main>
|
2025-03-21 16:21:51 +00:00
|
|
|
</ProblemStoreProvider>
|
2025-03-08 10:00:13 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|