mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 15:26:33 +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 WorkspaceEditorHeader from "@/features/playground/workspace/editor/header";
|
||||||
import WorkspaceEditorFooter from "@/features/playground/workspace/editor/footer";
|
import WorkspaceEditorFooter from "@/features/playground/workspace/editor/footer";
|
||||||
|
|
||||||
interface WorkspaceEditorLayoutProps {
|
interface WorkspaceEditorLayoutProps {
|
||||||
|
params: Promise<{ id: string }>;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function WorkspaceEditorLayout({
|
export default async function WorkspaceEditorLayout({
|
||||||
|
params,
|
||||||
children,
|
children,
|
||||||
}: WorkspaceEditorLayoutProps) {
|
}: 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 (
|
return (
|
||||||
<div className="h-full flex flex-col">
|
<div className="h-full flex flex-col">
|
||||||
<WorkspaceEditorHeader />
|
<WorkspaceEditorHeader templates={templates} />
|
||||||
<div className="flex-1">{children}</div>
|
<div className="flex-1">{children}</div>
|
||||||
<WorkspaceEditorFooter />
|
<WorkspaceEditorFooter />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user