2025-03-10 12:54:31 +00:00
|
|
|
import prisma from "@/lib/prisma";
|
|
|
|
import { notFound } from "next/navigation";
|
|
|
|
import { MdxRenderer } from "@/components/content/mdx-renderer";
|
|
|
|
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
|
2025-03-12 00:59:38 +00:00
|
|
|
import ProblemSolutionFooter from "@/features/playground/problem/solution/footer";
|
2025-03-10 12:54:31 +00:00
|
|
|
|
|
|
|
interface ProblemSolutionPageProps {
|
|
|
|
params: Promise<{ id: string }>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default async function ProblemSolutionPage({
|
|
|
|
params,
|
|
|
|
}: ProblemSolutionPageProps) {
|
|
|
|
const { id } = await params;
|
|
|
|
|
|
|
|
const problem = await prisma.problem.findUnique({
|
2025-03-12 07:32:14 +00:00
|
|
|
where: { id },
|
2025-03-10 12:54:31 +00:00
|
|
|
select: {
|
2025-03-12 00:59:38 +00:00
|
|
|
title: true,
|
2025-03-10 12:54:31 +00:00
|
|
|
solution: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!problem) {
|
|
|
|
notFound();
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2025-03-12 00:59:38 +00:00
|
|
|
<>
|
|
|
|
<div className="flex-1">
|
|
|
|
<ScrollArea className="[&>[data-radix-scroll-area-viewport]]:max-h-[calc(100vh-130px)]">
|
|
|
|
<MdxRenderer source={problem.solution} />
|
|
|
|
<ScrollBar orientation="horizontal" />
|
|
|
|
</ScrollArea>
|
|
|
|
</div>
|
|
|
|
<ProblemSolutionFooter title={problem.title} />
|
|
|
|
</>
|
2025-03-10 12:54:31 +00:00
|
|
|
);
|
|
|
|
}
|