diff --git a/frontend/src/app/questions/[slug]/page.tsx b/frontend/src/app/questions/[slug]/page.tsx
index 927047b..bb2a0a5 100644
--- a/frontend/src/app/questions/[slug]/page.tsx
+++ b/frontend/src/app/questions/[slug]/page.tsx
@@ -1,20 +1,6 @@
import { getQuestion } from "@/lib/api";
-import { Badge } from "@/components/ui/badge";
-import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
-import { CodeBlock } from "@/components/ui/code-block";
-import { Markdown } from "@/components/ui/markdown";
-import { Callout, ApproachBox } from "@/components/ui/callout";
-import { Collapsible } from "@/components/ui/collapsible";
-import { getDifficultyVariant, getDifficultyLabel, capitalize } from "@/lib/utils";
-import {
- FileText,
- AlertCircle,
- BookOpen,
- Code,
- Clock,
- HardDrive,
-} from "lucide-react";
-import Link from "next/link";
+import { QuestionDetail } from "@/components/questions/question-detail";
+import { ProblemWorkspace } from "@/components/editor";
import { notFound } from "next/navigation";
export default async function QuestionDetailPage({
@@ -31,262 +17,11 @@ export default async function QuestionDetailPage({
notFound();
}
- const optimalSolutions = question.solutions.filter((s) => s.is_optimal);
- const otherSolutions = question.solutions.filter((s) => !s.is_optimal);
+ // Show interactive workspace if the question has test cases
+ if (question.function_signature && question.visible_test_cases) {
+ return ;
+ }
- return (
-
-
-
-
{question.title}
-
-
- {capitalize(question.difficulty)}
-
-
-
-
-
- {question.categories.map((cat) => (
-
- {cat.name}
-
- ))}
- {question.patterns.map((pat) => (
-
- {pat.name}
-
- ))}
-
-
- {question.leetcode_url && (
-
- View on LeetCode
-
- )}
-
-
-
-
-
-
- Problem
-
-
-
- {question.description}
-
-
-
- {question.constraints && (
-
-
-
-
- Constraints
-
-
-
- {question.constraints}
-
-
- )}
-
- {question.examples && question.examples.length > 0 && (
-
-
-
-
- Examples
-
-
-
- {question.examples.map((example, i) => (
-
-
- Input:
- {example.input}
-
-
- Output:
- {example.output}
-
- {example.explanation && (
-
- {example.explanation}
-
- )}
-
- ))}
-
-
- )}
-
- {question.explanation && (
- <>
-
-
- {question.explanation.approach}
-
-
-
-
-
- {question.explanation.intuition}
-
-
-
-
-
-
-
- Complexity Analysis
-
-
-
-
-
-
- Time Complexity:
- {question.explanation.time_complexity}
-
-
-
-
-
- Space Complexity:
- {question.explanation.space_complexity}
-
-
-
-
-
- {question.explanation.common_pitfalls &&
- question.explanation.common_pitfalls.length > 0 && (
-
-
- {question.explanation.common_pitfalls.map((pitfall, i) => (
-
-
{pitfall.title}
-
- {pitfall.description}
-
- {(pitfall.wrong_approach || pitfall.correct_approach) && (
-
- {pitfall.wrong_approach && (
-
-
- {pitfall.wrong_approach}
-
-
- )}
- {pitfall.correct_approach && (
-
-
- {pitfall.correct_approach}
-
-
- )}
-
- )}
-
- ))}
-
-
- )}
-
- {question.explanation.key_takeaways &&
- question.explanation.key_takeaways.length > 0 && (
-
-
- {question.explanation.key_takeaways.map((takeaway, i) => (
- -
- {takeaway}
-
- ))}
-
-
- )}
- >
- )}
-
- {question.solutions.length > 0 && (
-
-
-
-
- Solutions
-
-
-
- {optimalSolutions.map((solution) => (
-
-
-
{solution.approach_name}
- Optimal
-
- {solution.explanation && (
-
- {solution.explanation}
-
- )}
-
-
- ))}
-
- {otherSolutions.length > 0 && (
-
- {otherSolutions.map((solution) => (
-
- {solution.approach_name}
-
- Alternative
-
-
- }
- defaultOpen={false}
- >
- {solution.explanation && (
-
- {solution.explanation}
-
- )}
-
-
- ))}
-
- )}
-
-
- )}
-
- );
+ // Fall back to read-only view for questions without test cases
+ return ;
}