From 4727c55bcc2b3990869787f11986aac6d78058a0 Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Mon, 10 Mar 2025 20:51:21 +0800 Subject: [PATCH] refactor(layout, page, description): update problem page layout and structure, including description fetching and TabsContent styling --- .../problems/[id]/@problem/@description/layout.tsx | 2 +- .../problems/[id]/@problem/@description/page.tsx | 12 ++++++------ src/app/(app)/problems/[id]/@problem/layout.tsx | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app/(app)/problems/[id]/@problem/@description/layout.tsx b/src/app/(app)/problems/[id]/@problem/@description/layout.tsx index 76fb6e3..4a6dbad 100644 --- a/src/app/(app)/problems/[id]/@problem/@description/layout.tsx +++ b/src/app/(app)/problems/[id]/@problem/@description/layout.tsx @@ -1,5 +1,5 @@ -import ProblemDescriptionFooter from "@/features/playground/problem/description/footer"; import prisma from "@/lib/prisma"; +import ProblemDescriptionFooter from "@/features/playground/problem/description/footer"; interface ProblemDescriptionLayoutProps { params: Promise<{ id: string }>; diff --git a/src/app/(app)/problems/[id]/@problem/@description/page.tsx b/src/app/(app)/problems/[id]/@problem/@description/page.tsx index acc1f91..04e33b5 100644 --- a/src/app/(app)/problems/[id]/@problem/@description/page.tsx +++ b/src/app/(app)/problems/[id]/@problem/@description/page.tsx @@ -3,20 +3,20 @@ import { notFound } from "next/navigation"; import { MdxRenderer } from "@/components/content/mdx-renderer"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; -interface ProblemPageProps { +interface ProblemDescriptionPageProps { params: Promise<{ id: string }> } -export default async function ProblemPage({ +export default async function ProblemDescriptionPage({ params -}: ProblemPageProps) { +}: ProblemDescriptionPageProps) { const { id } = await params; const problem = await prisma.problem.findUnique({ where: { id: parseInt(id) }, - include: { - author: true, - }, + select: { + description: true, + } }); if (!problem) { diff --git a/src/app/(app)/problems/[id]/@problem/layout.tsx b/src/app/(app)/problems/[id]/@problem/layout.tsx index 78d658a..c691e09 100644 --- a/src/app/(app)/problems/[id]/@problem/layout.tsx +++ b/src/app/(app)/problems/[id]/@problem/layout.tsx @@ -47,10 +47,10 @@ export default function ProblemLayout({ {description} - + {solution} - + {submission}