From b6a3ad2c59fd8c60152d0fda7c5374a399a64621 Mon Sep 17 00:00:00 2001
From: "gpt-engineer-app[bot]"
<159125892+gpt-engineer-app[bot]@users.noreply.github.com>
Date: Mon, 11 Aug 2025 10:10:04 +0000
Subject: [PATCH] Update page background and add sharing
Change the entire page background to a subtle green upon successful completion of the rules of inference puzzle. Add share links and a unique URL for direct access to the interactive.
---
src/App.tsx | 2 +
src/components/RulesOfInferencePlayground.tsx | 8 +--
src/pages/RulesOfInferencePlaygroundPage.tsx | 51 +++++++++++++++++++
.../theme-pages/discrete-math/Foundations.tsx | 2 +-
4 files changed, 59 insertions(+), 4 deletions(-)
create mode 100644 src/pages/RulesOfInferencePlaygroundPage.tsx
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 */}