refactor(layout, page, description): update problem page layout and structure, including description fetching and TabsContent styling

This commit is contained in:
cfngc4594 2025-03-10 20:51:21 +08:00
parent c0f72a21dd
commit 4727c55bcc
3 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import ProblemDescriptionFooter from "@/features/playground/problem/description/footer";
import prisma from "@/lib/prisma"; import prisma from "@/lib/prisma";
import ProblemDescriptionFooter from "@/features/playground/problem/description/footer";
interface ProblemDescriptionLayoutProps { interface ProblemDescriptionLayoutProps {
params: Promise<{ id: string }>; params: Promise<{ id: string }>;

View File

@ -3,20 +3,20 @@ import { notFound } from "next/navigation";
import { MdxRenderer } from "@/components/content/mdx-renderer"; import { MdxRenderer } from "@/components/content/mdx-renderer";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
interface ProblemPageProps { interface ProblemDescriptionPageProps {
params: Promise<{ id: string }> params: Promise<{ id: string }>
} }
export default async function ProblemPage({ export default async function ProblemDescriptionPage({
params params
}: ProblemPageProps) { }: ProblemDescriptionPageProps) {
const { id } = await params; const { id } = await params;
const problem = await prisma.problem.findUnique({ const problem = await prisma.problem.findUnique({
where: { id: parseInt(id) }, where: { id: parseInt(id) },
include: { select: {
author: true, description: true,
}, }
}); });
if (!problem) { if (!problem) {

View File

@ -47,10 +47,10 @@ export default function ProblemLayout({
<TabsContent value="description" className="h-full mt-0"> <TabsContent value="description" className="h-full mt-0">
{description} {description}
</TabsContent> </TabsContent>
<TabsContent value="solution"> <TabsContent value="solution" className="h-full mt-0">
{solution} {solution}
</TabsContent> </TabsContent>
<TabsContent value="submission"> <TabsContent value="submission" className="h-full mt-0">
{submission} {submission}
</TabsContent> </TabsContent>
</Tabs> </Tabs>