diff --git a/src/App.tsx b/src/App.tsx index 8e2483e..9f56c04 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -49,6 +49,7 @@ import GridTilingPuzzlePage from './pages/GridTilingPuzzlePage'; import SunnyLinesPuzzlePage from './pages/SunnyLinesPuzzlePage'; import SikiniaParliamentPuzzlePage from './pages/SikiniaParliamentPuzzlePage'; import NQueensPuzzlePage from './pages/NQueensPuzzlePage'; +import RulesOfInferencePlaygroundPage from './pages/RulesOfInferencePlaygroundPage'; const queryClient = new QueryClient(); @@ -107,6 +108,7 @@ const App = () => ( } /> } /> } /> + } /> } /> {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} diff --git a/src/components/RulesOfInferencePlayground.tsx b/src/components/RulesOfInferencePlayground.tsx index 6df2e2f..e377d5d 100644 --- a/src/components/RulesOfInferencePlayground.tsx +++ b/src/components/RulesOfInferencePlayground.tsx @@ -122,7 +122,7 @@ function DropZone({ children, onDrop, className }: { children?: React.ReactNode; ); } -export default function RulesOfInferencePlayground() { +export default function RulesOfInferencePlayground({ onComplete }: { onComplete?: (completed: boolean) => void }) { const { toast } = useToast(); const [exampleId, setExampleId] = useState(EXAMPLES[0].id); const example = useMemo(() => EXAMPLES.find((e) => e.id === exampleId)!, [exampleId]); @@ -139,7 +139,8 @@ export default function RulesOfInferencePlayground() { setSteps([]); setActivePremises([]); setActiveRule(undefined); - }, [exampleId]); + onComplete?.(false); + }, [exampleId, onComplete]); const availableStatements = useMemo( () => Array.from(new Set([...(example?.premises ?? []), ...steps.map((s) => s.result)])), @@ -220,6 +221,7 @@ export default function RulesOfInferencePlayground() { if (result === example.conclusion) { toast({ title: "Proof complete!", description: "You successfully derived the target conclusion!" }); + onComplete?.(true); } else { toast({ title: "Step added", description: "Continue building your proof with the new statement." }); } @@ -254,7 +256,7 @@ export default function RulesOfInferencePlayground() { setActivePremises((prev) => prev.filter((x) => x !== p)); return ( -
+
{/* Top controls */}