mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
feat(workspace): fetch problem templates and pass to editor header
This commit is contained in:
parent
63bde8cafb
commit
f6fc01ae6a
@ -1,16 +1,35 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import WorkspaceEditorHeader from "@/features/playground/workspace/editor/header";
|
||||
import WorkspaceEditorFooter from "@/features/playground/workspace/editor/footer";
|
||||
|
||||
interface WorkspaceEditorLayoutProps {
|
||||
params: Promise<{ id: string }>;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default function WorkspaceEditorLayout({
|
||||
export default async function WorkspaceEditorLayout({
|
||||
params,
|
||||
children,
|
||||
}: WorkspaceEditorLayoutProps) {
|
||||
const { id } = await params;
|
||||
|
||||
const problem = await prisma.problem.findUnique({
|
||||
where: { id: parseInt(id) },
|
||||
select: {
|
||||
templates: {
|
||||
select: {
|
||||
language: true,
|
||||
template: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const templates = problem?.templates ?? [];
|
||||
|
||||
return (
|
||||
<div className="h-full flex flex-col">
|
||||
<WorkspaceEditorHeader />
|
||||
<WorkspaceEditorHeader templates={templates} />
|
||||
<div className="flex-1">{children}</div>
|
||||
<WorkspaceEditorFooter />
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user