mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 15:26:33 +00:00
feat(problems): add problem description page with MDX rendering
This commit is contained in:
parent
c6ab92e1e7
commit
9ff39a0438
31
src/app/(app)/problems/[id]/@problem/@description/page.tsx
Normal file
31
src/app/(app)/problems/[id]/@problem/@description/page.tsx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import prisma from "@/lib/prisma";
|
||||||
|
import { notFound } from "next/navigation";
|
||||||
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||||
|
import { MdxRenderer } from "@/components/content/mdx-renderer";
|
||||||
|
|
||||||
|
interface ProblemPageProps {
|
||||||
|
params: Promise<{ id: string }>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function ProblemPage({
|
||||||
|
params
|
||||||
|
}: ProblemPageProps) {
|
||||||
|
const { id } = await params;
|
||||||
|
|
||||||
|
const problem = await prisma.problem.findUnique({
|
||||||
|
where: { id: parseInt(id) },
|
||||||
|
include: {
|
||||||
|
author: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!problem) {
|
||||||
|
notFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ScrollArea className="[&>[data-radix-scroll-area-viewport]]:max-h-[calc(100vh-130px)]">
|
||||||
|
<MdxRenderer source={problem.content} />
|
||||||
|
</ScrollArea>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user