2025-03-08 11:46:01 +00:00
|
|
|
import prisma from "@/lib/prisma";
|
|
|
|
import { notFound } from "next/navigation";
|
|
|
|
import { MdxRenderer } from "@/components/content/mdx-renderer";
|
2025-03-09 07:04:54 +00:00
|
|
|
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
|
2025-03-08 11:46:01 +00:00
|
|
|
|
2025-03-10 12:51:21 +00:00
|
|
|
interface ProblemDescriptionPageProps {
|
2025-03-08 11:46:01 +00:00
|
|
|
params: Promise<{ id: string }>
|
|
|
|
}
|
|
|
|
|
2025-03-10 12:51:21 +00:00
|
|
|
export default async function ProblemDescriptionPage({
|
2025-03-08 11:46:01 +00:00
|
|
|
params
|
2025-03-10 12:51:21 +00:00
|
|
|
}: ProblemDescriptionPageProps) {
|
2025-03-08 11:46:01 +00:00
|
|
|
const { id } = await params;
|
|
|
|
|
|
|
|
const problem = await prisma.problem.findUnique({
|
|
|
|
where: { id: parseInt(id) },
|
2025-03-10 12:51:21 +00:00
|
|
|
select: {
|
|
|
|
description: true,
|
|
|
|
}
|
2025-03-08 11:46:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
if (!problem) {
|
|
|
|
notFound();
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ScrollArea className="[&>[data-radix-scroll-area-viewport]]:max-h-[calc(100vh-130px)]">
|
2025-03-08 12:06:08 +00:00
|
|
|
<MdxRenderer source={problem.description} />
|
2025-03-09 07:04:54 +00:00
|
|
|
<ScrollBar orientation="horizontal" />
|
2025-03-08 11:46:01 +00:00
|
|
|
</ScrollArea>
|
|
|
|
);
|
|
|
|
}
|