diff --git a/src/app/(app)/problems/[id]/@problem/@description/layout.tsx b/src/app/(app)/problems/[id]/@problem/@description/layout.tsx index 8094f63..76fb6e3 100644 --- a/src/app/(app)/problems/[id]/@problem/@description/layout.tsx +++ b/src/app/(app)/problems/[id]/@problem/@description/layout.tsx @@ -1,16 +1,30 @@ import ProblemDescriptionFooter from "@/features/playground/problem/description/footer"; +import prisma from "@/lib/prisma"; interface ProblemDescriptionLayoutProps { + params: Promise<{ id: string }>; children: React.ReactNode; } -export default function ProblemDescriptionLayout({ +export default async function ProblemDescriptionLayout({ + params, children, }: ProblemDescriptionLayoutProps) { + const { id } = await params; + + const problem = await prisma.problem.findUnique({ + where: { id: parseInt(id) }, + select: { + title: true, + } + }); + + const title = problem?.title ?? ""; + return (
{children}
- +
); } diff --git a/src/features/playground/problem/description/footer.tsx b/src/features/playground/problem/description/footer.tsx index 02e9b1b..dfcab32 100644 --- a/src/features/playground/problem/description/footer.tsx +++ b/src/features/playground/problem/description/footer.tsx @@ -1,10 +1,12 @@ import { cn } from "@/lib/utils"; interface ProblemDescriptionFooterProps { + title: string; className?: string; } export default function ProblemDescriptionFooter({ + title, className, ...props }: ProblemDescriptionFooterProps) { @@ -14,7 +16,7 @@ export default function ProblemDescriptionFooter({ className={cn("h-9 flex flex-none items-center bg-muted px-3 py-2", className)} >
- Description of Two Sum + Description of {title}
);